GenericHierarchy Class Reference

GenericHierarchy Class Reference

#include <genhier.h>

Class Description

See also
Class HierarchyEntry.

Description:
This is a utility class for describing hierarchies of shapes. All methods of this class are implemented by the system.

This is used in generating mesh objects from shapes. In order for a mesh object to be generated correctly, nested shapes must be oriented clockwise or counter-clockwise depending on their level of nesting. For example, a donut shape with two circular curves will have the outer shape going counter-clockwise and the inner shape going clockwise. If a third shape was nested inside both of these, its points would be going counter-clockwise.
+ Inheritance diagram for GenericHierarchy:

Public Member Functions

 GenericHierarchy ()
 
UtilExport ~GenericHierarchy ()
 
UtilExport void AddEntry (int data, int parent=-1)
 
UtilExport int Entries ()
 
UtilExport HierarchyEntryGetStart ()
 
UtilExport HierarchyEntryFindEntry (int data, HierarchyEntry *start=NULL)
 
UtilExport int NumberOfChildren (int data)
 
UtilExport int GetChild (int data, int index)
 
UtilExport void New ()
 
UtilExport void Sort ()
 
UtilExport BOOL IsCompatible (GenericHierarchy &hier)
 
UtilExport void Dump (HierarchyEntry *start=NULL)
 
UtilExport GenericHierarchyoperator= (GenericHierarchy &from)
 
UtilExport MSTRSortKey ()
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

GenericHierarchy ( )
inline
Remarks
Constructor. The hierarchy is set as initially empty.
104 { root = HierarchyEntry(-1,NULL,NULL); isSorted = FALSE; }
#define NULL
Definition: autoptr.h:18
Definition: genhier.h:41

Member Function Documentation

UtilExport void AddEntry ( int  data,
int  parent = -1 
)
Remarks
This method adds one entry given its parent.
Parameters:
int data

The polygon index of the entry to add.

int parent = -1

The index of the parent of the entry.
UtilExport int Entries ( )
Remarks
Returns the total number of members in the hierarchy.
UtilExport HierarchyEntry* GetStart ( )
inline
Remarks
Retrieves the first item under the root.
Returns
The first HierarchyEntry under the root.
117 { return root.child; } // Get the first item under the root
HierarchyEntry * child
Definition: genhier.h:47
UtilExport HierarchyEntry* FindEntry ( int  data,
HierarchyEntry start = NULL 
)
Remarks
Finds the specified entry in the hierarchy.
Parameters:
int data

The polygon index of the entry to find.

HierarchyEntry* start = NULL

The entry at which to begin the search. If NULL is specified the search starts at the root.
Returns
A pointer to the HierarchyEntry of the found entry. If not found, NULL is returned.
UtilExport int NumberOfChildren ( int  data)
Remarks
Returns the number of children for this item.
Parameters:
int data

The index of the polygon to return the number of children of.
UtilExport int GetChild ( int  data,
int  index 
)
Remarks
Returns the specified child of the specified entry.
Parameters:
int data

The index of the polygon whose child is to be returned.

int index

Specifies which child to return.
Returns
The specified child of the entry.
UtilExport void New ( )
Remarks
Clear out the hierarchy tree.
UtilExport void Sort ( )
Remarks
Sorts the hierarchy tree by children / siblings. This is used internally as all the sorting is done automatically as the hierarchy is generated.
UtilExport BOOL IsCompatible ( GenericHierarchy hier)
Remarks
Determines if this hierarchy and the specified hierarchy are compatible.
Parameters:
GenericHierarchy& hier

The hierarchy to check for compatibility.
Returns
TRUE if the hierarchies are compatible; otherwise FALSE.
UtilExport void Dump ( HierarchyEntry start = NULL)
Remarks
This method is used internally to DebugPrint() the tree. See Troubleshooting.
Remarks
Copy operator.
Parameters:
GenericHierarchy& from

The hierarchy to copy from.
UtilExport MSTR& SortKey ( )
Remarks
Returns the sort key for the hierarchy. This is used internally.
Operators: