gatelib  2.1
g_cont_lst.h
1 #pragma once
2 
3 #include "g_cont_lst_base.h"
4 
5 namespace g
6 {
7 namespace cont
8 {
9 
10 template < class T , class IT = it<T> , class IT_C = it_const<T> > class lst : public lst_base<T,T,const T,IT,IT_C>
11 {
12 public:
13  template<class> friend class priv::list_positioner;
15 
16  typedef typename Base_t::It_t It_t;
17  typedef typename Base_t::ItConst_t ItConst_t;
18 
19  lst ( AllocationPolicyAbstract* = AllocationPolicyAbstract::get_FromStandardPolicy() , int = G_LST_PAGE_MASK_BITS , int = G_VECT_AL_DELTA_MASK_BITS );
20  lst ( const T* , size_t , AllocationPolicyAbstract* = AllocationPolicyAbstract::get_FromStandardPolicy() , int = G_LST_PAGE_MASK_BITS , int = G_VECT_AL_DELTA_MASK_BITS );
21  lst ( const lst& , AllocationPolicyAbstract* = AllocationPolicyAbstract::get_FromStandardPolicy() , int = G_LST_PAGE_MASK_BITS , int = G_VECT_AL_DELTA_MASK_BITS );
22 
23  virtual ~lst ( ) {}
24 
25  void setContentFromVector ( const T* , size_t );
26 
27  class Ref : public ref_custom< lst<T,IT,IT_C> >
28  {
29  public:
30  Ref(){}
31  Ref(const Ref& other ){ G_VERBOSE_MSG_L5("vect::Ref::Ref(Ref& other )"); this->mRefTake(other); }
32 
33  typedef lst<T,IT,IT_C> Lst_t;
34 
35  Lst_t& operator *() { G_VERBOSE_MSG_L5("T& vect::Ref::operator *()"); return *this->mGetObjP(); }
36  Lst_t* operator ->() { G_VERBOSE_MSG_L5("T& vect::Ref::operator ->()");return this->mGetObjP(); }
37  const Lst_t& operator *() const { G_VERBOSE_MSG_L5("const T& vect::Ref::operator *()");return *this->mGetObjP(); }
38  const Lst_t* operator ->() const { G_VERBOSE_MSG_L5("const T* vect::Ref::operator ->()");return this->mGetObjP(); }
39 
40  Ref& operator = ( const Ref& other ) { this->mRefTake(*this); return *this; }
41 
42  static Ref g_cont_new ( AllocationPolicyAbstract* aAllocPolicyP = AllocationPolicyAbstract::get_FromStandardPolicy() )
43  {
44  Ref result;
45 
46  new ( result.mAllocateMemForObject(aAllocPolicyP) )lst<T,IT,IT_C>(aAllocPolicyP);
47  result.mIncRef ( );
48 
49  return result;
50  }
51  };
52 };
53 
54 template < class T , class IT, class IT_C> lst<T,IT,IT_C>::lst ( AllocationPolicyAbstract* aAllocPolicyP , int aListPageRightBits , int aVectorAllocDeltaRightBits ) :
55  Base_t(aAllocPolicyP, aListPageRightBits , aVectorAllocDeltaRightBits ) { }
56 
57 template < class T , class IT, class IT_C> lst<T,IT,IT_C>::lst (const T* aVectorP , size_t aSize , AllocationPolicyAbstract* aAllocPolicyP , int aListPageRightBits , int aVectorAllocDeltaRightBits ) :
58  Base_t(aAllocPolicyP, aListPageRightBits , aVectorAllocDeltaRightBits )
59 {
60  this->setContentFromVector (aVectorP, aSize);
61 }
62 
63 template < class T , class IT, class IT_C> lst<T,IT,IT_C>::lst( const lst<T,IT,IT_C>& other , AllocationPolicyAbstract* aAllocPolicyP , int aListPageRightBits , int aVectorAllocDeltaRightBits ) :
64  Base_t(aAllocPolicyP, aListPageRightBits , aVectorAllocDeltaRightBits )
65 {
66  this->setContent(other);
67 }
68 
69 template < class T , class IT, class IT_C> void lst<T,IT,IT_C>::setContentFromVector ( const T* aVectorP , size_t aSize )
70 {
71  this->setEmpty ( );
72 
73  for ( size_t i = 0 ; i < aSize ; i++ )
74  {
75  this->pushTail ( aVectorP[i] );
76  }
77 }
78 
79 
80 }//namespace cont
81 }//namespace g
Definition: g_cont_ref_base.h:37
Definition: g_cont_lst_priv.h:412
Definition: g_cont_lst.h:27
Definition: g_cont_lst_base.h:12
Definition: g_cont_AllocationPolicyAbstract.h:16
Definition: g_cont_lst.h:10
Definition: g.mthread.ThreadSimpleEvent.h:5