DGtal  1.1.0
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)
34 
35 #define OwningOrAliasingPtr_RECURSES
36 
37 #if !defined OwningOrAliasingPtr_h
38 
39 #define OwningOrAliasingPtr_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
46 
47 namespace 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)
DGtal::OwningOrAliasingPtr::operator=
OwningOrAliasingPtr & operator=(const OwningOrAliasingPtr &other)
DGtal::OwningOrAliasingPtr
Aim: This class describes a smart pointer that is, given the constructor called by the user,...
Definition: OwningOrAliasingPtr.h:73
DGtal::OwningOrAliasingPtr::myPtr
Pointer myPtr
Definition: OwningOrAliasingPtr.h:166
DGtal::OwningOrAliasingPtr::OwningOrAliasingPtr
OwningOrAliasingPtr(Pointer aPtr, bool isOwning=false)
DGtal::OwningOrAliasingPtr::myFlagIsOwning
bool myFlagIsOwning
Definition: OwningOrAliasingPtr.h:172
DGtal::OwningOrAliasingPtr::OwningOrAliasingPtr
OwningOrAliasingPtr(const T &aValue)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::OwningOrAliasingPtr::operator->
Pointer operator->() const
DGtal::OwningOrAliasingPtr::Reference
T & Reference
Definition: OwningOrAliasingPtr.h:81
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition: Boost.dox:34
DGtal::OwningOrAliasingPtr::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::CopyConstructible< T >))
DGtal::OwningOrAliasingPtr::get
Pointer get() const
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::OwningOrAliasingPtr::~OwningOrAliasingPtr
~OwningOrAliasingPtr()
DGtal::OwningOrAliasingPtr::Pointer
T * Pointer
Definition: OwningOrAliasingPtr.h:80
DGtal::OwningOrAliasingPtr::isOwning
bool isOwning() const
DGtal::OwningOrAliasingPtr::Value
T Value
Definition: OwningOrAliasingPtr.h:79
DGtal::OwningOrAliasingPtr::isValid
bool isValid() const
DGtal::OwningOrAliasingPtr::OwningOrAliasingPtr
OwningOrAliasingPtr(const OwningOrAliasingPtr &other)
DGtal::OwningOrAliasingPtr::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::OwningOrAliasingPtr::operator*
Reference operator*() const