Back to index

tetex-bin  3.0
Public Member Functions | Private Attributes
Array Class Reference

#include <Array.h>

Collaboration diagram for Array:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Array (XRef *xrefA)
 ~Array ()
int incRef ()
int decRef ()
int getLength ()
void add (Object *elem)
Objectget (int i, Object *obj)
ObjectgetNF (int i, Object *obj)

Private Attributes

XRefxref
Objectelems
int size
int length
int ref

Detailed Description

Definition at line 26 of file Array.h.


Constructor & Destructor Documentation

Array::Array ( XRef xrefA)

Definition at line 25 of file Array.cc.

                        {
  xref = xrefA;
  elems = NULL;
  size = length = 0;
  ref = 1;
}

Definition at line 32 of file Array.cc.

              {
  int i;

  for (i = 0; i < length; ++i)
    elems[i].free();
  gfree(elems);
}

Here is the call graph for this function:


Member Function Documentation

void Array::add ( Object elem)

Definition at line 40 of file Array.cc.

                            {
  if (length == size) {
    if (length == 0) {
      size = 8;
    } else {
      size *= 2;
    }
    elems = (Object *)grealloc(elems, size * sizeof(Object));
  }
  elems[length] = *elem;
  ++length;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int Array::decRef ( ) [inline]

Definition at line 37 of file Array.h.

{ return --ref; }
Object * Array::get ( int  i,
Object obj 
)

Definition at line 53 of file Array.cc.

                                     {
  if (i < 0 || i >= length) {
#ifdef DEBUG_MEM
    abort();
#else
    return obj->initNull();
#endif
  }
  return elems[i].fetch(xref, obj);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int Array::getLength ( ) [inline]

Definition at line 40 of file Array.h.

{ return length; }

Here is the caller graph for this function:

Object * Array::getNF ( int  i,
Object obj 
)

Definition at line 64 of file Array.cc.

                                       {
  if (i < 0 || i >= length) {
#ifdef DEBUG_MEM
    abort();
#else
    return obj->initNull();
#endif
  }
  return elems[i].copy(obj);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int Array::incRef ( ) [inline]

Definition at line 36 of file Array.h.

{ return ++ref; }

Member Data Documentation

Object* Array::elems [private]

Definition at line 52 of file Array.h.

int Array::length [private]

Definition at line 54 of file Array.h.

int Array::ref [private]

Definition at line 55 of file Array.h.

int Array::size [private]

Definition at line 53 of file Array.h.

XRef* Array::xref [private]

Definition at line 51 of file Array.h.


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