Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Static Public Attributes
TreeNode Struct Reference

#include <leaky.h>

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

List of all members.

Public Member Functions

 TreeNode (Symbol *aSymbol)
TreeNodeGetDirectDescendant (Symbol *aSymbol)
bool HasDescendants () const
TreeNodeAddDescendant (Symbol *aSymbol)
voidoperator new (size_t size) CPP_THROW_NEW
void operator delete (void *ptr)

Public Attributes

TreeNodedescendants
TreeNodenextSibling
TreeNodenextRoot
Symbolsymbol
u_long bytesLeaked
u_long descendantBytesLeaked

Static Public Attributes

static TreeNodefreeList

Detailed Description

Definition at line 52 of file leaky.h.


Constructor & Destructor Documentation

TreeNode::TreeNode ( Symbol aSymbol) [inline]

Definition at line 53 of file leaky.h.

Here is the caller graph for this function:


Member Function Documentation

Definition at line 778 of file leaky.cpp.

{
  TreeNode* node = new TreeNode(aSymbol);
  node->nextSibling = descendants;
  descendants = node;
  return node;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 766 of file leaky.cpp.

{
  TreeNode* node = descendants;
  while (node) {
    if (node->symbol == aSymbol) {
      return node;
    }
    node = node->nextSibling;
  }
  return NULL;
}

Here is the caller graph for this function:

bool TreeNode::HasDescendants ( ) const [inline]

Definition at line 64 of file leaky.h.

                              {
    return NULL != descendants;
  }

Here is the caller graph for this function:

void TreeNode::operator delete ( void ptr)

Definition at line 757 of file leaky.cpp.

{
  TreeNode* node = (TreeNode*) ptr;
  if (node) {
    node->nextSibling = freeList;
    freeList = node;
  }
}
void * TreeNode::operator new ( size_t  size)

Definition at line 734 of file leaky.cpp.

{
  if (!freeList) {
    TreeNode* newNodes = (TreeNode*) new char[sizeof(TreeNode) * 5000];
    if (!newNodes) {
      return NULL;
    }
    TreeNode* n = newNodes;
    TreeNode* end = newNodes + 5000 - 1;
    while (n < end) {
      n->nextSibling = n + 1;
      n++;
    }
    n->nextSibling = NULL;
    freeList = newNodes;
  }

  TreeNode* rv = freeList;
  freeList = rv->nextSibling;

  return (void*) rv;
}

Member Data Documentation

Definition at line 75 of file leaky.h.

Definition at line 76 of file leaky.h.

Definition at line 70 of file leaky.h.

Definition at line 81 of file leaky.h.

Definition at line 72 of file leaky.h.

Definition at line 71 of file leaky.h.

Definition at line 73 of file leaky.h.


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