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
images
SetValueIterator.h
1
17
#pragma once
18
31
#if defined(SetValueIterator_RECURSES)
32
#error Recursive header files inclusion detected in SetValueIterator.h
33
#else // defined(SetValueIterator_RECURSES)
34
35
#define SetValueIterator_RECURSES
36
37
#if !defined SetValueIterator_h
38
39
#define SetValueIterator_h
40
42
// Inclusions
43
#include "DGtal/base/Common.h"
44
#include "DGtal/kernel/domains/CDomain.h"
45
#include "DGtal/images/CTrivialImage.h"
46
47
#include <iostream>
48
50
51
namespace
DGtal
52
{
53
55
// template class SetValueIterator
65
template
<
typename
TImage,
typename
TIteratorOnPts
66
=
typename
TImage::Domain::ConstIterator>
67
class
SetValueIterator
:
68
public
std::iterator<std::output_iterator_tag,void,void,void,void>
69
{
70
// ----------------------- Types definitions ------------------------------
71
public
:
72
73
typedef
TImage
Image
;
74
BOOST_CONCEPT_ASSERT
((
CTrivialImage<Image>
));
75
76
77
// ----------------------- Standard services ------------------------------
78
public
:
84
SetValueIterator
(
const
TIteratorOnPts& aItOnPts,
Image
&aImg)
85
:
myImg
(&aImg),
myItOnPts
(aItOnPts) {}
86
92
SetValueIterator
(
Image
&aImg)
93
:
myImg
(&aImg),
myItOnPts
(
myImg
->domain().begin()) {}
94
99
SetValueIterator
(
const
SetValueIterator
& other )
100
:
myImg
(other.
myImg
),
myItOnPts
(other.
myItOnPts
) {}
101
105
~SetValueIterator
() {}
106
107
// ----------------------- Interface --------------------------------------
108
public
:
109
115
SetValueIterator
&
operator=
(
const
typename
Image::Value
& aValue)
116
{
117
myImg
->setValue( *
myItOnPts
, aValue );
118
return
*
this
;
119
}
120
125
SetValueIterator
&
operator*
() {
return
*
this
; }
126
131
SetValueIterator
&
operator++
() { ++
myItOnPts
;
return
*
this
; }
132
137
SetValueIterator
operator++
(
int
)
138
{
139
SetValueIterator
tmp = *
this
;
140
++
myItOnPts
;
141
return
tmp;
142
}
143
144
145
// ------------------------- Private Datas --------------------------------
146
private
:
147
148
// ------------------------- Hidden services ------------------------------
149
protected
:
150
151
152
private
:
153
154
155
// ------------------------- Internals ------------------------------------
156
private
:
157
161
Image
*
myImg
;
162
166
TIteratorOnPts
myItOnPts
;
167
168
};
// end of class SetValueIterator
169
170
}
172
// Includes inline functions.
173
//#include "DGtal/images/SetValueIterator.ih"
174
175
//
177
178
#endif // !defined SetValueIterator_h
179
180
#undef SetValueIterator_RECURSES
181
#endif // else defined(SetValueIterator_RECURSES)
Generated on Wed Dec 19 2012 19:10:34 for DGtal by
1.8.1.1