System documentation of the GNU Image-Finding Tool

CArraySelfDestroyPointer.h
1 #ifndef _CARRAYSELFDESTROYPOINTER
2 #define _CARRAYSELFDESTROYPOINTER
3 /*
4 #include "libMRML/include/uses-declarations.h"
5 
6  destroys the element it points to
7 */
8 
9 template<class T>
12  mutable bool mIsSelfDestroyer;
14  protected:
15  T* mPointer;
17 public:
19  void resetWithoutDeleting();
21  inline bool isSelfDestroyer()const;
23  inline void setIsSelfDestroyer(bool inisSelfDestroyer=true)const;
25  void unsetIsSelfDestroyer()const;
27  T* operator= (T* inPointer);
29  T& operator*();
31  T const& operator*()const;
33  T* operator -> ();
35  T const* operator -> ()const;
40  bool = true);
43  inSelfDestroyPointer);
47  operator bool()const;
49  operator T*()const;
50 };
51 
52 
54 template<class T>
56  mPointer=0;
57 }
58 
59 template<class T>
61 
62  if(mIsSelfDestroyer){
63  delete[] mPointer;
64  }
65  return mPointer=inPointer;
66 }
67 
68 template<class T>
70  return *mPointer;
71 }
72 
73 template<class T>
75  return mPointer;
76 }
77 
78 template<class T>
80  return *mPointer;
81 }
82 
83 template<class T>
85  return mPointer;
86 }
87 
88 template<class T>
90  bool inIsSelfDestroyer):
91  mPointer(inPointer),
92  mIsSelfDestroyer(inIsSelfDestroyer)
93 {
94 }
96 template<class T>
98  mPointer(in.mPointer),
99  mIsSelfDestroyer(in.mIsSelfDestroyer)
100 {
101 };
102 
103 template<class T>
105  mPointer(0),
106  mIsSelfDestroyer(true)
107 {
108 }
109 
110 template<class T>
112 {
113  if(mIsSelfDestroyer){
114 
115  delete[] mPointer;
116  }
117 }
118 
119 
120 template<class T>
121 void CArraySelfDestroyPointer<T>::setIsSelfDestroyer(bool inIsSelfDestroyer)const{
122  mIsSelfDestroyer= inIsSelfDestroyer;
123 };
124 
125 template<class T>
127  return mIsSelfDestroyer;
128 };
129 
130 template<class T>
132  mIsSelfDestroyer=0;
133 };
134 
135 template<class T>
137  return mPointer;
138 };
139 
140 template<class T>
142  return mPointer;
143 };
144 #endif

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen