|
GCpp general purpose C++ library
version 1.0
|
#include <GTreeLeafT.hh>
Public Member Functions | |
| template<class Q > | |
| bool | IsInstanceOf () const |
| template<class Q > | |
| bool | IsInstanceOf () |
| virtual GTreeLeafT< T > * | Clone () const |
| virtual const char * | ClassName () const |
Constructors, affectation, destructor | |
| GTreeLeafT (T &object_ref) | |
| GTreeLeafT (T *object_ptr) | |
| GTreeLeafT (const GTreeLeafT< T > &original) | |
| virtual | ~GTreeLeafT () |
Element information | |
| virtual void | SetName (const string &leaf_name) |
| virtual string | GetName () const |
| virtual string | GetInfo () const |
| virtual u_int | GetLeafCount () const |
| virtual u_int | GetLeafTotalCount () const |
| const T * | GetDataPtr () const |
| T * | GetDataPtr () |
| const T & | GetData () const |
| T & | GetData () |
| bool | IsObjectAdopted () const |
| virtual bool | IsLeaf () const |
Creation of objects structures from the tree | |
| virtual GTreeNodeT< GItem > * | CreateItemTree () const |
Print out | |
| virtual void | Print (FILE *fp=stdout, const string &prefix="", bool info=false) const |
Public Member Functions inherited from GTreeNodeT< T > | |
| template<class Q > | |
| bool | IsInstanceOf () const |
| template<class Q > | |
| bool | IsInstanceOf () |
| GTreeNodeT () | |
| GTreeNodeT (const GTreeNodeT< T > &original) | |
| virtual | ~GTreeNodeT () |
| virtual void | SetParent (GTreeBranchT< T > *parent_ptr) |
| virtual void | SetListIter (GListIterT< GTreeNodeT< T > > *iter_ptr) |
| virtual const GTreeBranchT< T > * | GetParent () const |
| virtual GTreeBranchT< T > * | GetParent () |
| virtual const GTreeNodeT< T > * | GetRoot () const |
| virtual GTreeNodeT< T > * | GetRoot () |
| virtual bool | IsBranch () const |
| void | SetUserData (void *data) |
| void * | GetUserData () const |
| virtual GListIterT< GTreeNodeT < T > > | GetListIter () const |
| virtual GTreeNodeT< T > * | NextNode () |
| virtual GTreeLeafT< T > * | FirstLeaf () |
| virtual GTreeLeafT< T > * | NextLeaf () |
| virtual GTreeNodeT< T > * | FindNode (const string &name) |
| virtual GTreeBranchT< T > * | FindBranch (const string &name) |
| virtual GTreeBranchT< T > * | AddBranch (const string &bname) |
| virtual GTreeBranchT< T > * | AddBranch (const string &parent, const string &bname) |
| virtual GTreeLeafT< T > * | AddLeaf (T &object_ref) |
| virtual GTreeLeafT< T > * | AddLeaf (const string &parent, T &object_ref) |
| virtual GTreeLeafT< T > * | AddLeaf (T *object_ptr) |
| virtual GTreeLeafT< T > * | AddLeaf (const string &parent, T *object_ptr) |
| u_int | GetLevel () const |
| virtual string | GetFullName () const |
| virtual GNamedListT< T > * | CreateList () |
| virtual GItemList * | CreateItemList () |
Public Member Functions inherited from GNamed | |
| template<class Q > | |
| bool | IsInstanceOf () const |
| template<class Q > | |
| bool | IsInstanceOf () |
| GNamed (const string &object_name="") | |
| GNamed (const GNamed &object) | |
| virtual | ~GNamed () |
| GNamed & | operator= (const GNamed &object) |
| virtual const string & | Name () const |
| virtual string & | Name () |
| int | Compare (const GNamed &object) const |
| int | CompareDict (const GNamed &object) const |
| bool | operator== (const GNamed &object) const |
| bool | operator!= (const GNamed &object) const |
| bool | operator< (const GNamed &object) const |
| bool | operator> (const GNamed &object) const |
| bool | operator<= (const GNamed &object) const |
| bool | operator>= (const GNamed &object) const |
Static Public Member Functions | |
| static const char * | StaticClassName () |
Static Public Member Functions inherited from GTreeNodeT< T > | |
| static const char * | StaticClassName () |
Static Public Member Functions inherited from GNamed | |
| static const char * | StaticClassName () |
Protected Attributes | |
| T * | data_ptr |
| Pointer to the object associated with the leaf. | |
| bool | adopted |
| Flag if data object should be deleted by the tree. | |
Protected Attributes inherited from GTreeNodeT< T > | |
| GTreeBranchT< T > * | parent |
| Parent element of the tree. | |
| GListIterT< GTreeNodeT< T > > * | list_iter |
| Pointer to the iterator in parent list. | |
| void * | user_data |
| Pointer to a additional user data. | |
Protected Attributes inherited from GNamed | |
| string | name |
| Object name. | |
A tree leaf is a final tree element (it does not contain sub-elements).
Since the template class T must inherit from the base class GNamed, the functions related to the leaf (that also inherits from GNamed class) name and information are overloaded to be redirected to the type T object.
|
inline |
Constructor with reference to object. The object is considered external, and is not managed by the tree.
| object_ref | object given by reference |
References GTreeLeafT< T >::adopted, GTreeLeafT< T >::data_ptr, and GDebugConst.
| GTreeLeafT< T >::GTreeLeafT | ( | T * | object_ptr | ) |
Constructor with object pointer. The object adopted, and will be deleted by the tree.
| object_ptr | object given by pointer |
References GTreeLeafT< T >::adopted, GTreeLeafT< T >::data_ptr, GClassError, and GDebugConst.
| GTreeLeafT< T >::GTreeLeafT | ( | const GTreeLeafT< T > & | original | ) |
Copy constructor.
| original | object to copy |
References GTreeLeafT< T >::data_ptr, GClassError, GDebugConst, GTreeLeafT< T >::GetDataPtr(), and GTreeLeafT< T >::IsObjectAdopted().
|
inlinevirtual |
Destructor: if the object was adopted, it is deleted.
References GDebugDest.
|
virtual |
Create a GItem tree leaf, with the item pointing to the original tree leaf object.
Implements GTreeNodeT< T >.
References GItem::SetInfo().
|
inline |
Return the data object (by reference) of the leaf.
|
inline |
Return the data object (by reference) of the leaf.
|
inline |
Return the pointer to the data object of the leaf.
Referenced by GTreeNodeT< T >::CreateItemList(), GTreeNodeT< T >::CreateList(), and GTreeLeafT< T >::GTreeLeafT().
|
inline |
Return the pointer to the data object of the leaf.
|
inlinevirtual |
Return the information related to the object associated to the leaf.
Reimplemented from GNamed.
|
inlinevirtual |
Return the number of leaves.
Implements GTreeNodeT< T >.
|
inlinevirtual |
Return the total number of leaves, recursively in the tree structure (trivial here: no sub-structure).
Implements GTreeNodeT< T >.
|
inlinevirtual |
Return the name of the leaf: it returns the name of the object associated to the leaf.
Reimplemented from GNamed.
Referenced by GTreeNodeT< T >::CreateItemList().
Macro from GCpp library that defines the following functions:
|
inlinevirtual |
Return true if the node is a leaf.
Reimplemented from GTreeNodeT< T >.
|
inline |
Return true if the object is adopted by the class, false if it is an external reference (and not deleted).
Referenced by GTreeLeafT< T >::GTreeLeafT().
|
virtual |
Print the list: elements are given by their name or associated information.
| fp | file pointer |
| prefix | text written before each line |
| info | if true, the information is printed instead of the name |
Implements GTreeNodeT< T >.
References GTreeNodeT< T >::GetParent().
|
inlinevirtual |
Change the name of the leaf: the function acts on the object associated to the leaf.
| leaf_name | new leaf name |
Reimplemented from GNamed.