DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
src
DGtal
base
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>
72
class
OwningOrAliasingPtr
73
{
74
75
BOOST_CONCEPT_ASSERT
(( boost::CopyConstructible<T> ));
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
104
OwningOrAliasingPtr
(
const
OwningOrAliasingPtr
& other );
105
111
OwningOrAliasingPtr
&
operator=
(
const
OwningOrAliasingPtr
& other );
112
116
~OwningOrAliasingPtr
();
117
118
// ----------------------- Interface --------------------------------------
119
public
:
120
125
Pointer
operator->
()
const
;
126
131
Pointer
get
()
const
;
132
137
Reference
operator*
()
const
;
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
166
Pointer
myPtr
;
167
172
bool
myFlagIsOwning
;
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)
Generated on Wed Dec 19 2012 19:10:32 for DGtal by
1.8.1.1