Software and Services, Portable Libraries  2019.Mar.01
A library for managing digital certificates
SoftwareAndServices::Library::Common::Tree Class Referenceabstract

A simple Tree. More...

#include "<SaS/Common/Tree.hpp>"

Public Types

typedef int(* TCMP_t) (const Tree *, const Tree *)
 Signature for compare routine. More...

Public Member Functions

 Tree ()
 Tree - Default Constructor. More...
virtual ~Tree ()
 Tree - Destructor. More...
virtual TreeFind (Tree *Root, const void *ToFind, TCMP_t CmpFunction)=0
 Find element in Tree. More...
virtual bool Insert (Tree **Root, const Tree *NewData, int Cmp(const Tree *One, const Tree *Two))=0
 Insert node into Tree. More...
virtual bool Remove (Tree **Root, const Tree *ToRemove, int Cmp(const Tree *One, const Tree *Two))=0
 Remove an element from the Tree. More...
virtual void Walk (const Tree *Root, WALK_t WalkFunction)=0
 Walk the Tree and apply WalkFunction. More...

Protected Attributes

void * _Data
 The data in the node. More...

Detailed Description

A simple Tree.

Definition at line 100 of file Tree.hpp.

Member Typedef Documentation

◆ TCMP_t


Signature for compare routine.

OneThe first item to compare.
TwoThe second item to compare.
Zero if they are equal, else < 0 if One is less than two and > 0 if Two is more than One.

Definition at line 116 of file Tree.hpp.

Constructor & Destructor Documentation

◆ Tree()

SoftwareAndServices::Library::Common::Tree::Tree ( )

Tree - Default Constructor.

◆ ~Tree()

virtual SoftwareAndServices::Library::Common::Tree::~Tree ( )

Tree - Destructor.

Member Function Documentation

◆ Find()

virtual Tree* SoftwareAndServices::Library::Common::Tree::Find ( Tree Root,
const void *  ToFind,
TCMP_t  CmpFunction 
pure virtual

Find element in Tree.

RootStart of where to look.
ToFindWhat to find.
CmpFunctionRoutine to use as compare.
The node, or nullptr if none.

◆ Insert()

virtual bool SoftwareAndServices::Library::Common::Tree::Insert ( Tree **  Root,
const Tree NewData,
int   Cmpconst Tree *One, const Tree *Two 
pure virtual

Insert node into Tree.

RootStart of Tree to use.
NewDataThe new data to add.
CmpThe name of the compare routine to use.
TRUE if inserted.

◆ Remove()

virtual bool SoftwareAndServices::Library::Common::Tree::Remove ( Tree **  Root,
const Tree ToRemove,
int   Cmpconst Tree *One, const Tree *Two 
pure virtual

Remove an element from the Tree.

RootTop of the Tree to use.
ToRemoveThe node value to remove.
CmpThe name of the compare function.
TRUE if found and removed.

◆ Walk()

virtual void SoftwareAndServices::Library::Common::Tree::Walk ( const Tree Root,
WALK_t  WalkFunction 
pure virtual

Walk the Tree and apply WalkFunction.

RootThe top of the Tree to walk.
WalkFunctionThe name of the function to apply to each found node.

Member Data Documentation

◆ _Data

void* SoftwareAndServices::Library::Common::Tree::_Data

The data in the node.

Definition at line 191 of file Tree.hpp.

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