gatelib  2.1
g_cont_lst_base.h
1 #pragma once
2 
3 #include "g_cont_base_cont.h"
4 #include "g_cont_ref_custom.h"
5 #include "private/g_cont_lst_priv.h"
6 
7 namespace g
8 {
9 namespace cont
10 {
11 
12 template<class T, class REF, class REF_C , class IT , class IT_C > class lst_base : public base_cont<T,REF,REF_C,IT,IT_C>
13 {
14 public:
15  typedef REF Ref_t;
16  typedef REF_C RefConst_t;
17  typedef IT It_t;
18  typedef IT_C ItConst_t;
19 
20  template <typename> friend class priv::list_positioner;
21 
22 protected:
23  lst_base ( AllocationPolicyAbstract* , int aListPageRightBits , int aVectorAllocDeltaRightBits );
24 
25 public:
26  virtual ~lst_base ( ) {}
27 
28  virtual void pushAfter ( const Ref_t& item , const It_t& where ) { mContent.pushNewNodeAfter ( item , this->mTestIterator(where) ); }
29  virtual void pushBefore ( const Ref_t& item , const It_t& where ) { mContent.pushNewNodeBefore ( item , this->mTestIterator(where) ); }
30  virtual void setEmpty ( ) { mContent.empty(); }
31  virtual void eraseMemory ( ) { mContent.erase(); }
32 
33  Ref_t& operator [] ( int i ) { return *this->mSequentialGet (i); }
34  RefConst_t& operator [] ( int i ) const { return *this->mSequentialGet (i); }
35 
36  virtual int getLbound ( ) const { return 0; }
37  virtual int getUbound ( ) const { return (int)mContent.size - 1; }
38 
39  virtual Ref_t remove ( const It_t& where ) { return mContent.remove ( this->mTestIterator(where,true) ); }
40 
41 protected:
42  priv::list_content<REF> mContent;
43  priv::list_positioner<REF> mPositioner;
44 };
45 
46 template<class T, class REF, class REF_C , class IT , class IT_C > lst_base<T,REF,REF_C,IT,IT_C>::lst_base (
47  AllocationPolicyAbstract* aAllocPolicyP ,
48  int aListPageRightBits ,
49  int aVectorDeltaRoghtBits ) :
50  base_cont<T,REF,REF_C,IT,IT_C> ( aAllocPolicyP , &mPositioner ),
51  mContent(aAllocPolicyP,aListPageRightBits,aVectorDeltaRoghtBits) ,
52  mPositioner(&mContent){}
53 
54 }//namespace cont
55 }//namespace g
56 
Definition: g_cont_base_cont.h:19
Definition: g_cont_lst_priv.h:412
Definition: g_cont_lst_base.h:12
Definition: g_cont_AllocationPolicyAbstract.h:16
Definition: g.mthread.ThreadSimpleEvent.h:5