Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
CAssociationMap< MAPTYPE, ASSOCTYPE, SIZETYPE, COLLTYPE > Class Template Reference

This class handles an association between a key and its associated values. More...

Detailed Description

template<class MAPTYPE, class ASSOCTYPE, class SIZETYPE, template< typename T1, typename T2 > class COLLTYPE>
class CAssociationMap< MAPTYPE, ASSOCTYPE, SIZETYPE, COLLTYPE >

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, SIZETYPECollector
 
typedef SingleCollectorEntry< MAPTYPE, ASSOCTYPECollectorEntry
 

Public Member Functions

void SetSize (unsigned int entries, unsigned int elementPerEntries)
 
ASSOCTYPELookup (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
 
ASSOCTYPEGetNext (HashPos &pos, MAPTYPE &entry, int &size) const
 
ASSOCTYPEGetNext (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.
 

Member Function Documentation

◆ AddAssociation()

void CAssociationMap< MAPTYPE, ASSOCTYPE, SIZETYPE, COLLTYPE >::AddAssociation ( const MAPTYPE entry,
const ASSOCTYPE element 
)
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

◆ MoveTo()

Move a from association key to a destination key and associates the from values to the destination key.

Note
Destination association are lost and replaced by from association values

◆ RemoveAssociation()

bool CAssociationMap< MAPTYPE, ASSOCTYPE, SIZETYPE, COLLTYPE >::RemoveAssociation ( const MAPTYPE refentry)
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


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