gatelib  2.1
g_cont_it_ref.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 ref;
11 template < class T > class ref_const;
12 template < class T > class ref_const;
13 template < class T > class base;
14 template < class T , class REF , class REF_C > class it_ref;
15 
16 template < class T , class REF = ref<T> , class REF_C = ref_const<T> > class it_ref_const : public it_base<REF,REF,REF_C>
17 {
18 public:
19  it_ref_const(){}
20 
21  typedef typename it_base<REF,REF,REF_C>::RecipientBase_t RecipientBase_t;
22  typedef REF Ref_t;
23  typedef REF_C RefConst_t;
24  typedef it_ref<T,REF,REF_C> It_t;
25 
26  it_ref_const (const RecipientBase_t& aRecipient , IterFrom_t from = head ) { this->mInit ( aRecipient , from ); }
27  it_ref_const (const it_ref_const& other) { this->mCopy(other); }
28  it_ref_const (const It_t& other) { this->mCopy(other); }
29 
30  it_ref_const& operator = (const it_ref_const& other ){mCopy(other);return *this;}
31 
32  it_ref_const operator + (int inc) { it_ref_const result(*this); result.moveOf(inc); return result; }
33  it_ref_const operator - (int dec) { it_ref_const result(*this); result.moveOf(-dec); return result; }
34  it_ref_const& operator ++ ( int ){ this->moveOf(1); return*this; }//preincrementum
35  it_ref_const& operator -- ( int ){ this->moveOf(1); return*this; }//predecrementum
36  it_ref_const& operator ++ ( ){ this->moveOf(1); return*this; }//postincrementum
37  it_ref_const& operator -- ( ){ this->moveOf(1); return*this; }//postdecrementum
38  it_ref_const& operator += ( int inc ){ this->moveOf(inc); return*this; }
39  it_ref_const& operator -= ( int dec ){ this->moveOf(-dec); return*this; }
40 
41  Ref_t& underlying ( ) { return *this->mRecipientP->mPositionerP->getPtr ( this->mIndex ); }
42  RefConst_t underlying ( ) const { return RefConst_t(*this->mRecipientP->mPositionerP->getPtr ( this->mIndex )); }
43 
44  operator RefConst_t ( ) const { return this->underlying(); }
45 
46  const T* operator -> ( ) const { return this->underlying().operator ->(); }
47  const T& operator * ( ) const { return this->underlying().operator * (); }
48 };
49 
50 template < class T , class REF = ref<T> , class REF_C = ref_const<T> > class it_ref : public it_base<REF,REF,REF_C>
51 {
52 public:
53  typedef typename it_base<REF,REF,REF_C>::RecipientBase_t RecipientBase_t;
54  typedef REF Ref_t;
55  typedef REF_C RefConst_t;
56 
57  it_ref(){}
58  it_ref (RecipientBase_t& aRecipient , IterFrom_t from = head ) { this->mInit ( aRecipient , from ); }
59  it_ref (const it_ref& other){ this->mCopy(other); }
60 
61  it_ref& operator = (const it_ref& aOther){ this->mCopy(aOther); return *this;}
62 
63  it_ref operator + (int inc) { it_ref result(*this); result.moveOf(inc); return result; }
64  it_ref operator - (int dec) { it_ref result(*this); result.moveOf(-dec); return result; }
65  it_ref& operator ++ ( int ){ this->moveOf(1); return*this; }//preincrementum
66  it_ref& operator -- ( int ){ this->moveOf(1); return*this; }//predecrementum
67  it_ref& operator ++ ( ){ this->moveOf(1); return*this; }//postincrementum
68  it_ref& operator -- ( ){ this->moveOf(1); return*this; }//postdecrementum
69  it_ref& operator += ( int inc ){ this->moveOf(inc); return*this; }
70  it_ref& operator -= ( int dec ){ this->moveOf(-dec); return*this; }
71 
72  Ref_t& underlying ( ) { return *this->mRecipientP->mPositionerP->getPtr ( this->mIndex ); }
73  RefConst_t underlying ( ) const { return RefConst_t(*this->mRecipientP->mPositionerP->getPtr ( this->mIndex )); }
74 
75  operator Ref_t& ( ) { return this->underlying (); }
76  operator const Ref_t& ( ) const { return this->underlying (); }
77 
78  const T* operator -> ( ) const { return this->underlying().operator ->(); }
79  const T& operator * ( ) const { return this->underlying().operator * (); }
80 
81  T* operator -> ( ) { return this->underlying().operator ->(); }
82  T& operator * ( ) { return this->underlying().operator * (); }
83 };
84 
85 }//namespace cont
86 }//namespace g
87 
88 
Definition: g_cont_it_ref.h:16
Definition: g.mthread.ThreadSimpleEvent.h:5
Definition: g_cont_it_ref.h:11
Definition: g_cont_it_ref.h:14
Definition: g_cont_it_ref.h:13
Definition: g_cont_base_cont.h:13
Definition: g_cont_it_ref.h:10