3 #include "g_cont_gmap_common.h"
4 #include "g_cont_ref.h"
11 #define G_LOCAL_CLASS "g::cont::gmap_sorted<KEY_T>::"
19 static bool search_Value (
const Value_t& aValue , IT& aIterator )
21 for ( ; aIterator.isIn ( ) ; aIterator++ )
23 if ( aIterator->value ( ) == aValue )
35 static bool search_Key (
const Key_t& aKey , IT& aIterator , KeyComparer_t aLessComparer )
37 G_VERBOSE_MSG_L1(
"gmap_sorted:search_Key");
40 for ( ; aIterator.isIn ( ) ; aIterator++ )
42 if ( (*aLessComparer)( aIterator->key ( ) , aKey ) )
44 G_VERBOSE_MSG_L1(
"aIterator->key ( ) = " << aIterator->key ( ) <<
" is 'less' than " << aKey << endl );
50 G_VERBOSE_MSG_L1(
"aIterator->key ( ) = " << aIterator->key ( ) <<
" is not 'less' than " << aKey << endl );
52 return ( aIterator->key ( ) == aKey );
60 template <
class KEY ,
class T ,
class REF_C = const T&>
class gmap_sorted :
public gmap_common <KEY,T,map_sorted_searcher,REF_C>
65 typedef typename PairLst_t::It_t It_t;
66 typedef typename PairLst_t::ItConst_t ItConst_t;
69 typedef REF_C ConstRef_t;
76 int aListPageRightBits = G_LST_PAGE_MASK_BITS ,
77 int aVectorAllocDeltaRightBits = G_VECT_AL_DELTA_MASK_BITS ) :
78 Base_t(aAllocPolicyP,aListPageRightBits,aVectorAllocDeltaRightBits),
79 mKeyLessComparer(aKeyLessComparer) {}
82 virtual bool doAdd (
const Key_t& ,
const Value_t& );
84 virtual KeyComparer_t getComparer ( )
const {
return mKeyLessComparer; }
87 KeyComparer_t mKeyLessComparer;
90 template <
class KEY ,
class T ,
class REF=ref<T> ,
class REF_C = ref_const<T> >
class ref_gmap_sorted :
public gmap_sorted <KEY,REF,REF_C>
95 typedef typename PairLst_t::It_t It_t;
96 typedef typename PairLst_t::ItConst_t ItConst_t;
100 typedef REF_C ConstRef_t;
107 int aListPageRightBits = G_LST_PAGE_MASK_BITS ,
108 int aVectorAllocDeltaRightBits = G_VECT_AL_DELTA_MASK_BITS ) :
109 Base_t(aKeyLessComparer,aAllocPolicyP,aListPageRightBits,aVectorAllocDeltaRightBits){}
114 It_t
it = PairLst_t::getIterator ( );
118 G_VERBOSE_MSG_L1 (
"Key: " << aKey <<
" supreseeding value " << it->value ( ) );
119 it->value ( ) = aValue;
126 G_VERBOSE_MSG_L1 (
"Key: " << aKey <<
" before of " << it->key ( ) );
128 this->pushBefore ( Pair_t(aKey,aValue) , it );
132 G_VERBOSE_MSG_L1 (
"Key: " << aKey <<
" at end!" );
134 this->pushTail( Pair_t(aKey,aValue) );
Definition: g_cont_gmap_common.h:13
Definition: g_cont_AllocationPolicyAbstract.h:16
Definition: g_cont_lst.h:10
Definition: g_cont_gmap_sorted.h:90
Definition: g.mthread.ThreadSimpleEvent.h:5
Definition: g_cont_gmap_sorted.h:60
Definition: g_cont_gmap_common.h:42
Definition: g_cont_it.h:10
Definition: g_cont_gmap_common.h:21
Definition: g_cont_gmap_sorted.h:13