Class HierarchyEntry
See Also: Class GenericHierarchy.
class HierarchyEntry
Description:
This class represents an entry in a GenericHierarchy. All methods of the class are implemented by the system.
Data Members:
public:
int data;
This is the polygon number. For example a donut shape will have polygon 0 and polygon 1. This is an index into the list of polygons for the shape.
int children;
Number of children of this entry.
HierarchyEntry *parent;
Points to the parent entry.
HierarchyEntry *sibling;
Points to the first sibling.
HierarchyEntry *child;
Points to the first child.
TSTR sortKey;
The sort key. This is used internally by the hierarchy so that it can determine whether two hierarchies are compatible. Developers shouldn't alter this value.
Methods:
Prototype:
HierarchyEntry();
Remarks:
Constructor. The entry is initialized as empty.
Prototype:
HierarchyEntry(int d, HierarchyEntry *p, HierarchyEntry *s);
Remarks:
Constructor. The entry is initialized to the data passed.
Parameters:
int d
The value for data. This is the polygon number.
HierarchyEntry *p
The parent pointer is initialized to this value.
HierarchyEntry *s
The sibling pointer is initialized to this value.
Prototype:
int HierarchyLevel();
Remarks:
Returns the level in the hierarchy this entry represents. This is the number of parents this item has. The root level is not counted.
Return Value:
The level in the hierarchy of this entry.
Prototype:
void AddChild(int d);
Remarks:
Adds a new child entry to this entry using the data specified.
Parameters:
int d
The data value of the child. This is the polygon number.
Prototype:
int GetChild(int index);
Remarks:
Returns the specified child of this entry.
Parameters:
int index
The child to retrieve.
Return Value:
The specified child of this entry. If the specified index is greater than or equal to the number of children INVALID_HIERARCHY is returned.
Prototype:
int Children()
Remarks:
Returns the number of children of this entry.
Prototype:
void Sort();
Remarks:
Sorts the hierarchy using the sortKeys.