|
| 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 CPair * | Lookup (KINARGTYPE key) const throw () |
|
CPair * | Lookup (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 CPair * | GetNext (Proud::Position &pos) const throw () |
|
CPair * | GetNext (Proud::Position &pos) throw () |
|
CPair * | GetPrev (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 |
|
CPair * | GetPairByIndex (int index) throw () |
|
const CPair * | GetPairByIndex (int index) const throw () |
|
CPair * | GetAt (Proud::Position pos) throw () |
|
const CPair * | GetAt (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 | ValuesToArray (CFastArray< V > &output) const |
|
void | AssertConsist () const |
|
| CFastMap (const CFastMap &a) |
|
CFastMap & | operator= (const CFastMap &a) |
|
bool | Equals (const CFastMap &a) const |
|
void | CopyKeysTo (CFastArray< K > &dest) |
|
bool | ContainsKey (const K &key) |
|
bool | ContainsValue (const V &val) |
|
bool | TryGetValue (KINARGTYPE key, VOUTARGTYPE value) |
|
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) |
|
CFastHeap * | GetRefFastHeap () |
|
template<typename K, typename V, typename KTraits = CPNElementTraits< K >, typename VTraits = CPNElementTraits< V >>
class Proud::CFastMap< K, V, KTraits, VTraits >
(Key,Value) pair의 hash 알고리즘 기반 map class입니다. 상세한 내용은 맵 클래스 에 있습니다.
- CAtlMap과 사용법이 동일합니다. 그러면서도 STL.map의 iterator 및 일부 메서드와 동일하게 사용할 수 있습니다. 게다가 .Net framework의 Dictionary class와 같은 형식으로도 쓸 수 있습니다.
- 이 클래스의 iterator는 STL.map의 iterator보다 성능이 훨씬 빠른 성능을 냅니다.
- 매개변수
-
K | 콜렉션의 키 타입 |
V | 콜렉션의 값 타입 |
KTraits | 콜렉션의 키 타입을 다루는 특성을 정의한 클래스 |
VTraits | 콜렉션의 값 타입을 다루는 특성을 정의한 클래스 |
AllocT | AllocType 값 중 하나 |
example code of traits class
class Foo
{
public:
string a;
int b;
};
class FooTraits
{
public:
uint32_t Hash(const Foo& v)
{
return Hash(v.a) ^ Hash(v.b);
}
inline static bool CompareElements(const Foo& e1, const Foo& e2)
{
return e1.a == e2.a && e1.b == e2.b;
}
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;
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 최적 성능, 웬만해서는 rehash를 최대한 안하고, 그 대신 메모리를 많이 사용하는 설정. 증감폭이 워낙 큰데다 rehash cost가 큰 경우에 유용하다.
- 매개변수
-
rehashNow | 설정하면서 Rehash를 할것인지를 선택한다. true이면 Rehash를 함 |