Developer Documentation
RAVL, Recognition And Vision Library
USER HOME PAGE CLASS LIST CONTENTS
Ravl - Core - Trees - BinaryTreeC<class KeyT,class DataT>
 

  PUBLIC
BinaryTreeC::BinaryTreeC(void)
BinaryTreeC::BinaryTreeC(bool)
BinaryTreeC::BinaryTreeC(BinaryTreeBodyC &)
BinaryTreeC::Body(void)
BinaryTreeC::Body(void) const
BinaryTreeC::Copy(void) const
BinaryTreeC::Empty(void)
BinaryTreeC::Size(void) const
BinaryTreeC::IsEmpty(void) const
BinaryTreeC::Find(const KeyT &,DataT &)
BinaryTreeC::Remove(const KeyT &)
BinaryTreeC::Insert(const KeyT &,const DataT &,bool)
BinaryTreeC::MinData(void)
BinaryTreeC::MaxData(void)
BinaryTreeC::MinKey(void) const
BinaryTreeC::MaxKey(void) const
BinaryTreeC::Dump(ostream &)
RCHandleC::operator =(const RCHandleC &)
RCHandleC::DeepCopy(UIntT) const
RCHandleC::operator ==(const RCHandleC &) const
RCHandleC::operator !=(const RCHandleC &) const
RCHandleC::Hash(void) const
RCHandleC::IsValid(void) const
RCHandleC::Invalidate(void)
RCHandleC::IsHandleType(const DT &) const
RCHandleC::CheckHandleType(const DT &) const
RCHandleC::Body(void)
RCHandleC::Body(void) const
RCHandleC::References(void) const
RCHandleC::operator <<(ostream &,const RCHandleC &)
RCHandleC::operator >>(istream &,RCHandleC &)

   BinaryTreeC<class KeyT,class DataT>   
 
Binary tree.
 
include "Ravl/BinaryTree.hh"
Source file:Ravl/Core/Container/Trees/BinaryTree.hh
User Level:Normal
Library:RavlCore
Example:exBinaryTree.cc
In Scope:RavlN

Comments:
This class implements a simple binary tree. No attempt to balance the tree is made so only use this class if you are sure data will be inserted in a random order. Otherwise use AVLTreeC which attempts to keep the tree balanced.

Parent Classes: Derived Classes: Methods:
BinaryTreeC()
Default constructor.
NB. Creates an invalid handle.

BinaryTreeC(bool)
Default constructor.
NB. Creates an invalid handle.

BinaryTreeC(BinaryTreeBodyC<KeyT,DataT> & body)
Body constructor.

BinaryTreeBodyC<KeyT,DataT> & Body()
Access body.

const BinaryTreeBodyC<KeyT,DataT> & Body() const
Access body.

BinaryTreeC Copy() const
Make a copy of this tree.

void Empty()
Empty the tree of all contents.

SizeT Size() const
Number of elements in tree.

bool IsEmpty() const
Is tree empty ?

bool Find(const KeyT & key,DataT & result)
Find a data item with 'key' in the tree.
return true if found, false otherwise.

bool Remove(const KeyT & key)
Remove item from tree.

bool Insert(const KeyT & key,const DataT & dat,bool overwrite = true)
Insert a node into the tree.
If 'overwrite' is true, and a node with the given key is already in the tree then it will be overwritten otherwise 'false' will be returned.

DataT & MinData()
Get the data with smallest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().

DataT & MaxData()
Get the data at the largest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().

const KeyT & MinKey() const
Get the smallest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().

const KeyT & MaxKey() const
Get the largest key in the tree.
Note, the tree must NOT be empty, this can be checked with IsEmpty().

void Dump(ostream & out)
Dump the stream in a human readable fomat.
Usefull for debuging.

#include "Ravl/RefCounter.hh"
const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & operator =(const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & oth)
Assign handle.

RCHandleC<BinaryTreeBodyC<KeyT,DataT>> DeepCopy(UIntT levels = ((UIntT))) const
Do a deep copy of the object.

bool operator ==(const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & oth) const
Are handles to the same object ?

bool operator !=(const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & oth) const
Are handles to different objects ?

UIntT Hash() const
Default hash function.
This hashes on the address of the body.

bool IsValid() const
Test if this is a valid handle.

void Invalidate()
Invalidate this handle.
Unattaches the body from the handle.

bool IsHandleType(const DT &) const
Is handle of given type ?

void CheckHandleType(const DT & dummy) const
Check handle type. Throw an expception if not.

BinaryTreeBodyC<KeyT,DataT> & Body()
Access body of object.

const BinaryTreeBodyC<KeyT,DataT> & Body() const
Constant access to body of object.

UIntT References() const
Find the number of references to the body of this object.

ostream & operator <<(ostream & strm,const RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & obj)

istream & operator >>(istream & strm,RCHandleC<BinaryTreeBodyC<KeyT,DataT>> & obj)


Maintainer:Charles Galambos, Documentation by CxxDoc: Tue Aug 13 09:59:30 2002