Back to index

plt-scheme  4.2.1
Public Member Functions | Static Public Member Functions | Public Attributes
mzTree Class Reference
Inheritance diagram for mzTree:
Inheritance graph
[legend]
Collaboration diagram for mzTree:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 mzTree (int c)
virtual void Grow (int n)
virtual void Grow (char *cmd, char *&result)
void Graft (Tree *left, Tree *right)

Static Public Member Functions

static void Add (Tree *t)
static void Drop (Tree *t)

Public Attributes

Treeleft_branch
Treeright_branch
int leaves
voiduser_data

Detailed Description

Definition at line 221 of file tree.cxx.


Constructor & Destructor Documentation

mzTree::mzTree ( int  c) [inline]

Definition at line 223 of file tree.cxx.

: Tree(c) { }

Member Function Documentation

static void Tree::Add ( Tree t) [inline, static, inherited]

Definition at line 182 of file tree.cxx.

                           {
    if (t)
      t->refcount++;
  }

Here is the caller graph for this function:

static void Tree::Drop ( Tree t) [inline, static, inherited]

Definition at line 186 of file tree.cxx.

                            {
    if (t) {
      t->refcount--;
      if (!t->refcount)
       delete t;
    }
  }

Here is the caller graph for this function:

void Tree::Graft ( Tree left,
Tree right 
) [inline, inherited]

Definition at line 164 of file tree.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void mzTree::Grow ( int  n) [inline, virtual]

Reimplemented from Tree.

Definition at line 225 of file tree.cxx.

                           {
    /* Check whether the Scheme class for user_data is 
       actually a derived class that overrides `grow': */
    Scheme_Object *scmobj;
    Scheme_Object *overriding;

    /* Pointer to Scheme instance kept in user_data: */
    scmobj = (Scheme_Object *)user_data;

    /* Look for an overriding `grow' method in scmobj: */
    overriding = objscheme_find_method(scmobj,
                                   "grow",
                                   &grow_method_cache);

    if (overriding != grow_prim) {
      /* Call Scheme-based overriding implementation: */
      Scheme_Object *argv[2];

      argv[0] = scmobj;
      argv[1] = scheme_make_integer(n);
      _scheme_apply(overriding, 2, argv);
    } else {
      /* Grow is not overridden in Scheme: */
      Tree::Grow(n);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void mzTree::Grow ( char *  cmd,
char *&  result 
) [inline, virtual]

Reimplemented from Tree.

Definition at line 254 of file tree.cxx.

                                              {
    Scheme_Object *scmobj;
    Scheme_Object *overriding;

    scmobj = (Scheme_Object *)user_data;

    /* Look for an overriding `grow' method in scmobj: */
    overriding = objscheme_find_method(scmobj,
                                   "grow",
                                   &grow_method_cache);

    if (overriding != grow_prim) {
      /* When calling the Scheme-based overriding implementation,
        we implement the `result' parameter as a boxed string.
        The Scheme code mutates the box content to return a 
        result. */
      Scheme_Object *argv[2], *res;

      argv[0] = scmobj;
      argv[1] = scheme_make_utf8_string(cmd);
      argv[2] = scheme_box(scheme_make_utf8_string(""));

      _scheme_apply(overriding, 3, argv);

      res = scheme_unbox(argv[2]);
      if (!SCHEME_CHAR_STRINGP(res)) {
       scheme_wrong_type("result for tree%'s grow method",
                       "string", -1, 0, &res);
      } else
       result = scheme_utf8_encode_to_buffer(SCHEME_CHAR_STR_VAL(argv[2]), -1, NULL, 0);
    } else {
      Tree::Grow(cmd, result);
    }
  }

Here is the call graph for this function:


Member Data Documentation

int Tree::leaves [inherited]

Definition at line 116 of file tree.cxx.

Tree* Tree::left_branch [inherited]

Definition at line 115 of file tree.cxx.

Tree * Tree::right_branch [inherited]

Definition at line 115 of file tree.cxx.

void* Tree::user_data [inherited]

Definition at line 118 of file tree.cxx.


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