HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_IndexMap::IndexCompare Class Referenceabstract

#include <GA_IndexMap.h>

+ Inheritance diagram for GA_IndexMap::IndexCompare:

Public Member Functions

 IndexCompare ()
 
virtual ~IndexCompare ()
 
virtual bool initialize (const GA_IndexMap &map)=0
 
virtual int compare (const GA_IndexMap &map, GA_Offset item1, GA_Offset item2)=0
 Compare two elements using strcmp() semantics. More...
 
virtual void finish (const GA_IndexMap &map)=0
 

Detailed Description

Class which compares the elements at two indices Example:

class SortReverse : public GA_IndexMap::IndexCompare
{
SortReverse() {}
~SortReverse() {}
bool initialize(const GA_IndexMap &map)
{
myOrder = new GA_Index[map.offsetSize()];
for (GA_Iterator it(GA_Range(map)); !it.atEnd();
++it)
{
myOrder[it.getOffset()] =
map.indexFromOffset(it.getOffset());
}
}
{
if (myOrder[a] > myOrder[b])
return -1;
if (myOrder[a] < myOrder[b])
return 1;
return 0;
}
void finish(const GA_IndexMap &)
{
delete [] myOrder;
}
};

Definition at line 340 of file GA_IndexMap.h.

Constructor & Destructor Documentation

GA_IndexMap::IndexCompare::IndexCompare ( )
inline

Definition at line 343 of file GA_IndexMap.h.

virtual GA_IndexMap::IndexCompare::~IndexCompare ( )
inlinevirtual

Definition at line 344 of file GA_IndexMap.h.

Member Function Documentation

virtual int GA_IndexMap::IndexCompare::compare ( const GA_IndexMap map,
GA_Offset  item1,
GA_Offset  item2 
)
pure virtual

Compare two elements using strcmp() semantics.

Implemented in GA_IndexMap::AttributeCompare.

virtual void GA_IndexMap::IndexCompare::finish ( const GA_IndexMap map)
pure virtual

Called after the sort is complete. At this point, the index will be ordered according to the sort.

Implemented in GA_IndexMap::AttributeCompare.

virtual bool GA_IndexMap::IndexCompare::initialize ( const GA_IndexMap map)
pure virtual

Called prior to the sort. If the method returns false, the sort is aborted. If the sort is aborted, the finish() method will not be called.

Implemented in GA_IndexMap::AttributeCompare.


The documentation for this class was generated from the following file: