DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
OneItemOutputIterator.h
1
16
17
#pragma once
18
30
31
#if defined(OneItemOutputIterator_RECURSES)
32
#error Recursive header files inclusion detected in OneItemOutputIterator.h
33
#else
// defined(OneItemOutputIterator_RECURSES)
35
#define OneItemOutputIterator_RECURSES
36
37
#if !defined OneItemOutputIterator_h
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
//: public std::iterator<std::output_iterator_tag,void,void,void,void>
60
{
61
62
public
:
63
using
iterator_category
= std::output_iterator_tag;
64
using
value_type
= void;
65
using
difference_type
= void;
66
using
pointer
= void;
67
using
reference
= void;
68
69
70
BOOST_CONCEPT_ASSERT
((
boost::DefaultConstructible<T>
));
71
BOOST_CONCEPT_ASSERT
((
boost::CopyConstructible<T>
));
72
BOOST_CONCEPT_ASSERT
((
boost::Assignable<T>
));
73
74
// ----------------------- Standard services ------------------------------
75
public
:
76
80
OneItemOutputIterator
():
myItemPtr
(NULL)
81
{
82
myItemPtr
=
new
T();
83
}
84
87
OneItemOutputIterator
(
const
OneItemOutputIterator
& other):
myItemPtr
(other.
myItemPtr
) {}
88
89
// ----------------------- Interface --------------------------------------
90
public
:
91
97
inline
OneItemOutputIterator
&
operator=
(
const
T& aItem)
98
{
99
ASSERT(
isValid
() );
100
*
myItemPtr
= aItem;
101
return
*
this
;
102
}
103
108
inline
OneItemOutputIterator
&
operator*
() {
return
*
this
; }
109
114
inline
OneItemOutputIterator
&
operator++
() {
return
*
this
; }
115
120
inline
OneItemOutputIterator
operator++
(
int
) {
return
*
this
; }
121
126
inline
T
get
()
const
127
{
128
ASSERT(
isValid
() );
129
return
*
myItemPtr
;
130
}
131
136
inline
bool
isValid
()
const
{
return
(
myItemPtr
!= NULL); }
137
138
// ------------------------- Private Data --------------------------------
139
private
:
141
T*
myItemPtr
;
142
143
};
// end of class OneItemOutputIterator
144
145
146
}
// namespace DGtal
147
148
150
// Includes inline functions.
151
//#include "DGtal/base/OneItemOutputIterator.ih"
152
153
// //
155
156
#endif
// !defined OneItemOutputIterator_h
157
158
#undef OneItemOutputIterator_RECURSES
159
#endif
// else defined(OneItemOutputIterator_RECURSES)
DGtal::OneItemOutputIterator::operator++
OneItemOutputIterator operator++(int)
Definition
OneItemOutputIterator.h:120
DGtal::OneItemOutputIterator::operator=
OneItemOutputIterator & operator=(const T &aItem)
Definition
OneItemOutputIterator.h:97
DGtal::OneItemOutputIterator::pointer
void pointer
Definition
OneItemOutputIterator.h:66
DGtal::OneItemOutputIterator::reference
void reference
Definition
OneItemOutputIterator.h:67
DGtal::OneItemOutputIterator::operator*
OneItemOutputIterator & operator*()
Definition
OneItemOutputIterator.h:108
DGtal::OneItemOutputIterator::OneItemOutputIterator
OneItemOutputIterator(const OneItemOutputIterator &other)
Definition
OneItemOutputIterator.h:87
DGtal::OneItemOutputIterator::difference_type
void difference_type
Definition
OneItemOutputIterator.h:65
DGtal::OneItemOutputIterator::isValid
bool isValid() const
Definition
OneItemOutputIterator.h:136
DGtal::OneItemOutputIterator::OneItemOutputIterator
OneItemOutputIterator()
Definition
OneItemOutputIterator.h:80
DGtal::OneItemOutputIterator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::DefaultConstructible< T >))
DGtal::OneItemOutputIterator::myItemPtr
T * myItemPtr
pointer that stores the last assigned item
Definition
OneItemOutputIterator.h:141
DGtal::OneItemOutputIterator::value_type
void value_type
Definition
OneItemOutputIterator.h:64
DGtal::OneItemOutputIterator::get
T get() const
Definition
OneItemOutputIterator.h:126
DGtal::OneItemOutputIterator::operator++
OneItemOutputIterator & operator++()
Definition
OneItemOutputIterator.h:114
DGtal::OneItemOutputIterator::iterator_category
std::output_iterator_tag iterator_category
Definition
OneItemOutputIterator.h:63
DGtal::OneItemOutputIterator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::CopyConstructible< T >))
DGtal::OneItemOutputIterator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::Assignable< T >))
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
boost::Assignable
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition
Boost.dox:32
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition
Boost.dox:34
boost::DefaultConstructible
Go to http://www.sgi.com/tech/stl/DefaultConstructible.html.
Definition
Boost.dox:30
src
DGtal
base
OneItemOutputIterator.h
Generated on
for DGtal by
1.18.0