IMS2
Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
|
The SimpleTreeNode is just what it says on the tin... a very simple node to form a tree structure. More...
Public Member Functions | |
SimpleTreeNode (int _id, SimpleTreeNode *_parent) | |
Constructs a node with an id and inserts it into a tree. More... | |
~SimpleTreeNode () | |
Recursively deletes the entire tree when called on the root. More... | |
SimpleTreeNode * | GetParent () |
int | GetId () |
Private Member Functions | |
void | addChild (SimpleTreeNode *child) |
Adds a child to this node. Done automatically when a childnode is created. More... | |
Private Attributes | |
vector< SimpleTreeNode * > | children |
Stores all children of this node. | |
SimpleTreeNode * | parent = NULL |
Stores the parent of this node. | |
int | id |
Stores the id of this node. | |
The SimpleTreeNode is just what it says on the tin... a very simple node to form a tree structure.
It is used by the breadth-first algorithm to put its results in a nice tree structure where the shortest path can be traced back without effort. Note that this structures single purpose is to PRESERVE order and connection of elements among each other. It makes for a lousy search and sorting structure, and therefore has no functions to facilitate these things. Use a map if you need a search tree.
|
inline |
Constructs a node with an id and inserts it into a tree.
The node's id and position in the tree are fixed and can never change!
_id | The id for the node. Must be unique in the entire tree |
_parent | The parent node this node should be inserted after. |
|
inline |
Recursively deletes the entire tree when called on the root.
will trigger an assert if NOT called on the root!
|
inlineprivate |
Adds a child to this node. Done automatically when a childnode is created.
child | The node to add as a child |
|
inline |
|
inline |