gatelib  2.1
g_cont_it.h
1 #pragma once
2 
3 #include "g_cont_it_base.h"
4 
5 namespace g
6 {
7 namespace cont
8 {
9 
10 template < class T > class it : public it_base<T,T,const T>
11 {
12 public:
13  typedef typename it_base<T,T,const T>::RecipientBase_t RecipientBase_t;
14 
15  it(){}
16  it (RecipientBase_t& aRecipient , IterFrom_t aIterDir = head ) { this->mInit ( aRecipient , aIterDir ); }
17  it (const it& other){ this->mCopy(other); }
18  it& operator = (const it& aOther){ this->mCopy(aOther);return *this;}
19 
20  it operator + (int inc) { it result(*this); result.moveOf(inc); return result; }
21  it operator - (int dec) { it result(*this); result.moveOf(-dec); return result; }
22  it& operator ++ ( int ){ this->moveOf(1); return*this; }//preincrementum
23  it& operator -- ( int ){ this->moveOf(1); return*this; }//predecrementum
24  it& operator ++ ( ){ this->moveOf(1); return*this; }//postincrementum
25  it& operator -- ( ){ this->moveOf(1); return*this; }//postdecrementum
26  it& operator += ( int inc ){ this->moveOf(inc); return*this; }
27  it& operator -= ( int dec ){ this->moveOf(-dec); return*this; }
28 
29  T& underlying ( ) { return *this->mRecipientP->mPositionerP->getPtr ( this->mIndex ); }
30  const T& underlying ( ) const { return *this->mRecipientP->mPositionerP->getPtr ( this->mIndex ); }
31 
32  const T* operator -> ( ) const { return &underlying(); }
33  const T& operator * ( ) const { return underlying(); }
34 
35  T* operator -> ( ) { return &underlying(); }
36  T& operator * ( ) { return underlying(); }
37 };
38 
39 template < class T > class it_const : public it_base<T,T,const T>
40 {
41 public:
42  typedef typename it_base<T,T,const T>::RecipientBase_t RecipientBase_t;
43 
44  it_const (){}
45  it_const ( const RecipientBase_t& aRecipient , IterFrom_t aIterFrom = head ) { this->mInit ( aRecipient , aIterFrom ); }
46  it_const ( const it_const& other ) { this->mCopy(other); }
47  it_const ( const it<T>& other ) { this->mCopy(other); }
48 
49  it_const& operator = ( const it_const& other ) { this->mCopy(other); return *this; }
50 
51  it_const operator + (int inc) { it_const result(*this); result.moveOf(inc); return result; }
52  it_const operator - (int dec) { it_const result(*this); result.moveOf(-dec); return result; }
53  it_const& operator ++ ( int ){ this->moveOf(1); return*this; }//preincrementum
54  it_const& operator -- ( int ){ this->moveOf(1); return*this; }//predecrementum
55  it_const& operator ++ ( ){ this->moveOf(1); return*this; }//postincrementum
56  it_const& operator -- ( ){ this->moveOf(1); return*this; }//postdecrementum
57  it_const& operator += ( int inc ){ this->moveOf(inc); return*this; }
58  it_const& operator -= ( int dec ){ this->moveOf(-dec); return*this; }
59 
60  const T& underlying ( ) const { return *this->mRecipientP->mPositionerP->getPtr ( this->mIndex ); }
61 
62  const T* operator -> ( ) const { return &underlying(); }
63  const T& operator * ( ) const { return underlying(); }
64 };
65 
66 }//namespace cont
67 }//namespace g
68 
Definition: g.mthread.ThreadSimpleEvent.h:5
Definition: g_cont_it.h:39
Definition: g_cont_base_cont.h:13
Definition: g_cont_it.h:10