![]() |
Polygon Crucher SDK - Documentation
Documentation
|
This class handles an association between a key and its associated values. More...
This class handles an association between a key and its associated values.
It must be build using an CAssociationCollector class. In then stores the association in a very compact way compare to CHashAssocMap
#include <AssociationMap.h>
Public Types | |
typedef CAssociationCollector< MAPTYPE, ASSOCTYPE, SIZETYPE > | Collector |
typedef SingleCollectorEntry< MAPTYPE, ASSOCTYPE > | CollectorEntry |
Public Member Functions | |
void | SetSize (unsigned int entries, unsigned int elementPerEntries) |
ASSOCTYPE * | Lookup (const MAPTYPE &entry, int &size) const |
Giving a key return an array with the associates data and the number of element in that array. | |
bool | IsFound (const MAPTYPE &entry) const |
Returns true if a key is found in the association map. | |
void | Remove (const MAPTYPE &entry) |
Remove a key and its association from the map. | |
bool | MoveTo (const MAPTYPE &from, const MAPTYPE &to) |
Move a from association key to a destination key and associates the from values to the destination key. | |
void | AddAssociation (const MAPTYPE &entry, const ASSOCTYPE &element) |
bool | RemoveAssociation (const MAPTYPE &refentry) |
HashPos | GetFirst () const |
ASSOCTYPE * | GetNext (HashPos &pos, MAPTYPE &entry, int &size) const |
ASSOCTYPE * | GetNext (HashPos &pos, MAPTYPE *&entry, int &size) const |
unsigned int | GetSize () const |
return the number of key values in the association map | |
bool | FreeExtra () |
void | Free () |
void | Copy (const CAssociationMap< MAPTYPE, ASSOCTYPE, SIZETYPE > &refAssociationMap) |
CAssociationMap< MAPTYPE, ASSOCTYPE, SIZETYPE, COLLTYPE > & | operator= (const CAssociationMap< MAPTYPE, ASSOCTYPE, SIZETYPE, COLLTYPE > &refAssociationMap) |
void | Convert (CAssociationCollector< MAPTYPE, ASSOCTYPE, SIZETYPE > &collector) |
Init the association map from a CAssociationCollector. | |
void | Convert (CSingleAssociationCollector< MAPTYPE, ASSOCTYPE, SIZETYPE > &collector) |
Init the association map from a CSingleAssociationCollector. | |
|
inline |
Associate an element to an entry. This method is slow, and a collector should be prefered. Beware: element might have already been associated to entry and the method does not ensure of entry/element unicity if unicity is required, and data might have duplicate, CleanDuplicates might be called
|
inline |
Move a from association key to a destination key and associates the from values to the destination key.
|
inline |
Remove an association and all its entries. This method is SLOW Do not release memory. This can be done calling FreeExtra at the end of the removal process for example