DGtal
1.1.0
src
DGtal
base
OneItemOutputIterator.h
1
17
#pragma once
18
31
#if defined(OneItemOutputIterator_RECURSES)
32
#error Recursive header files inclusion detected in OneItemOutputIterator.h
33
#else // defined(OneItemOutputIterator_RECURSES)
34
35
#define OneItemOutputIterator_RECURSES
36
37
#if !defined OneItemOutputIterator_h
38
39
#define OneItemOutputIterator_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
46
47
namespace
DGtal
48
{
49
51
// template class OneItemOutputIterator
58
template
<
typename
T>
59
class
OneItemOutputIterator
:
60
public
std::iterator<std::output_iterator_tag,void,void,void,void>
61
{
62
63
BOOST_CONCEPT_ASSERT
((
boost::DefaultConstructible<T>
));
64
BOOST_CONCEPT_ASSERT
((
boost::CopyConstructible<T>
));
65
BOOST_CONCEPT_ASSERT
((
boost::Assignable<T>
));
66
67
// ----------------------- Standard services ------------------------------
68
public
:
69
73
OneItemOutputIterator
():
myItemPtr
(NULL)
74
{
75
myItemPtr
=
new
T();
76
}
80
OneItemOutputIterator
(
const
OneItemOutputIterator
& other):
myItemPtr
(other.
myItemPtr
) {}
81
82
// ----------------------- Interface --------------------------------------
83
public
:
84
90
inline
OneItemOutputIterator
&
operator=
(
const
T& aItem)
91
{
92
ASSERT(
isValid
() );
93
*
myItemPtr
= aItem;
94
return
*
this
;
95
}
96
101
inline
OneItemOutputIterator
&
operator*
() {
return
*
this
; }
102
107
inline
OneItemOutputIterator
&
operator++
() {
return
*
this
; }
108
113
inline
OneItemOutputIterator
operator++
(
int
) {
return
*
this
; }
114
119
inline
T
get
()
const
120
{
121
ASSERT(
isValid
() );
122
return
*
myItemPtr
;
123
}
124
129
inline
bool
isValid
()
const
{
return
(
myItemPtr
!= NULL); }
130
131
// ------------------------- Private Datas --------------------------------
132
private
:
134
T*
myItemPtr
;
135
136
};
// end of class OneItemOutputIterator
137
138
139
}
// namespace DGtal
140
141
143
// Includes inline functions.
144
//#include "DGtal/base/OneItemOutputIterator.ih"
145
146
// //
148
149
#endif // !defined OneItemOutputIterator_h
150
151
#undef OneItemOutputIterator_RECURSES
152
#endif // else defined(OneItemOutputIterator_RECURSES)
boost::DefaultConstructible
Go to http://www.sgi.com/tech/stl/DefaultConstructible.html.
Definition:
Boost.dox:30
DGtal::OneItemOutputIterator::operator++
OneItemOutputIterator & operator++()
Definition:
OneItemOutputIterator.h:107
DGtal::OneItemOutputIterator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::CopyConstructible< T >))
DGtal::OneItemOutputIterator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::Assignable< T >))
DGtal::OneItemOutputIterator::OneItemOutputIterator
OneItemOutputIterator(const OneItemOutputIterator &other)
Definition:
OneItemOutputIterator.h:80
DGtal::OneItemOutputIterator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::DefaultConstructible< T >))
DGtal::OneItemOutputIterator::OneItemOutputIterator
OneItemOutputIterator()
Definition:
OneItemOutputIterator.h:73
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition:
ClosedIntegerHalfPlane.h:49
DGtal::OneItemOutputIterator::operator=
OneItemOutputIterator & operator=(const T &aItem)
Definition:
OneItemOutputIterator.h:90
DGtal::OneItemOutputIterator::get
T get() const
Definition:
OneItemOutputIterator.h:119
DGtal::OneItemOutputIterator::operator*
OneItemOutputIterator & operator*()
Definition:
OneItemOutputIterator.h:101
DGtal::OneItemOutputIterator::operator++
OneItemOutputIterator operator++(int)
Definition:
OneItemOutputIterator.h:113
DGtal::OneItemOutputIterator
Aim: model of output iterator, ie incrementable and writable iterator, which only stores in a variabl...
Definition:
OneItemOutputIterator.h:61
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition:
Boost.dox:34
DGtal::OneItemOutputIterator::myItemPtr
T * myItemPtr
pointer that stores the last assigned item
Definition:
OneItemOutputIterator.h:134
DGtal::OneItemOutputIterator::isValid
bool isValid() const
Definition:
OneItemOutputIterator.h:129
boost::Assignable
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition:
Boost.dox:32
Generated on Fri Oct 9 2020 08:58:05 for DGtal by
1.8.20