3 #include "g_cont_base_cont.h"
4 #include "private/g_cont_vect_priv.h"
14 template<
class T,
class REF,
class REF_C ,
class IT ,
class IT_C >
class vect_base :
public base_cont<T,REF,REF_C,IT,IT_C>
23 typedef REF_C RefConst_t;
25 typedef IT_C ItConst_t;
33 virtual void pushAfter (
const Ref_t& item ,
const It_t& where );
34 virtual void pushBefore (
const Ref_t& item ,
const It_t& where );
36 Ref_t& operator [] (
int i );
37 RefConst_t& operator [] (
int i )
const;
39 virtual int getLbound ( )
const {
return mContent.lbound; }
40 virtual int getUbound ( )
const {
return mContent.ubound; }
42 virtual void setEmpty ( ) { mContent.empty(); }
43 virtual void eraseMemory ( ) { mContent.erase(); }
45 virtual Ref_t
remove (
const It_t& where ) {
return mContent.remove (this->mTestIterator(where,
true)); }
47 void setSize (
int lbound ,
int ubound ) { mContent.setSize ( lbound , ubound ); }
48 void setSize (
size_t size ) { setSize ( 0 , (
int)size - 1 ); }
50 void reSize (
int lbound ,
int ubound ) { mContent.resize ( lbound , ubound ); }
51 void reSize (
size_t size ) { reSize ( 0 , (
int)size-1 ); }
53 void setCapacity (
size_t );
55 size_t getCapacity ( )
const {
return mContent.capacity; }
63 base_cont<T,REF,REF_C,IT,IT_C> ( aAllocPolicyP , &mPositioner ),
64 mContent ( aAllocPolicyP , aAllocDeltaRBits ) ,
65 mPositioner ( &mContent ) { }
67 template<
class T,
class REF,
class REF_C ,
class IT ,
class IT_C >
void vect_base<T,REF,REF_C,IT,IT_C>::setCapacity (
size_t aCapacity )
69 G_EXC_SET_CONTEXT (
"vect_base<T,REF,REF_C,IT,IT_C>::setCapacity ( size_t aCapacity )" );
71 if ( aCapacity >= this->getSize ( ) )
73 mContent.changeCapacity ( aCapacity );
77 G_EXC_RAISE_MSG ( ReducingCapacityException ,
"Capacity can't be < of the size" );
81 template<
class T,
class REF,
class REF_C ,
class IT ,
class IT_C >
typename vect_base<T,REF,REF_C,IT,IT_C>::Ref_t& vect_base<T,REF,REF_C,IT,IT_C>::operator [] (
int aI )
83 G_EXC_SET_CONTEXT (
"typename vect_base<T,REF,REF_C,IT,IT_C>::Ref_t& vect_base<T,REF,REF_C,IT,IT_C>::operator [] ( int aI )" );
85 if ( this->isAnIndex ( aI ) )
87 return *(mContent.data + aI - getLbound());
92 return *(mContent.data);
96 template<
class T,
class REF,
class REF_C ,
class IT ,
class IT_C >
typename vect_base<T,REF,REF_C,IT,IT_C>::RefConst_t& vect_base<T,REF,REF_C,IT,IT_C>::operator [] (
int aI )
const
98 G_EXC_SET_CONTEXT (
"typename vect_base<T,REF,REF_C,IT,IT_C>::RefConst_t& vect_base<T,REF,REF_C,IT,IT_C>::operator [] ( int aI ) const" );
100 if ( this->isAnIndex ( aI ) )
102 return *(mContent.data + aI - getLbound());
106 G_EXC_RAISE_MSG ( IndexOutOfBoundsException ,
"Index out of bounds!" );
110 template<
class T,
class REF,
class REF_C ,
class IT ,
class IT_C >
void vect_base<T,REF,REF_C,IT,IT_C>::pushAfter (
const Ref_t& aItem ,
const It_t& aWhere )
112 if ( this->getSize() > 0 )
114 mContent.pushAfter ( this->mTestIterator(aWhere) , aItem );
118 mContent.replaceContent ( 0 , 0 , &aItem );
122 template<
class T,
class REF,
class REF_C ,
class IT ,
class IT_C >
void vect_base<T,REF,REF_C,IT,IT_C>::pushBefore (
const Ref_t& aItem ,
const It_t& aWhere )
124 if ( this->getSize() > 0 )
126 mContent.pushAfter ( this->mTestIterator(aWhere) - 1 , aItem );
130 mContent.replaceContent ( 0 , 0 , &aItem );
Definition: g_cont_base_cont.h:19
Definition: g_cont_AllocationPolicyAbstract.h:16
#define G_EXC_DEFINE(aexctypename, abaseexctypename)
Definition: g_exception_macros.h:39
Definition: g.mthread.ThreadSimpleEvent.h:5
#define G_EXC_RAISE_MSG(aexctype, amessage)
Raises an exception specifying the message.
Definition: g_exception_macros.h:58
Definition: g_cont_vect_base.h:14
#define G_EXC_SET_CONTEXT(acontextstr)
Sets the method context.
Definition: g_exception_macros.h:52
Definition: g_cont_vect_priv.h:24
Definition: g_cont_vect_priv.h:237