CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csTree Class Template Reference

A generic binary search tree. More...

#include <bintree.h>

List of all members.

Public Methods

 csTree (int blocksize=15)
 Construct a tree that allocates memory for nodes in blocks of the given size. More...

 csTree (const csTree< T > &other)
 Copy constructor. More...

void PopulateWith (const csArray< uint32 > &keys, const csArray< T > &values)
 Populate an empty tree with entries from a sorted array. More...

void Traverse (TraverseFunc *func, void *some) const
 Call a callback function once for every entry in the tree. More...

void Put (uint32 key, const T &value)
 Put an entry into the tree, overwriting if the key already exists. More...

T & Find (uint32 key)
 Find the given entry in the tree, creating it if it doesn't exist. More...

const T & Find (uint32 key) const
 Find the given entry in the tree, returning 0 if it doesn't exist,. More...

bool Delete (uint32 key)
 Delete the given entry from the tree, returning false if it doesn't exist. More...

bool DeleteAll ()
 Delete all the entries from the tree. More...

int GetSize () const
 Get the number of entries in the tree. More...


Detailed Description

template<class T>
class csTree< T >

A generic binary search tree.

Definition at line 27 of file bintree.h.


Constructor & Destructor Documentation

template<class T>
csTree< T >::csTree int    blocksize = 15 [inline]
 

Construct a tree that allocates memory for nodes in blocks of the given size.

Definition at line 111 of file bintree.h.

template<class T>
csTree< T >::csTree const csTree< T > &    other [inline]
 

Copy constructor.

Definition at line 115 of file bintree.h.

References csBlockAllocator::Alloc.


Member Function Documentation

template<class T>
bool csTree< T >::Delete uint32    key [inline]
 

Delete the given entry from the tree, returning false if it doesn't exist.

Definition at line 229 of file bintree.h.

References csBlockAllocator::Free, and uint32.

template<class T>
bool csTree< T >::DeleteAll   [inline]
 

Delete all the entries from the tree.

Definition at line 300 of file bintree.h.

template<class T>
const T& csTree< T >::Find uint32    key const [inline]
 

Find the given entry in the tree, returning 0 if it doesn't exist,.

Definition at line 209 of file bintree.h.

References uint32.

template<class T>
T& csTree< T >::Find uint32    key [inline]
 

Find the given entry in the tree, creating it if it doesn't exist.

Definition at line 175 of file bintree.h.

References uint32.

template<class T>
int csTree< T >::GetSize   const [inline]
 

Get the number of entries in the tree.

Definition at line 308 of file bintree.h.

template<class T>
void csTree< T >::PopulateWith const csArray< uint32 > &    keys,
const csArray< T > &    values
[inline]
 

Populate an empty tree with entries from a sorted array.

Definition at line 123 of file bintree.h.

References csArray::Length.

template<class T>
void csTree< T >::Put uint32    key,
const T &    value
[inline]
 

Put an entry into the tree, overwriting if the key already exists.

Definition at line 137 of file bintree.h.

References uint32.

template<class T>
void csTree< T >::Traverse TraverseFunc *    func,
void *    some
const [inline]
 

Call a callback function once for every entry in the tree.

Definition at line 131 of file bintree.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14