Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Static Private Attributes | Friends
list_environment_rep Class Reference

#include <list_environment.hpp>

Inheritance diagram for list_environment_rep:
Inheritance graph
[legend]
Collaboration diagram for list_environment_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 list_environment_rep (basic_environment env2, list_environment next2)
void compress ()
treeraw_read (int key)
bool contains (int key)
tree read (int key)
void write (int key, const tree &val)
void remove (int key)
void print (const string &prefix)
bool contains (const string &key)
tree read (const string &key)
void write (const string &key, const tree &val)
void remove (const string &key)

Public Attributes

basic_environment env
list_environment next
int misses
int ref_count

Static Private Attributes

static tree uninit

Friends

class environment

Detailed Description

Definition at line 31 of file list_environment.hpp.


Constructor & Destructor Documentation

Definition at line 39 of file list_environment.hpp.

                                                                              :
    env (env2), next (next2), misses (0) {}

Member Function Documentation

Definition at line 22 of file list_environment.cpp.

                                {
  while (!is_nil (next->next) &&
        env->size > next->env->size + next->next->env->size)
    next->compress ();
    
  int new_size= env->size+ next->env->size;
  int new_n=2;
  while (new_n < new_size) new_n= new_n<<1;
  basic_environment new_env (new_n);
  new_env->multiple_insert (next->env->a, next->env->n);
  new_env->multiple_write (env->a, env->n);
  misses= 0;
  env   = new_env;
  next  = next->next;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool list_environment_rep::contains ( int  key) [inline, virtual]

Implements environment_rep.

Definition at line 45 of file list_environment.hpp.

                                 {
    return raw_read (key) != 0; }

Here is the call graph for this function:

bool environment_rep::contains ( const string key) [inline, inherited]

Definition at line 59 of file environment.hpp.

                                           {
    return contains ((int) make_tree_label (key)); }

Here is the call graph for this function:

void list_environment_rep::print ( const string prefix) [virtual]

Implements environment_rep.

Definition at line 59 of file list_environment.cpp.

                                                 {
  cout << prefix << "List environment" << LF;
  env->print (prefix * "|  ");
  list_environment it= next;
  while (!is_nil (it)) {
    it->env->print (prefix * "|  ");
    it= it->next;
  }
}

Here is the call graph for this function:

Definition at line 43 of file list_environment.cpp.

                                       {
  tree* r= env->raw_read (key);
  if (r != NULL || is_nil (next)) return r;
  misses++;
  if (misses >= env->size + next->env->size) {
    compress ();
    return raw_read (key);
  }
  else return next->raw_read (key);
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree list_environment_rep::read ( int  key) [inline, virtual]

Implements environment_rep.

Definition at line 47 of file list_environment.hpp.

                             {
    tree* ptr= raw_read (key);
    return ptr==NULL? uninit: *ptr; }

Here is the call graph for this function:

tree environment_rep::read ( const string key) [inline, inherited]

Definition at line 61 of file environment.hpp.

                                       {
    return read ((int) make_tree_label (key)); }

Here is the call graph for this function:

void list_environment_rep::remove ( int  key) [inline, virtual]

Implements environment_rep.

Definition at line 52 of file list_environment.hpp.

                               {
    // NOTE: it is not allowed to change next, in the case
    // when 'key' does not exist in the local environment 'env'
    env->remove (key); }
void environment_rep::remove ( const string key) [inline, inherited]

Definition at line 65 of file environment.hpp.

                                         {
    remove ((int) make_tree_label (key)); }

Here is the call graph for this function:

void list_environment_rep::write ( int  key,
const tree val 
) [inline, virtual]

Implements environment_rep.

Definition at line 50 of file list_environment.hpp.

                                               {
    env->write (key, val); }
void environment_rep::write ( const string key,
const tree val 
) [inline, inherited]

Definition at line 63 of file environment.hpp.

                                                         {
    write ((int) make_tree_label (key), val); }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class environment [friend, inherited]

Definition at line 68 of file environment.hpp.


Member Data Documentation

Definition at line 34 of file list_environment.hpp.

Definition at line 36 of file list_environment.hpp.

Definition at line 35 of file list_environment.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.

Definition at line 32 of file list_environment.hpp.


The documentation for this class was generated from the following files: