DGtal  1.1.0
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
68  public std::iterator<std::output_iterator_tag,void,void,void,void>
69  {
70  // ----------------------- Types definitions ------------------------------
71  public:
72 
73  typedef TImage Image;
75 
76 
77  // ----------------------- Standard services ------------------------------
78  public:
84  SetValueIterator(const TIteratorOnPts& aItOnPts, Image &aImg)
85 : myImg(&aImg), myItOnPts(aItOnPts) {}
86 
93 : myImg(&aImg), myItOnPts(myImg->domain().begin()) {}
94 
100 : myImg(other.myImg), myItOnPts(other.myItOnPts) {}
101 
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 
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 
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:151
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:85
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.
Definition: ClosedIntegerHalfPlane.h:49
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:69
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