DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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/CountedPtr.h"
54 #include "DGtal/base/BasicFunctors.h"
55 #include "DGtal/images/DefaultConstImageRange.h"
56 #include "DGtal/images/DefaultImageRange.h"
57 #include "DGtal/images/SetValueIterator.h"
58 #include "DGtal/base/CLabel.h"
59 #include "DGtal/kernel/domains/CDomain.h"
60 
62 
63 #ifdef _MSC_VER
64 #pragma warning(disable : 4290)
65 #endif
66 
67 namespace DGtal
68 {
69 
71  // class ImageContainerBySTLMap
94  template <typename TDomain, typename TValue>
96  public std::map<typename TDomain::Point, TValue >
97  {
98 
99  public:
100 
102  typedef std::map<typename TDomain::Point, TValue > Parent;
103 
106  typedef TDomain Domain;
107  typedef typename Domain::Point Point;
108  typedef typename Domain::Vector Vector;
109  typedef typename Domain::Integer Integer;
110  typedef typename Domain::Size Size;
111  typedef typename Domain::Dimension Dimension;
112  typedef Point Vertex;
113 
115 
117  static const typename Domain::Dimension dimension = Domain::dimension;
118 
121  typedef TValue Value;
122  //obsolete:
123  //typedef ConstRangeAdapter<typename Domain::ConstIterator, Self, Value > ConstRange;
126 
129 
131  private:
132 
137 
140 
142 
143  public:
144 
152  ImageContainerBySTLMap(const Domain &aDomain, const Value& aValue = 0);
153 
160 
168 
174 
175 
177 
187  Value operator()(const Point & aPoint) const;
188 
197  void setValue(const Point &aPoint, const Value &aValue);
198 
199 
203  const Domain &domain() const;
204 
209  ConstRange constRange() const;
210 
215  Range range();
216 
221  void selfDisplay ( std::ostream & out ) const;
222 
223 
227  bool isValid() const;
228 
232  std::string className() const;
233 
234 
236  typedef typename map<Point,Value>::iterator Iterator;
237  typedef typename map<Point,Value>::const_iterator ConstIterator;
238  typedef typename map<Point,Value>::reverse_iterator ReverseIterator;
239  typedef typename map<Point,Value>::const_reverse_iterator ConstReverseIterator;
240 
250 
251 
252  };
253 
260  template <typename TDomain, typename TValue>
261  inline
262  std::ostream&
263  operator<< ( std::ostream & out, const ImageContainerBySTLMap<TDomain,TValue> & object )
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)