frepple::utils::HasHierarchy< T > Class Template Reference
This is a base class for the main objects.
More...
#include <utils.h>
List of all members.
Detailed Description
template<class T>
class frepple::utils::HasHierarchy< T >
This is a base class for the main objects.
Instances of this class have the following properties:
- Unique name and global hashtable are inherited from the class HasName.
- Instances build up hierarchical trees of arbitrary depth.
- Each object can have a single parent only.
- Each object has a parent and can have children. This class thus implements the 'composite' design pattern. The internal data structure is a singly linked linear list, which is efficient provided the number of childre remains limited.
Definition at line 4018 of file utils.h.
Constructor & Destructor Documentation
The one and only constructor.
Definition at line 4077 of file utils.h.
Destructor. When deleting a node of the hierarchy, the children will get the current parent as the new parent. In this way the deletion of nodes doesn't create "dangling branches" in the hierarchy. We just "collapse" a certain level.
Definition at line 4560 of file utils.h.
Member Function Documentation
Returns the level in the hierarchy.
Level 0 means the entity doesn't have any parent.
Level 1 means the entity has a parent entity with level 0.
Level "x" means the entity has a parent entity whose level is "x-1".
Definition at line 4594 of file utils.h.
Returns the owning entity.
Definition at line 4109 of file utils.h.
Returns true if this entity belongs to a higher hierarchical level. An entity can have only a single owner, and can't belong to multiple hierarchies.
Definition at line 4096 of file utils.h.
Returns true if this entity has lower level entities belonging to it.
Definition at line 4100 of file utils.h.
Changes the owner of the entity. The argument must be a valid pointer to an entity of the same type. A NULL pointer can be passe to clear the existing owner.
Definition at line 4461 of file utils.h.
Friends And Related Function Documentation
The documentation for this class was generated from the following file: