Proud::CFastMap< K, V, KTraits, VTraits > Class Template Reference

Classes

class  const_iterator
 
class  const_reverse_iterator
 
class  CPair
 
class  iterator
 
class  reverse_iterator
 
class  value_type
 

Public Types

typedef KTraits::INARGTYPE KINARGTYPE
 
typedef KTraits::OUTARGTYPE KOUTARGTYPE
 
typedef VTraits::INARGTYPE VINARGTYPE
 
typedef VTraits::OUTARGTYPE VOUTARGTYPE
 
typedef CFastMap< K, V >
::const_iterator 
ConstIterType
 

Public Member Functions

 CFastMap (uint32_t nBins=17, float fOptimalLoad=0.75f, float fLoThreshold=0.25f, float fHiThreshold=2.25f)
 
intptr_t GetCount () const throw ()
 
intptr_t size () const
 
bool IsEmpty () const throw ()
 
bool Lookup (KINARGTYPE key, VOUTARGTYPE value) const
 
const CPairLookup (KINARGTYPE key) const throw ()
 
CPairLookup (KINARGTYPE key) throw ()
 
V & operator[] (KINARGTYPE key) throw ()
 
CNode * SetAt (KINARGTYPE key, VINARGTYPE value)
 
void SetValueAt (Proud::Position pos, VINARGTYPE value)
 
bool RemoveKey (KINARGTYPE key, bool rehashOnNeed=false) throw ()
 
 
void Clear ()
 
bool Remove (KINARGTYPE key, bool rehashOnNeed=false)
 
void RemoveAll ()
 
 
void RemoveAtPos (Proud::Position pos, bool rehashOnNeed=false) throw ()
 
Proud::Position GetStartPosition () const throw ()
 
Proud::Position GetEndPosition () const throw ()
 
void GetNextAssoc (Proud::Position &pos, KOUTARGTYPE key, VOUTARGTYPE value) const
 
const CPairGetNext (Proud::Position &pos) const throw ()
 
CPairGetNext (Proud::Position &pos) throw ()
 
CPairGetPrev (Proud::Position &pos) throw ()
 
const K & GetNextKey (Proud::Position &pos) const
 
const V & GetNextValue (Proud::Position &pos) const
 
V & GetNextValue (Proud::Position &pos)
 
void GetAt (Proud::Position pos, KOUTARGTYPE key, VOUTARGTYPE value) const
 
CPairGetPairByIndex (int index) throw ()
 
const CPairGetPairByIndex (int index) const throw ()
 
CPairGetAt (Proud::Position pos) throw ()
 
const CPairGetAt (Proud::Position pos) const throw ()
 
const K & GetKeyAt (Proud::Position pos) const
 
const V & GetValueAt (Proud::Position pos) const
 
V & GetValueAt (Proud::Position pos)
 
uint32_t GetHashTableSize () const throw ()
 
bool InitHashTable (uint32_t nBins, bool bAllocNow=true)
 
void EnableAutoRehash () throw ()
 
void DisableAutoRehash () throw ()
 
void Rehash (uint32_t nBins=0)
 
void SetOptimalLoad (float fOptimalLoad, float fLoThreshold, float fHiThreshold, bool bRehashNow=false)
 
void SetOptimalLoad_BestLookup (bool rehashNow=false)
 
intptr_t GetWorstBinItemCount ()
 
void EnableSlowConsistCheck ()
 
void KeysToArray (CFastArray< K > &output) const
 
void KeysToArray (K *outputArray, intptr_t arraySize) const
 
void ValuesToArray (CFastArray< V > &output) const
 
void AssertConsist () const
 
 CFastMap (const CFastMap &a)
 
CFastMapoperator= (const CFastMap &a)
 
bool Equals (const CFastMap &a) const
 
void CopyKeysTo (CFastArray< K > &dest)
 
bool ContainsKey (const K &key) const
 
bool ContainsValue (const V &val)
 
bool TryGetValue (KINARGTYPE key, VOUTARGTYPE value) const
 
template<typename RAWPTR >
bool TryGetRawPtrValue (KINARGTYPE key, RAWPTR &rawPtrOfValue) const
 
bool Add (KINARGTYPE key, VINARGTYPE value)
 
iterator begin ()
 
iterator end ()
 
value_type front ()
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
reverse_iterator erase (reverse_iterator iter)
 
iterator erase (iterator iter)
 
iterator find (const K &key)
 
const_iterator find (const K &key) const
 
void UseFastHeap (CFastHeap *heap)
 
CFastHeapGetRefFastHeap ()
 

Friends

class const_iterator
 
class iterator
 
class reverse_iterator
 
class const_reverse_iterator
 

Detailed Description

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
class Proud::CFastMap< K, V, KTraits, VTraits >

An hash algorithm base map class of (Key,Value) pair. Please refer Map class for further detail.

  • Has very same usage as CAtlMap while still can be used same as iterator of STL.map and some methods. Plus, can be used as same format as Dictionary class of .NET framework.
  • The iterator of this class performs much faster that the iterator of STL.map.
Parameters
Kkey type of collection
Vvalue tpe of collection
KTraitsclass that defines the characteristics that handle key type of collection
VTraitsclass that defines the characteristics that handle value type of collection

example code of traits class

class Foo
{
public:
string a;
int b;
};
class FooTraits
{
public:
// returns hash value of element
uint32_t Hash(const Foo& v)
{
// regularily, variables are XORed for hashing values.
return Hash(v.a) ^ Hash(v.b);
}
// true if two values are the same
inline static bool CompareElements(const Foo& e1, const Foo& e2)
{
return e1.a == e2.a && e1.b == e2.b;
}
// negative value if left is smaller.
// zero if the same.
// positive value if left is larger.
inline static int CompareElementsOrdered(const Foo& e1, const Foo& e2)
{
if (e1.a < e2.a)
return -1;
if (e1.a > e2.a)
return 1;
else
{
return e1.b - e2.b;
}
}
};
CFastMap<Foo, int, FooTraits> fooToIntMap;

Constructor & Destructor Documentation

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
Proud::CFastMap< K, V, KTraits, VTraits >::CFastMap ( uint32_t  nBins = 17,
float  fOptimalLoad = 0.75f,
float  fLoThreshold = 0.25f,
float  fHiThreshold = 2.25f 
)
inline

This is constructor

Parameters
nBinsThe size of base hash table. Performs ok when set with prime number. Please refer Map class for further detail.
fOptimalLoadOptimized load proportion. Please refer Load of map class for further detail.
fLoThresholdMinimum load proportion. Please refer Load of map class for further detail.
fHiThresholdMaximum load proportion. Please refer Load of map class for further detail.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
Proud::CFastMap< K, V, KTraits, VTraits >::CFastMap ( const CFastMap< K, V, KTraits, VTraits > &  a)
inline

CFastMap is an object can be copied.

Member Function Documentation

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::Add ( KINARGTYPE  key,
VINARGTYPE  value 
)
inline

Adds a new clause

Parameters
keykey of the clause to be added
valuevalue of the clause to be added
Returns
true if successfully entered, otherwise, returns false.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::AssertConsist ( ) const
inline

Must check if there exitst any cracked internal status

  • Must set this as inline though its size is big in order to make noop when function is empty. (regardless of compilers)
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
iterator Proud::CFastMap< K, V, KTraits, VTraits >::begin ( )
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const_iterator Proud::CFastMap< K, V, KTraits, VTraits >::begin ( ) const
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::Clear ( )
inline

Completely empty it

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::ContainsKey ( const K &  key) const
inline

Checks if there is key

Returns
If there is key then true
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::ContainsValue ( const V &  val)
inline

Checks if there is value

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::CopyKeysTo ( CFastArray< K > &  dest)
inline

Collects and gives key

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::DisableAutoRehash ( ) throw ()
inline

Do not rehash automatically

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::EnableAutoRehash ( ) throw ()
inline

Rehash automatically

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
iterator Proud::CFastMap< K, V, KTraits, VTraits >::end ( )
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const_iterator Proud::CFastMap< K, V, KTraits, VTraits >::end ( ) const
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::Equals ( const CFastMap< K, V, KTraits, VTraits > &  a) const
inline

CFastMap is non-array container so it shows slower comparison operation than std.map

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
reverse_iterator Proud::CFastMap< K, V, KTraits, VTraits >::erase ( reverse_iterator  iter)
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
iterator Proud::CFastMap< K, V, KTraits, VTraits >::erase ( iterator  iter)
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
iterator Proud::CFastMap< K, V, KTraits, VTraits >::find ( const K &  key)
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const_iterator Proud::CFastMap< K, V, KTraits, VTraits >::find ( const K &  key) const
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::GetAt ( Proud::Position  pos,
KOUTARGTYPE  key,
VOUTARGTYPE  value 
) const
inline

Obtain the key and value of the place where the position is pointing at.

Parameters
posPosition pointing the node
keyObtain the key of the node
valueObtain the data of the node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
CPair* Proud::CFastMap< K, V, KTraits, VTraits >::GetAt ( Proud::Position  pos) throw ()
inline

Obtain the key and value of the place where the position is pointing at

Parameters
posPosition information
Returns
CPair corresponding to the position
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const CPair* Proud::CFastMap< K, V, KTraits, VTraits >::GetAt ( Proud::Position  pos) const throw ()
inline

Obtain the key and value of the place where the position is pointing at

