DGtal
1.3.beta
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
((
concepts::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)
DGtal::SetValueIterator::operator=
SetValueIterator & operator=(const typename Image::Value &aValue)
Definition:
SetValueIterator.h:115
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition:
greedy-plane-segmentation-ex2.cpp:93
DGtal::ImageContainerBySTLVector< Domain, Value >::Value
Value Value
Definition:
ImageContainerBySTLVector.h:153
DGtal::SetValueIterator::operator++
SetValueIterator & operator++()
Definition:
SetValueIterator.h:131
DGtal::SetValueIterator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CTrivialImage< Image >))
DGtal::concepts::CTrivialImage
Aim: Defines the concept describing an image without extra ranges, which is a refinement of CTrivialC...
Definition:
CTrivialImage.h:84
DGtal::SetValueIterator::operator*
SetValueIterator & operator*()
Definition:
SetValueIterator.h:125
DGtal::SetValueIterator::operator++
SetValueIterator operator++(int)
Definition:
SetValueIterator.h:137
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::SetValueIterator::SetValueIterator
SetValueIterator(const TIteratorOnPts &aItOnPts, Image &aImg)
Definition:
SetValueIterator.h:84
DGtal::SetValueIterator
Aim: implements an output iterator, which is able to write values in an underlying image,...
Definition:
SetValueIterator.h:67
DGtal::SetValueIterator::Image
TImage Image
Definition:
SetValueIterator.h:73
DGtal::SetValueIterator::myImg
Image * myImg
Definition:
SetValueIterator.h:161
DGtal::SetValueIterator::SetValueIterator
SetValueIterator(const SetValueIterator &other)
Definition:
SetValueIterator.h:99
domain
Domain domain
Definition:
testProjection.cpp:88
DGtal::SetValueIterator::myItOnPts
TIteratorOnPts myItOnPts
Definition:
SetValueIterator.h:166
DGtal::SetValueIterator::SetValueIterator
SetValueIterator(Image &aImg)
Definition:
SetValueIterator.h:92
DGtal::SetValueIterator::~SetValueIterator
~SetValueIterator()
Definition:
SetValueIterator.h:105
Generated on Mon Jun 20 2022 18:23:57 for DGtal by
1.8.17