|
treemap * | find (const char *name) const |
| Find a subnode from our node by name.
|
|
const T & | get (void) const |
| Return the typed value of this node.
|
|
treemap * | getChild (const char *name) const |
| Get direct typed child node of our node of specified name.
|
|
const T & | getData (void) const |
| Get the data value of a data based value tree.
|
|
treemap * | getFirst (void) const |
| Get first child of our node.
|
|
treemap * | getIndexed (unsigned index) const |
| Get child member node by index.
|
|
treemap * | getLeaf (const char *name) const |
| Find a direct typed leaf node on our node.
|
|
treemap * | getParent (void) const |
| Get the typed parent node for our node.
|
|
const T | getPointer (void) const |
| Get the pointer of a pointer based value tree.
|
|
T | getValue (const char *name) const |
| Get the value pointer of a leaf node of a pointer tree.
|
|
bool | is_attribute (void) const |
| Test if this node is a leaf node for a tree pointer table.
|
|
treemap * | leaf (const char *name) const |
| Search for a leaf node of our node.
|
|
const T & | operator* () const |
| Return typed value of this node by pointer reference.
|
|
void | operator= (const T &data) |
| Assign the value of our node.
|
|
treemap * | path (const char *path) const |
| Find a subnode by pathname.
|
|
void | set (const T &reference) |
| Set the value of a data based value tree.
|
|
void | setPointer (const T pointer) |
| Set the pointer of a pointer based value tree.
|
|
| treemap (char *name=NULL) |
| Construct a typed root node for the tree.
|
|
| treemap (const treemap &source) |
| Construct a copy of the treemap object.
|
|
| treemap (treemap *parent, char *name) |
| Construct a child node on an existing tree.
|
|
| treemap (treemap *parent, char *name, T &reference) |
| Construct a child node on an existing tree and assign it's value.
|
|
NamedTree * | find (const char *name) const |
| Find a child node of our object with the specified name.
|
|
NamedTree * | getChild (const char *name) const |
| Find a direct child of our node which matches the specified name.
|
|
NamedTree * | getFirst (void) const |
| Get first child node in our ordered list of children.
|
|
OrderedIndex * | getIndex (void) const |
| Get the ordered index of our child nodes.
|
|
NamedTree * | getIndexed (unsigned index) const |
| Get child by index number.
|
|
NamedTree * | getLeaf (const char *name) const |
| Find a direct leaf node on our node.
|
|
NamedTree * | getParent (void) const |
| Get parent node we are listed as a child on.
|
|
bool | is_leaf (void) const |
| Test if node has children.
|
|
bool | is_root (void) const |
| Test if node is root node.
|
|
NamedTree * | leaf (const char *name) const |
| Find a child leaf node of our object with the specified name.
|
|
| operator bool () const |
| Test if this node has a name.
|
|
bool | operator! () const |
| Test if this node is unnamed.
|
|
NamedTree * | path (const char *path) const |
| Find a subnode by a dot separated list of node names.
|
|
void | relist (NamedTree *trunk=NULL) |
| Default relist is by tail...
|
|
void | relistHead (NamedTree *trunk) |
| Add leaf to a trunk, by reverse order.
|
|
void | relistTail (NamedTree *trunk) |
| Add leaf to a trunk, by order.
|
|
void | remove (void) |
| Remove our node from our parent list.
|
|
void | setId (char *name) |
| Set or replace the name id of this node.
|
|
void | add (NamedObject **hash, char *name, unsigned size=1) |
| Add object to hash indexed list.
|
|
virtual int | compare (const char *name) const |
| Compare the name of our object to see if equal.
|
|
bool | equal (const char *name) const |
| Equal function which calls compare.
|
|
char * | getId (void) const |
| Get the named id string of this object.
|
|
NamedObject * | getNext (void) const |
| Get next effective object when iterating.
|
|
bool | operator!= (const char *name) const |
| Comparison operator between our name and a string.
|
|
bool | operator== (const char *name) const |
| Comparison operator between our name and a string.
|
|
void | delist (OrderedIndex *index) |
| Remove our ordered object from an existing index.
|
|
virtual void | enlist (OrderedIndex *index) |
| List our ordered object in default strategy mode.
|
|
void | enlistHead (OrderedIndex *index) |
| List our ordered object at start of a linked list on an index.
|
|
void | enlistTail (OrderedIndex *index) |
| List our ordered object at end of a linked list on an index.
|
|
OrderedObject * | getNext (void) const |
| Get next ordered member when iterating.
|
|
void | delist (LinkedObject **root) |
| Locate and remove ourselves from a list of objects.
|
|
void | enlist (LinkedObject **root) |
| Add our object to an existing linked list through a pointer.
|
|
LinkedObject * | getNext (void) const |
| Get next effective object when iterating.
|
|
bool | is_member (LinkedObject *list) const |
| Search to see if we are a member of a specific list.
|
|
virtual void | release (void) |
| Release list, mark as no longer linked.
|
|
virtual void | retain (void) |
| Retain by marking as self referenced list.
|
|
ObjectProtocol * | copy (void) |
| Retain (increase retention of) object when copying.
|
|
void | operator++ (void) |
| Increase retention operator.
|
|
void | operator-- (void) |
| Decrease retention operator.
|
|
virtual | ~ObjectProtocol () |
| Required virtual destructor.
|
|
|
static T | getPointer (treemap *node) |
| Return value from tree element when value is a pointer.
|
|
static unsigned | count (NamedObject **hash, unsigned size) |
| Count the total named objects in a hash table.
|
|
static NamedObject * | find (NamedObject *root, const char *name) |
| Find a named object from a simple list.
|
|
static NamedObject ** | index (NamedObject **hash, unsigned size) |
| Convert a hash index into a linear object pointer array.
|
|
static unsigned | keyindex (const char *name, unsigned size) |
| Internal function to convert a name to a hash index number.
|
|
static NamedObject * | map (NamedObject **hash, const char *name, unsigned size) |
| Find a named object through a hash map table.
|
|
static void | purge (NamedObject **hash, unsigned size) |
| Purge a hash indexed table of named objects.
|
|
static NamedObject * | remove (NamedObject **hash, const char *name, unsigned size) |
| Remove an object from a hash map table.
|
|
static NamedObject * | remove (NamedObject **root, const char *name) |
| Remove a named object from a simple list.
|
|
static NamedObject * | skip (NamedObject **hash, NamedObject *current, unsigned size) |
| Iterate through a hash map table.
|
|
static NamedObject ** | sort (NamedObject **list, size_t count=0) |
| Sort an array of named objects in alphabetical order.
|
|
static unsigned | count (const LinkedObject *root) |
| Count the number of linked objects in a list.
|
|
static LinkedObject * | getIndexed (LinkedObject *root, unsigned index) |
| Get member by index.
|
|
static void | purge (LinkedObject *root) |
| Release all objects from a list.
|
|
|
| NamedTree (char *name=NULL) |
| Create a stand-alone or root tree node, with an optional name.
|
|
| NamedTree (const NamedTree &source) |
| Construct a copy of the tree.
|
|
| NamedTree (NamedTree *parent, char *name) |
| Create a tree node as a child of an existing node.
|
|
void | purge (void) |
| Performs object destruction.
|
|
virtual | ~NamedTree () |
| Delete node in a tree.
|
|
virtual void | clearId (void) |
| The behavior of clearing id's can be overridden if they are not assigned as strdup's from the heap...
|
|
| NamedObject () |
| Create an empty unnamed cell object.
|
|
| NamedObject (NamedObject **hash, char *name, unsigned size=1) |
| Create a named object and add to hash indexed list.
|
|
| NamedObject (OrderedIndex *index, char *name) |
| Created a named object on an ordered list.
|
|
| ~NamedObject () |
| Destroy named object.
|
|
| OrderedObject () |
| Construct an ordered object unattached.
|
|
| OrderedObject (const OrderedObject &from) |
|
| OrderedObject (OrderedIndex *index) |
| Construct an ordered object aot end of a an index.
|
|
| LinkedObject () |
| Construct base class unattached to anyone.
|
|
| LinkedObject (const LinkedObject &from) |
|
| LinkedObject (LinkedObject **root) |
| Construct base class attached to a chain of objects.
|
|
template<typename T>
class ucommon::treemap< T >
Embed data objects into a tree structured memory database.
This can be used to form XML document trees or other data structures that can be organized in trees. The NamedTree class is used to manage the structure of the tree, and the type specified is embedded as a data value object which can be manipulated. Name identifiers are assumed to be dynamically allocated if tree node elements are deletable.
Embedded values can either be of direct types that are then stored as part of the template object, or of class types that are data pointers. The latter might be used for trees that contain data which might be parsed dynamically from a document and/or saved on a heap. Pointer trees assume that NULL pointers are for nodes that are empty, and that NULL data value nodes with children are trunk nodes. Generally data values are then allocated with a pointer stored in pure leaf nodes.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 1205 of file linked.h.