DGtal  1.3.beta
DigitalSetByAssociativeContainer.h
1 
17 #pragma once
18 
39 #if defined(DigitalSetByAssociativeContainer_RECURSES)
40 #error Recursive header files inclusion detected in DigitalSetByAssociativeContainer.h
41 #else // defined(DigitalSetByAssociativeContainer_RECURSES)
42 
43 #define DigitalSetByAssociativeContainer_RECURSES
44 
45 #if !defined DigitalSetByAssociativeContainer_h
46 
47 #define DigitalSetByAssociativeContainer_h
48 
50 // Inclusions
51 #include <iostream>
52 #include <set>
53 #include <string>
54 #include "DGtal/base/Common.h"
55 #include "DGtal/base/CowPtr.h"
56 #include "DGtal/base/Clone.h"
57 #include "DGtal/base/Alias.h"
58 #include "DGtal/base/ConstAlias.h"
59 #include "DGtal/kernel/domains/CDomain.h"
60 #include "DGtal/base/CSTLAssociativeContainer.h"
62 
63 //#include "DGtal/io/Display3D.h"
64 
65 
66 namespace DGtal
67 {
68 
70  // template class DigitalSetByAssociativeContainer
88  template <typename TDomain, typename TContainer >
90  {
91  public:
92 
94  typedef TDomain Domain;
95 
97  typedef TContainer Container;
98 
102  typedef typename Domain::Space Space;
104  typedef typename Domain::Point Point;
106  typedef typename Container::iterator Iterator;
108  typedef typename Container::const_iterator ConstIterator;
110  typedef typename Container::value_type value_type;
112  typedef typename Container::size_type Size;
113 
117  BOOST_STATIC_ASSERT(( boost::is_same<typename Container::key_type, Point>::value ));
118 
119  // ----------------------- Standard services ------------------------------
120  public:
121 
126 
134 
140 
147 
151  const Domain & domain() const;
152 
157 
158  // ----------------------- Standard Set services --------------------------
162  Size size() const;
163 
167  bool empty() const;
168 
175  void insert( const Point & p );
176 
185  template <typename PointInputIterator>
186  void insert( PointInputIterator first, PointInputIterator last );
187 
197  void insertNew( const Point & p );
198 
209  template <typename PointInputIterator>
210  void insertNew( PointInputIterator first, PointInputIterator last );
211 
218  Size erase( const Point & p );
219 
226  void erase( Iterator it );
227 
235  void erase( Iterator first, Iterator last );
236 
241  void clear();
242 
246  ConstIterator find( const Point & p ) const;
247 
252  Iterator find( const Point & p );
253 
257  ConstIterator begin() const;
258 
262  ConstIterator end() const;
263 
267  Iterator begin();
268 
272  Iterator end();
273 
278  const Container & container() const;
283  Container & container();
284 
291 
292  // ----------------------- Model of concepts::CPointPredicate -----------------------------
293  public:
294 
299  bool operator()( const Point & p ) const;
300 
301  // ----------------------- Other Set services -----------------------------
302 
308  template< typename TOutputIterator >
309  void computeComplement(TOutputIterator& ito) const;
310 
318 
327  void computeBoundingBox( Point & lower, Point & upper ) const;
328 
329 
330  // ----------------------- Interface --------------------------------------
331 
336  void selfDisplay ( std::ostream & out ) const;
337 
342  bool isValid() const;
343 
344  // ------------------------- Protected Datas ------------------------------
345  protected:
346 
352 
357 
358  // --------------- CDrawableWithBoard2D realization ---------------------
359  public:
360 
364  std::string className() const;
365 
366 
367  // ------------------------- Hidden services ------------------------------
368  protected:
369 
375 
376  }; // end of class DigitalSetByAssociativeContainer
377 
378 
385  template <typename Domain, typename Container>
386  std::ostream&
387  operator<< ( std::ostream & out, const DigitalSetByAssociativeContainer<Domain, Container> & object );
388 
389 } // namespace DGtal
390 
391 
393 // Includes inline functions.
394 #include "DGtal/kernel/sets/DigitalSetByAssociativeContainer.ih"
395 
396 // //
398 
399 #endif // !defined DigitalSetByAssociativeContainer_h
400 
401 #undef DigitalSetByAssociativeContainer_RECURSES
402 #endif // else defined(DigitalSetByAssociativeContainer_RECURSES)
DGtal::Clone
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:266
DGtal::DigitalSetByAssociativeContainer::Self
DigitalSetByAssociativeContainer< Domain, Container > Self
Self Type.
Definition: DigitalSetByAssociativeContainer.h:100
DGtal::DigitalSetByAssociativeContainer::Space
Domain::Space Space
Type of digital space.
Definition: DigitalSetByAssociativeContainer.h:102
DGtal::DigitalSetByAssociativeContainer::operator=
DigitalSetByAssociativeContainer & operator=(const DigitalSetByAssociativeContainer &other)
DGtal::HyperRectDomain< Space >::Space
Space Space
Definition: HyperRectDomain.h:110
DGtal::DigitalSetByAssociativeContainer::Domain
TDomain Domain
Domain type.
Definition: DigitalSetByAssociativeContainer.h:94
DGtal::DigitalSetByAssociativeContainer::empty
bool empty() const
DGtal::HyperRectDomain< Space >
DGtal::DigitalSetByAssociativeContainer::begin
ConstIterator begin() const
lower
Vector lower(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:190
DGtal::DigitalSetByAssociativeContainer::computeComplement
void computeComplement(TOutputIterator &ito) const
DGtal::DigitalSetByAssociativeContainer::className
std::string className() const
DGtal::DigitalSetByAssociativeContainer::Container
TContainer Container
Container type.
Definition: DigitalSetByAssociativeContainer.h:97
DGtal::DigitalSetByAssociativeContainer::operator()
bool operator()(const Point &p) const
DGtal::DigitalSetByAssociativeContainer::find
ConstIterator find(const Point &p) const
DGtal::DigitalSetByAssociativeContainer::isValid
bool isValid() const
DGtal::DigitalSetByAssociativeContainer::insertNew
void insertNew(const Point &p)
DGtal::DigitalSetByAssociativeContainer::myDomain
CowPtr< Domain > myDomain
Definition: DigitalSetByAssociativeContainer.h:351
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::DigitalSetByAssociativeContainer::DigitalSetByAssociativeContainer
DigitalSetByAssociativeContainer()
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:129
DGtal::DigitalSetByAssociativeContainer::Point
Domain::Point Point
Type of points in the space.
Definition: DigitalSetByAssociativeContainer.h:104
DGtal::DigitalSetByAssociativeContainer::computeBoundingBox
void computeBoundingBox(Point &lower, Point &upper) const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::DigitalSetByAssociativeContainer::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< typename Container::key_type, Point >::value))
DGtal::DigitalSetByAssociativeContainer::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::DigitalSetByAssociativeContainer::insert
void insert(const Point &p)
DGtal::concepts::CSTLAssociativeContainer
Aim: Defines the concept describing an Associative Container of the STL (https://www....
Definition: CSTLAssociativeContainer.h:102
DGtal::DigitalSetByAssociativeContainer::domainPointer
CowPtr< Domain > domainPointer() const
DGtal::DigitalSetByAssociativeContainer::end
ConstIterator end() const
DGtal::DigitalSetByAssociativeContainer::erase
Size erase(const Point &p)
upper
Vector upper(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:197
DGtal::DigitalSetByAssociativeContainer::value_type
Container::value_type value_type
Value type of the container.
Definition: DigitalSetByAssociativeContainer.h:110
DGtal::DigitalSetByAssociativeContainer::container
const Container & container() const
DGtal::PointVector< dim, Integer >
DGtal::DigitalSetByAssociativeContainer::assignFromComplement
void assignFromComplement(const DigitalSetByAssociativeContainer< Domain, Container > &other_set)
DGtal::DigitalSetByAssociativeContainer::domain
const Domain & domain() const
DGtal::DigitalSetByAssociativeContainer::Iterator
Container::iterator Iterator
Iterator type of the container.
Definition: DigitalSetByAssociativeContainer.h:106
DGtal::DigitalSetByAssociativeContainer::mySet
Container mySet
Definition: DigitalSetByAssociativeContainer.h:356
DGtal::DigitalSetByAssociativeContainer::ConstIterator
Container::const_iterator ConstIterator
ConstIterator type of the container;.
Definition: DigitalSetByAssociativeContainer.h:108
DGtal::DigitalSetByAssociativeContainer::clear
void clear()
DGtal::DigitalSetByAssociativeContainer::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
Concept checks.
DGtal::DigitalSetByAssociativeContainer::Size
Container::size_type Size
Size type of the container;.
Definition: DigitalSetByAssociativeContainer.h:112
DGtal::DigitalSetByAssociativeContainer::~DigitalSetByAssociativeContainer
~DigitalSetByAssociativeContainer()
DGtal::DigitalSetByAssociativeContainer::size
Size size() const
DGtal::DigitalSetByAssociativeContainer
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Definition: DigitalSetByAssociativeContainer.h:89
DGtal::CowPtr< Domain >