Logo Search packages:      
Sourcecode: ragel version File versions

BstTable< BST_TEMPL_DECLARE > Class Template Reference

#include <bsttable.h>

Inheritance diagram for BstTable< BST_TEMPL_DECLARE >:

Vector< Element, Resize > Table< Element >

List of all members.

Detailed Description

class BstTable< BST_TEMPL_DECLARE >

Binary search table for structures that contain a key.

This is the basic binary search table. It can be used to contain a structure that has a key and some data. The key should be a member of the element class accessible with getKey(). The compare routine should also be a member of the element class.

Definition at line 30 of file bstcommon.h.

Public Member Functions

void abandon ()
 BstTable (long allocLen)
 Construct a binary search table with an initial amount of allocation.
 BstTable ()
 Default constructor.
void empty ()
Element * find (const Key &key, Element **lastFound=0) const
 Find an element with the given key.
bool findMulti (const Key &key, Element *&lower, Element *&upper) const
 Find a range of elements with the given key.
IterFirst first ()
 Return first element.
Element * insert (const Element &el, Element **lastFound=0)
 Insert the given element.
bool insert (const BstTable &other)
 Insert each element from other.
Element * insert (const Key &key, Element **lastFound=0)
 Insert a new element with the given key.
Element * insertMulti (const Element &el)
 Insert the given element even if it exists already.
void insertMulti (const BstTable &other)
 Insert each element from other even if the elements exist already.
Element * insertMulti (const Key &key)
 Insert a new element even if the key exists already.
IterLast last ()
 Return last element.
long length () const
 Get the length of the vector.
Element & operator[] (int i) const
bool remove (Element *item)
 Remove the element pointed to by item.
bool remove (const Key &key)
 Find the element with the given key and remove it.
long removeMulti (Element *lower, Element *upper)
long removeMulti (const Key &key)
 Find and remove the entire range of elements with the given key.
void shallowCopy (const Vector &v)
long size () const
void append (const Vector &v)
void append (const Element *val, long len)
void append (const Element &val)
void appendDup (const Element &item, long len)
void appendNew (long len)
void appendNew ()
void insert (long pos, const Vector &v)
void insert (long pos, const Element *val, long len)
void insert (long pos, const Element &val)
void insertDup (long pos, const Element &val, long len)
void insertNew (long pos, long len)
void insertNew (long pos)
void prepend (const Vector &v)
void prepend (const Element *val, long len)
void prepend (const Element &val)
void prependDup (const Element &item, long len)
void prependNew (long len)
void prependNew ()
void remove (long pos, long len)
void remove (long pos)
void replace (long pos, const Vector &v)
void replace (long pos, const Element *val, long len)
void replace (long pos, const Element &val)
void replaceDup (long pos, const Element &val, long len)
void replaceNew (long pos, long len)
void replaceNew (long pos)
void setAs (const Vector &v)
void setAs (const Element *val, long len)
void setAs (const Element &val)
void setAsDup (const Element &item, long len)
void setAsNew (long len)
void setAsNew ()

Public Attributes

long allocLen
 Allocated length.
Element * data
 Table data.
long tabLen
 Table length.

Protected Member Functions

void downResize (long len)
void upResize (long len)

Private Types

typedef Table< Element > BaseTable
typedef Vector< Element, Resize > BaseVector

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

Generated by  Doxygen 1.6.0   Back to index