DGtal  1.1.0
ImageContainerBySTLMap.h
1 
17 #pragma once
18 
37 #if defined(ImageContainerBySTLMap_RECURSES)
38 #error Recursive header files inclusion detected in ImageContainerBySTLMap.h
39 #else // defined(ImageContainerBySTLMap_RECURSES)
40 
41 #define ImageContainerBySTLMap_RECURSES
42 
43 #if !defined ImageContainerBySTLMap_h
44 
45 #define ImageContainerBySTLMap_h
46 
48 // Inclusions
49 #include <iostream>
50 #include <map>
51 
52 #include "DGtal/base/Common.h"
53 #include "DGtal/base/BasicFunctors.h"
54 #include "DGtal/base/CowPtr.h"
55 #include "DGtal/base/Clone.h"
56 #include "DGtal/images/DefaultConstImageRange.h"
57 #include "DGtal/images/DefaultImageRange.h"
58 #include "DGtal/images/SetValueIterator.h"
59 #include "DGtal/base/CLabel.h"
60 #include "DGtal/kernel/domains/CDomain.h"
61 
63 
64 #ifdef _MSC_VER
65 #pragma warning(disable : 4290)
66 #endif
67 
68 namespace DGtal
69 {
70 
72  // class ImageContainerBySTLMap
95  template <typename TDomain, typename TValue>
97  public std::map<typename TDomain::Point, TValue >
98  {
99 
100  public:
101 
103  typedef std::map<typename TDomain::Point, TValue > Parent;
104 
107  typedef TDomain Domain;
108  typedef typename Domain::Point Point;
109  typedef typename Domain::Vector Vector;
110  typedef typename Domain::Integer Integer;
111  typedef typename Domain::Size Size;
112  typedef typename Domain::Dimension Dimension;
113  typedef Point Vertex;
114 
115  // Pointer to the (const) Domain given at construction.
117 
119  static const typename Domain::Dimension dimension;
120 
123  typedef TValue Value;
126 
129 
131  private:
132 
137 
140 
142 
143  public:
144 
154  ImageContainerBySTLMap( Clone<const Domain> aDomain, const Value& aValue = 0);
155 
162 
170 
176 
177 
179 
189  Value operator()(const Point & aPoint) const;
190 
199  void setValue(const Point &aPoint, const Value &aValue);
200 
201 
205  const Domain &domain() const;
206 
212 
218 
223  void selfDisplay ( std::ostream & out ) const;
224 
225 
229  bool isValid() const;
230 
234  std::string className() const;
235 
236 
238  typedef typename std::map<Point,Value>::iterator Iterator;
239  typedef typename std::map<Point,Value>::const_iterator ConstIterator;
240  typedef typename std::map<Point,Value>::reverse_iterator ReverseIterator;
241  typedef typename std::map<Point,Value>::const_reverse_iterator ConstReverseIterator;
242 
249 
250 
251  };
252 
259  template <typename TDomain, typename TValue>
260  inline
261  std::ostream&
262  operator<< ( std::ostream & out,
264  {
265  object.selfDisplay ( out );
266  return out;
267  }
268 
269 
270 } // namespace DGtal
271 
272 
274 // Includes inline functions
275 #include "DGtal/images/ImageContainerBySTLMap.ih"
276 // //
278 
279 #endif // !defined ImageContainerBySTLMap_h
280 
281 #undef ImageContainerBySTLMap_RECURSES
282 #endif // else defined(ImageContainerBySTLMap_RECURSES)
DGtal::ImageContainerBySTLMap::ImageContainerBySTLMap
ImageContainerBySTLMap(const ImageContainerBySTLMap &other)
DGtal::Clone
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:267
DGtal::ImageContainerBySTLMap::~ImageContainerBySTLMap
~ImageContainerBySTLMap()
DGtal::HyperRectDomain::Dimension
Space::Dimension Dimension
Definition: HyperRectDomain.h:116
DGtal::ImageContainerBySTLMap::ImageContainerBySTLMap
ImageContainerBySTLMap(Clone< const Domain > aDomain, const Value &aValue=0)
DGtal::ImageContainerBySTLMap::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CLabel< TValue >))
range of values
DGtal::ImageContainerBySTLMap::DomainPtr
CowPtr< const Domain > DomainPtr
Definition: ImageContainerBySTLMap.h:116
DGtal::ImageContainerBySTLMap::setValue
void setValue(const Point &aPoint, const Value &aValue)
DGtal::ImageContainerBySTLMap::ReverseIterator
std::map< Point, Value >::reverse_iterator ReverseIterator
Definition: ImageContainerBySTLMap.h:240
DGtal::ImageContainerBySTLMap::OutputIterator
SetValueIterator< Self > OutputIterator
output iterator
Definition: ImageContainerBySTLMap.h:128
DGtal::ImageContainerBySTLMap::Value
TValue Value
Definition: ImageContainerBySTLMap.h:123
DGtal::ImageContainerBySTLMap::Domain
TDomain Domain
Definition: ImageContainerBySTLMap.h:107
aPoint
const Point aPoint(3, 4)
DGtal::ImageContainerBySTLMap::range
Range range()
DGtal::ImageContainerBySTLMap::Vector
Domain::Vector Vector
Definition: ImageContainerBySTLMap.h:109
DGtal::ImageContainerBySTLMap::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::ImageContainerBySTLMap::Range
DefaultImageRange< Self > Range
Definition: ImageContainerBySTLMap.h:125
DGtal::ImageContainerBySTLMap::operator=
ImageContainerBySTLMap & operator=(const ImageContainerBySTLMap &other)
DGtal::ImageContainerBySTLMap::constRange
ConstRange constRange() const
DGtal::ImageContainerBySTLMap
Definition: ImageContainerBySTLMap.h:98
DGtal::ImageContainerBySTLMap::Size
Domain::Size Size
Definition: ImageContainerBySTLMap.h:111
DGtal::HyperRectDomain< Space >::Size
Space::Size Size
Definition: HyperRectDomain.h:117
DGtal::ImageContainerBySTLMap::myDomainPtr
DomainPtr myDomainPtr
Definition: ImageContainerBySTLMap.h:136
DGtal::DefaultConstImageRange
Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterat...
Definition: DefaultConstImageRange.h:77
DGtal::DefaultImageRange
Aim: model of CConstBidirectionalRangeFromPoint and CBidirectionalRangeWithWritableIteratorFromPoint ...
Definition: DefaultImageRange.h:77
DGtal::concepts::CDomain
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:130
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::ImageContainerBySTLMap::ConstReverseIterator
std::map< Point, Value >::const_reverse_iterator ConstReverseIterator
Definition: ImageContainerBySTLMap.h:241
DGtal::SetValueIterator
Aim: implements an output iterator, which is able to write values in an underlying image,...
Definition: SetValueIterator.h:69
DGtal::ImageContainerBySTLMap::dimension
static const Domain::Dimension dimension
static constants
Definition: ImageContainerBySTLMap.h:119
DGtal::ImageContainerBySTLMap::myDefaultValue
Value myDefaultValue
Default value.
Definition: ImageContainerBySTLMap.h:139
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::ImageContainerBySTLMap::outputIterator
OutputIterator outputIterator()
DGtal::ImageContainerBySTLMap::Vertex
Point Vertex
Definition: ImageContainerBySTLMap.h:113
DGtal::concepts::CLabel
Aim: Define the concept of DGtal labels. Models of CLabel can be default-constructible,...
Definition: CLabel.h:93
DGtal::ImageContainerBySTLMap::Point
Domain::Point Point
Definition: ImageContainerBySTLMap.h:108
DGtal::ImageContainerBySTLMap::operator()
Value operator()(const Point &aPoint) const
DGtal::ImageContainerBySTLMap::Dimension
Domain::Dimension Dimension
Definition: ImageContainerBySTLMap.h:112
DGtal::ImageContainerBySTLMap::Parent
std::map< typename TDomain::Point, TValue > Parent
Definition: ImageContainerBySTLMap.h:103
DGtal::ImageContainerBySTLMap::className
std::string className() const
DGtal::HyperRectDomain< Space >::Integer
Space::Integer Integer
Definition: HyperRectDomain.h:114
DGtal::PointVector< dim, Integer >
DGtal::ImageContainerBySTLMap::ConstIterator
std::map< Point, Value >::const_iterator ConstIterator
Definition: ImageContainerBySTLMap.h:239
DGtal::ImageContainerBySTLMap::ConstRange
DefaultConstImageRange< Self > ConstRange
Definition: ImageContainerBySTLMap.h:124
DGtal::ImageContainerBySTLMap::isValid
bool isValid() const
DGtal::ImageContainerBySTLMap::Integer
Domain::Integer Integer
Definition: ImageContainerBySTLMap.h:110
DGtal::ImageContainerBySTLMap::Self
ImageContainerBySTLMap< TDomain, TValue > Self
Definition: ImageContainerBySTLMap.h:102
DGtal::ImageContainerBySTLMap::Iterator
std::map< Point, Value >::iterator Iterator
built-in iterators
Definition: ImageContainerBySTLMap.h:238
DGtal::ImageContainerBySTLMap::domain
const Domain & domain() const
DGtal::ImageContainerBySTLMap::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
domain
DGtal::CowPtr< const Domain >