Parameters
posPosition information
Returns
const CPair corresponding to the position
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
Proud::Position Proud::CFastMap< K, V, KTraits, VTraits >::GetEndPosition ( ) const throw ()
inline

Gets the very last thing among possessed clauses. Mainly used for reverse_iteration. It is possible to perform iteration to next clause by using GetPrev or others.

Returns
position of the last clause
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
uint32_t Proud::CFastMap< K, V, KTraits, VTraits >::GetHashTableSize ( ) const throw ()
inline

Get the size of the hash table

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const K& Proud::CFastMap< K, V, KTraits, VTraits >::GetKeyAt ( Proud::Position  pos) const
inline

Obtain the key and value of the place where the position is pointing at

Parameters
posPosition pointing at the node
Returns
Key of the node pointed at by the position
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const CPair* Proud::CFastMap< K, V, KTraits, VTraits >::GetNext ( Proud::Position pos) const throw ()
inline

Obtain the following:

Parameters
posObtain the next position of the node being pointed at.
Returns
Return the const CPair value of the next node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
CPair* Proud::CFastMap< K, V, KTraits, VTraits >::GetNext ( Proud::Position pos) throw ()
inline

Obtain the next item.

Parameters
posObtain the next position of the node being pointed at.
Returns
Return the const CPair value of the next node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::GetNextAssoc ( Proud::Position pos,
KOUTARGTYPE  key,
VOUTARGTYPE  value 
) const
inline

Obtain the following

Parameters
[in,out]Positionvalue of the next item.
[out]Keyof the next item.
[out]Valueof the next item.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const K& Proud::CFastMap< K, V, KTraits, VTraits >::GetNextKey ( Proud::Position pos) const
inline

Obtain the next item

Parameters
posObtain the next position of the node being pointed at by this pos.
Returns
const value of the next node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const V& Proud::CFastMap< K, V, KTraits, VTraits >::GetNextValue ( Proud::Position pos) const
inline

Obtain the next item

Parameters
posObtain the next position of the node being pointed at by this pos.
Returns
const value of the next node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
V& Proud::CFastMap< K, V, KTraits, VTraits >::GetNextValue ( Proud::Position pos)
inline

Obtain the next item

Parameters
posObtain the next position of the node being pointed at by this pos.
Returns
Value of the next node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
CPair* Proud::CFastMap< K, V, KTraits, VTraits >::GetPairByIndex ( int  index) throw ()
inline

Obtain the key and value of the place located in the index

Parameters
indexMove to the next node as much as this index from the first information.
Returns
CPair of the searched node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const CPair* Proud::CFastMap< K, V, KTraits, VTraits >::GetPairByIndex ( int  index) const throw ()
inline

Obtain the key and value of the place located in the index

Parameters
indexMove to the next node as much as this index from the first information.
Returns
const CPair of the searched node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
CPair* Proud::CFastMap< K, V, KTraits, VTraits >::GetPrev ( Proud::Position pos) throw ()
inline

Obtain the previous item.

Parameters
posObtain the next position of the node being pointed at by this pos.
Returns
Key value of the next node.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
Proud::Position Proud::CFastMap< K, V, KTraits, VTraits >::GetStartPosition ( ) const throw ()
inline

Gets the foremost thing among possessed clauses. Mainly used for iteration. It is possible to perform iteration to next clause by using GetNext or others.

Returns
position of the foremost clause
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const V& Proud::CFastMap< K, V, KTraits, VTraits >::GetValueAt ( Proud::Position  pos) const
inline

Obtain the key and value of the place where the position is pointing at

Parameters
Positionpointing at the node
Returns
const data of the node pointed at by the position
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
V& Proud::CFastMap< K, V, KTraits, VTraits >::GetValueAt ( Proud::Position  pos)
inline

Obtain the key and value of the place where the position is pointing at

Parameters
posPosition pointing at the node
Returns
Data of the node pointed at by the position
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
intptr_t Proud::CFastMap< K, V, KTraits, VTraits >::GetWorstBinItemCount ( )
inline

Search each bin and return the worst bin, in other words, the number of items of the bin with the most items.

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::InitHashTable ( uint32_t  nBins,
bool  bAllocNow = true 
)
inline

Initialize the hash table.

  • It automatically calls when generating a node.
    Parameters
    nBinsHash size
    bAllocNowConfigure whether to generate hash memory
    Returns
    hash True if successful in initializing, false if failed.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::IsEmpty ( ) const throw ()
inline

Is it empty?

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::KeysToArray ( CFastArray< K > &  output) const
inline

Provide array that contain key of map objects

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::KeysToArray ( K *  outputArray,
intptr_t  arraySize 
) const
inline

Provide array that contain key of map objects

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::Lookup ( KINARGTYPE  key,
VOUTARGTYPE  value 
) const
inline

Gets value correspnds to key

