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
OutputIteratorAdapter.h
1
17
#pragma once
18
31
#if defined(OutputIteratorAdapter_RECURSES)
32
#error Recursive header files inclusion detected in OutputIteratorAdapter.h
33
#else // defined(OutputIteratorAdapter_RECURSES)
34
35
#define OutputIteratorAdapter_RECURSES
36
37
#if !defined OutputIteratorAdapter_h
38
39
#define OutputIteratorAdapter_h
40
42
// Inclusions
43
#include "DGtal/base/Common.h"
44
#include "DGtal/base/BasicFunctors.h"
45
#include "DGtal/base/CUnaryFunctor.h"
46
#include "DGtal/base/Circulator.h"
47
48
#include <iostream>
49
51
52
namespace
DGtal
53
{
54
56
// template class OutputIteratorAdapter
73
template
<
typename
TIterator,
typename
TFunctor,
typename
TInputValue>
74
class
OutputIteratorAdapter
:
75
public
std::iterator<std::output_iterator_tag,void,void,void,void>
76
{
77
// ----------------------- Types definitions ------------------------------
78
79
public
:
80
81
typedef
TIterator
Iterator
;
82
BOOST_CONCEPT_ASSERT
(( boost::ForwardIterator<Iterator> ));
83
BOOST_CONCEPT_ASSERT
((
CUnaryFunctor
<TFunctor,
84
typename
iterator_traits<Iterator>::value_type&, TInputValue& > ));
85
86
// ----------------------- Standard services ------------------------------
87
public
:
93
OutputIteratorAdapter
(
const
Iterator
&it,
const
TFunctor &f)
94
:
myIt
(it),
myF
(&f) {}
95
100
OutputIteratorAdapter
(
const
OutputIteratorAdapter
& other )
101
:
myIt
(other.
myIt
),
myF
(other.
myF
) {}
102
106
~OutputIteratorAdapter
() {}
107
108
// ----------------------- Interface --------------------------------------
109
public
:
110
117
OutputIteratorAdapter
&
operator=
(
const
TInputValue& aValue)
118
{
119
myF
->operator()( *myIt ) = aValue;
120
return
*
this
;
121
}
122
127
OutputIteratorAdapter
&
operator*
() {
return
*
this
; }
128
133
OutputIteratorAdapter
&
operator++
() { ++
myIt
;
return
*
this
; }
134
139
OutputIteratorAdapter
operator++
(
int
)
140
{
141
OutputIteratorAdapter
tmp = *
this
;
142
++
myIt
;
143
return
tmp;
144
}
145
146
147
// ------------------------- Hidden services ------------------------------
148
protected
:
149
150
151
private
:
152
153
// ------------------------- Private Datas --------------------------------
154
private
:
158
Iterator
myIt
;
159
163
const
TFunctor*
myF
;
164
165
};
// end of class OutputIteratorAdapter
166
167
}
169
// Includes inline functions.
170
//#include "DGtal/images/OutputIteratorAdapter.ih"
171
172
//
174
175
#endif // !defined OutputIteratorAdapter_h
176
177
#undef OutputIteratorAdapter_RECURSES
178
#endif // else defined(OutputIteratorAdapter_RECURSES)
Generated on Wed Dec 19 2012 19:10:32 for DGtal by
1.8.1.1