Back to index

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

#include <assoc_environment.hpp>

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

List of all members.

Public Member Functions

 assoc_environment_rep (int n2)
 ~assoc_environment_rep ()
void raw_write (int i, int key, const tree &val)
void raw_write (int i, const string &key, const tree &val)
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

int n
assoc_nodea
int ref_count

Static Private Attributes

static tree uninit

Friends

class environment

Detailed Description

Definition at line 34 of file assoc_environment.hpp.


Constructor & Destructor Documentation

Definition at line 40 of file assoc_environment.hpp.

                                       :
    n (n2), a (tm_new_array<assoc_node> (n)) {}

Definition at line 42 of file assoc_environment.hpp.

Here is the call graph for this function:


Member Function Documentation

bool assoc_environment_rep::contains ( int  key) [virtual]

Implements environment_rep.

Definition at line 22 of file assoc_environment.cpp.

                                        {
  for (int i=0; i<n; i++)
    if (a[i].key == key) return true;
  return false;
}
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 assoc_environment_rep::print ( const string prefix) [virtual]

Implements environment_rep.

Definition at line 63 of file assoc_environment.cpp.

                                                  {
  cout << prefix << "Assoc environment" << LF;
  for (int i=0; i<n; i++)
    cout << prefix << "| " << a[i].key
        << ": " << as_string ((tree_label) a[i].key)
        << " -> " << a[i].val << LF;
}

Here is the call graph for this function:

void assoc_environment_rep::raw_write ( int  i,
int  key,
const tree val 
) [inline]

Definition at line 44 of file assoc_environment.hpp.

                                                          {
    a[i].key= key; a[i].val= val; }
void assoc_environment_rep::raw_write ( int  i,
const string key,
const tree val 
) [inline]

Definition at line 46 of file assoc_environment.hpp.

                                                                    {
    a[i].key= (int) make_tree_label (key); a[i].val= val; }

Here is the call graph for this function:

tree assoc_environment_rep::read ( int  key) [virtual]

Implements environment_rep.

Definition at line 29 of file assoc_environment.cpp.

                                    {
  for (int i=0; i<n; i++)
    if (a[i].key == key) return a[i].val;
  return uninit;
}
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 assoc_environment_rep::remove ( int  key) [virtual]

Implements environment_rep.

Definition at line 49 of file assoc_environment.cpp.

                                      {
  for (int i=0; i<n; i++)
    if (a[i].key == key) {
      assoc_node* b= tm_new_array<assoc_node> (n-1);
      for (int j=0; j<i; j++) b[j]= a[j];
      for (int j=i+1; j<n; j++) b[j-1]= a[j];
      tm_delete_array (a);
      a= b;
      n--;
      return;
    }
}

Here is the call graph for this function:

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 assoc_environment_rep::write ( int  key,
const tree val 
) [virtual]

Implements environment_rep.

Definition at line 36 of file assoc_environment.cpp.

                                                      {
  for (int i=0; i<n; i++)
    if (a[i].key == key) { a[i].val= val; return; }
  assoc_node* b= tm_new_array<assoc_node> (n+1);
  for (int i=0; i<n; i++) b[i]= a[i];
  b[n].key= key;
  b[n].val= val;
  tm_delete_array (a);
  a= b;
  n++;
}

Here is the call graph for this function:

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 38 of file assoc_environment.hpp.

Definition at line 37 of file assoc_environment.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.

Definition at line 35 of file assoc_environment.hpp.


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