DGtal 1.4.2
Loading...
Searching...
No Matches
OwningOrAliasingPtr.h
1
17#pragma once
18
31#if defined(OwningOrAliasingPtr_RECURSES)
32#error Recursive header files inclusion detected in OwningOrAliasingPtr.h
33#else // defined(OwningOrAliasingPtr_RECURSES)
35#define OwningOrAliasingPtr_RECURSES
36
37#if !defined OwningOrAliasingPtr_h
39#define OwningOrAliasingPtr_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
46
47namespace DGtal
48{
49
51 // template class OwningOrAliasingPtr
71 template <typename T>
73 {
74
76
77 // ----------------------- Inner types ------------------------------
78 public:
79 typedef T Value;
80 typedef T* Pointer;
81 typedef T& Reference;
82
83 // ----------------------- Standard services ------------------------------
84 public:
85
90 OwningOrAliasingPtr( const T& aValue );
91
98 OwningOrAliasingPtr( Pointer aPtr, bool isOwning = false );
99
105
112
117
118 // ----------------------- Interface --------------------------------------
119 public:
120
126
131 Pointer get() const;
132
138
144 bool isOwning() const;
145
150 void selfDisplay ( std::ostream & out ) const;
151
156 bool isValid() const;
157
158 // ------------------------- Protected Datas ------------------------------
159 private:
160 // ------------------------- Private Datas --------------------------------
161 private:
162
167
173
174
175 // ------------------------- Hidden services ------------------------------
176 protected:
177
178
179 private:
180
181
182 // ------------------------- Internals ------------------------------------
183 private:
184
185 }; // end of class OwningOrAliasingPtr
186
187
194 template <typename T>
195 std::ostream&
196 operator<< ( std::ostream & out, const OwningOrAliasingPtr<T> & object );
197
198} // namespace DGtal
199
200
202// Includes inline functions.
203#include "DGtal/base/OwningOrAliasingPtr.ih"
204
205// //
207
208#endif // !defined OwningOrAliasingPtr_h
209
210#undef OwningOrAliasingPtr_RECURSES
211#endif // else defined(OwningOrAliasingPtr_RECURSES)
Aim: This class describes a smart pointer that is, given the constructor called by the user,...
OwningOrAliasingPtr(Pointer aPtr, bool isOwning=false)
Pointer operator->() const
OwningOrAliasingPtr(const T &aValue)
OwningOrAliasingPtr & operator=(const OwningOrAliasingPtr &other)
BOOST_CONCEPT_ASSERT((boost::CopyConstructible< T >))
Reference operator*() const
void selfDisplay(std::ostream &out) const
OwningOrAliasingPtr(const OwningOrAliasingPtr &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition Boost.dox:34