DGtal  1.1.0
DigitalSetFromMap.h
1 
17 #pragma once
18 
31 #if defined(DigitalSetFromMap_RECURSES)
32 #error Recursive header files inclusion detected in DigitalSetFromMap.h
33 #else // defined(DigitalSetFromMap_RECURSES)
34 
35 #define DigitalSetFromMap_RECURSES
36 
37 #if !defined DigitalSetFromMap_h
38 
39 #define DigitalSetFromMap_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <map>
45 #include <string>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/base/CowPtr.h"
48 
49 #include "DGtal/base/BasicFunctors.h"
50 #include "DGtal/base/IteratorAdapter.h"
51 #include "DGtal/base/ConstIteratorAdapter.h"
52 
54 
55 
56 namespace DGtal
57 {
58 
60  // template class DigitalSetFromMap
73  template <typename TMapImage>
75  {
76  public:
77 
78  typedef TMapImage Image;
79  typedef std::pair<const typename Image::Point,
80  typename Image::Value> Pair;
82 
83  // -------------------------- required types ------------------------------
84  typedef typename Image::Domain Domain;
85  typedef typename Domain::Point Point;
86  typedef typename Domain::Size Size;
87 
91 
92  // ------------------------- Protected Datas ------------------------------
93  protected:
94 
99 
104 
109 
110  // ----------------------- Standard services ------------------------------
111  public:
112 
117 
127  const typename Image::Value& aDefaultValue = 0);
128 
134 
141 
142 
143  // ----------------------- Standard Set services --------------------------
144  public:
145 
149  const Domain & domain() const;
150 
155 
159  Size size() const;
160 
164  bool empty() const;
165 
172  void insert( const Point & p );
173 
182  template <typename PointInputIterator>
183  void insert( PointInputIterator first, PointInputIterator last );
184 
194  void insertNew( const Point & p );
195 
206  template <typename PointInputIterator>
207  void insertNew( PointInputIterator first, PointInputIterator last );
208 
215  Size erase( const Point & p );
216 
223  void erase( Iterator it );
224 
232  void erase( Iterator first, Iterator last );
233 
238  void clear();
239 
244  ConstIterator find( const Point & p ) const;
245 
250  Iterator find( const Point & p );
251 
256 
261 
266 
271 
277  template< typename TDigitalSet >
278  Self & operator+=
279  ( const TDigitalSet & aSet );
280 
281  // ----------------------- Model of concepts::CPointPredicate -----------------------------
282  public:
283 
288  bool operator()( const Point & p ) const;
289 
290  // ----------------------- Other Set services -----------------------------
291  public:
292 
299  template< typename TOutputIterator >
300  void computeComplement(TOutputIterator& ito) const;
301 
309  template< typename TDigitalSet >
310  void assignFromComplement( const TDigitalSet & otherSet );
311 
321 
322 
323  // ----------------------- Interface --------------------------------------
324  public:
325 
330  void selfDisplay ( std::ostream & out ) const;
331 
336  bool isValid() const;
337 
338 
339  public:
340 
341 
342 
343  // --------------- CDrawableWithBoard2D realization ---------------------
344  public:
345 
349  std::string className() const;
350 
351 
352  // ------------------------- Hidden services ------------------------------
353  protected:
354 
360 
361  private:
362 
363 
364  // ------------------------- Internals ------------------------------------
365  private:
366 
367 
368  }; // end of class DigitalSetFromMap
369 
370 
377  template <typename TMapImage>
378  std::ostream&
379  operator<< ( std::ostream & out, const DigitalSetFromMap<TMapImage> & object );
380 
381 } // namespace DGtal
382 
383 
385 // Includes inline functions.
386 #include "DGtal/kernel/sets/DigitalSetFromMap.ih"
387 
388 // //
390 
391 #endif // !defined DigitalSetFromMap_h
392 
393 #undef DigitalSetFromMap_RECURSES
394 #endif // else defined(DigitalSetFromMap_RECURSES)
DGtal::functors::Pair1st< Point >
DGtal::DigitalSetFromMap::erase
Size erase(const Point &p)
DGtal::DigitalSetFromMap::className
std::string className() const
DGtal::ImageContainerBySTLVector< Domain, Value >::Domain
Domain Domain
Definition: ImageContainerBySTLVector.h:135
DGtal::ImageContainerBySTLVector::Value
TValue Value
Definition: ImageContainerBySTLVector.h:151
DGtal::DigitalSetFromMap::Iterator
ConstIteratorAdapter< typename Image::ConstIterator, Functor, Point > Iterator
Definition: DigitalSetFromMap.h:90
lower
Vector lower(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:190
DGtal::DigitalSetFromMap::myImgPtr
Image * myImgPtr
Definition: DigitalSetFromMap.h:98
DGtal::DigitalSetFromMap::empty
bool empty() const
DGtal::DigitalSetFromMap::erase
void erase(Iterator it)
DGtal::DigitalSetFromMap::insert
void insert(const Point &p)
DGtal::DigitalSetFromMap::Point
Domain::Point Point
Definition: DigitalSetFromMap.h:85
DGtal::HyperRectDomain< Space >::Size
Space::Size Size
Definition: HyperRectDomain.h:117
DGtal::DigitalSetFromMap::find
ConstIterator find(const Point &p) const
DGtal::DigitalSetFromMap::myFun
Functor myFun
Definition: DigitalSetFromMap.h:103
DGtal::DigitalSetFromMap::~DigitalSetFromMap
~DigitalSetFromMap()
DGtal::DigitalSetFromMap::isValid
bool isValid() const
DGtal::DigitalSetFromMap::Pair
std::pair< const typename Image::Point, typename Image::Value > Pair
Definition: DigitalSetFromMap.h:80
DGtal::DigitalSetFromMap::size
Size size() const
DGtal::DigitalSetFromMap::computeBoundingBox
void computeBoundingBox(Point &lower, Point &upper) const
DGtal::DigitalSetFromMap::Domain
Image::Domain Domain
Definition: DigitalSetFromMap.h:84
DGtal::DigitalSetFromMap::DigitalSetFromMap
DigitalSetFromMap(const DigitalSetFromMap &other)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::DigitalSetFromMap::operator()
bool operator()(const Point &p) const
DGtal::DigitalSetFromMap::insert
void insert(PointInputIterator first, PointInputIterator last)
DGtal::DigitalSetFromMap::find
Iterator find(const Point &p)
DGtal::DigitalSetFromMap::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::DigitalSetFromMap::insertNew
void insertNew(const Point &p)
DGtal::DigitalSetFromMap::erase
void erase(Iterator first, Iterator last)
DGtal::DigitalSetFromMap
Aim: An adapter for viewing an associative image container like ImageContainerBySTLMap as a simple di...
Definition: DigitalSetFromMap.h:75
DGtal::DigitalSetFromMap::domain
const Domain & domain() const
DGtal::DigitalSetFromMap::clear
void clear()
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::DigitalSetFromMap::operator=
DigitalSetFromMap & operator=(const DigitalSetFromMap &other)
DGtal::DigitalSetFromMap::Image
TMapImage Image
Definition: DigitalSetFromMap.h:78
DGtal::DigitalSetFromMap::ConstIterator
ConstIteratorAdapter< typename Image::ConstIterator, Functor, Point > ConstIterator
Definition: DigitalSetFromMap.h:89
DGtal::DigitalSetFromMap::Self
DigitalSetFromMap< Image > Self
Definition: DigitalSetFromMap.h:81
upper
Vector upper(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:197
DGtal::PointVector< dim, Integer >
DGtal::DigitalSetFromMap::myDefault
Image::Value myDefault
Definition: DigitalSetFromMap.h:108
DGtal::DigitalSetFromMap::DigitalSetFromMap
DigitalSetFromMap(Image &aImage, const typename Image::Value &aDefaultValue=0)
DGtal::DigitalSetFromMap::domainPointer
CowPtr< Domain > domainPointer() const
DGtal::DigitalSetFromMap::DigitalSetFromMap
DigitalSetFromMap()
DGtal::DigitalSetFromMap::insertNew
void insertNew(PointInputIterator first, PointInputIterator last)
DGtal::DigitalSetFromMap::end
Iterator end()
DGtal::DigitalSetFromMap::Size
Domain::Size Size
Definition: DigitalSetFromMap.h:86
DGtal::DigitalSetFromMap::assignFromComplement
void assignFromComplement(const TDigitalSet &otherSet)
DGtal::DigitalSetFromMap::Functor
functors::Pair1st< Point > Functor
Definition: DigitalSetFromMap.h:88
DGtal::Image::Point
TImageContainer::Point Point
Definition: Image.h:83
DGtal::DigitalSetFromMap::begin
ConstIterator begin() const
DGtal::DigitalSetFromMap::computeComplement
void computeComplement(TOutputIterator &ito) const
DGtal::ConstIteratorAdapter
This class adapts any iterator so that operator* returns another element than the one pointed to by t...
Definition: ConstIteratorAdapter.h:88
DGtal::DigitalSetFromMap::end
ConstIterator end() const
DGtal::DigitalSetFromMap::begin
Iterator begin()
DGtal::CowPtr< Domain >