Parameters
[in]keykey to find
[out]valuea space where the value corresponds to the key found to be stored
Returns
returns true if key is found.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
const CPair* Proud::CFastMap< K, V, KTraits, VTraits >::Lookup ( KINARGTYPE  key) const throw ()
inline

Finds value corrsponds to key but returns CPair object

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
CPair* Proud::CFastMap< K, V, KTraits, VTraits >::Lookup ( KINARGTYPE  key) throw ()
inline

Finds value corrsponds to key but returns CPair object.

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
CFastMap& Proud::CFastMap< K, V, KTraits, VTraits >::operator= ( const CFastMap< K, V, KTraits, VTraits > &  a)
inline

CFastMap is an object can be copied.

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
V& Proud::CFastMap< K, V, KTraits, VTraits >::operator[] ( KINARGTYPE  key) throw ()
inline

Finds value corrsponds to key. If not existed then internally creates a new entry.

Returns
returns reference of entry that is eiter alread existing or newly added
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
reverse_iterator Proud::CFastMap< K, V, KTraits, VTraits >::rbegin ( )
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::Rehash ( uint32_t  nBins = 0)
inline

Generate a hash table again

Parameters
Sizeof the hash table
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::Remove ( KINARGTYPE  key,
bool  rehashOnNeed = false 
)
inline

Finds the clause pointed by key then removes it.

Parameters
keykey to be removed
rehashOnNeedif ture then hash table is re-modified when hash table became small enough Must pay attention to the fact that if there exists either iterator and/or Position during the process, it/they will be nullified.
Returns
returns if found and removed. False if failed to find.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::RemoveAll ( )
inline

Completely empty it

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::RemoveAtPos ( Proud::Position  pos,
bool  rehashOnNeed = false 
) throw ()
inline

Removes key-value pair of where pointed by Position

Parameters
posPosition value acquired before. This value must be valid!
rehashOnNeedif ture then hash table is re-modified when hash table became small enough Must pay attention to the fact that if there exists either iterator and/or Position during the process, it/they will be nullified.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::RemoveKey ( KINARGTYPE  key,
bool  rehashOnNeed = false 
) throw ()
inline

Finds the clause pointed by key then removes it.

Parameters
keykey to be removed
rehashOnNeedif ture then hash table is re-modified when hash table became small enough Must pay attention to the fact that if there exists either iterator and/or Position during the process, it/they will be nullified.
Returns
returns if found and removed. False if failed to find.

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
reverse_iterator Proud::CFastMap< K, V, KTraits, VTraits >::rend ( )
inline

Performs a role as same name method of STL

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
CNode* Proud::CFastMap< K, V, KTraits, VTraits >::SetAt ( KINARGTYPE  key,
VINARGTYPE  value 
)
inline

Newly addes key and value pair. If already exist then overwrites.

Parameters
keykey value to be added
valuevalue object to be added
Returns
pointer that points additional location after adding. Since Position is a base class, it is possible to regards Position as return value.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::SetOptimalLoad ( float  fOptimalLoad,
float  fLoThreshold,
float  fHiThreshold,
bool  bRehashNow = false 
)
inline

Re-sets the optimal load to map. Please refer Load of map class for further detail.

Parameters
fOptimalLoadOptimal load proportion
fLoThresholdMinimum limit of load proportion
fHiThresholdMaximum limit of load proportion
bRehashNowhash table re-setting proccess runs immediately if true.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::SetOptimalLoad_BestLookup ( bool  rehashNow = false)
inline

Lookup optimum performance. Configuration to avoid rehash as much as possible but instead use a lot of memory.

Parameters
Selectwhether to rehash when configuring. If true, rehash.
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::SetValueAt ( Proud::Position  pos,
VINARGTYPE  value 
)
inline

Insert a new value of the place where the previously obtained position object points at.

Parameters
posPosition of the node to insert the value
valueData to be inserted into the node
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
intptr_t Proud::CFastMap< K, V, KTraits, VTraits >::size ( ) const
inline

Gets number of item that already owned

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
template<typename RAWPTR >
bool Proud::CFastMap< K, V, KTraits, VTraits >::TryGetRawPtrValue ( KINARGTYPE  key,
RAWPTR &  rawPtrOfValue 
) const
inline

If there exist a smart pointer value corresponds to key, returns true and pass its raw pointer through an out parameter.

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
bool Proud::CFastMap< K, V, KTraits, VTraits >::TryGetValue ( KINARGTYPE  key,
VOUTARGTYPE  value 
) const
inline

Returns true if there exist value corresponds to key

template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::UseFastHeap ( CFastHeap heap)
inline

Use CFastHeap with the internal buffer.

Parameters
CFastHeappointer
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
void Proud::CFastMap< K, V, KTraits, VTraits >::ValuesToArray ( CFastArray< V > &  output) const
inline

Provide array that contain value of map objects