DGtal  1.3.beta
DigitalSetBySTLSet.h
1 
17 #pragma once
18 
35 #if defined(DigitalSetBySTLSet_RECURSES)
36 #error Recursive header files inclusion detected in DigitalSetBySTLSet.h
37 #else // defined(DigitalSetBySTLSet_RECURSES)
38 
39 #define DigitalSetBySTLSet_RECURSES
40 
41 #if !defined DigitalSetBySTLSet_h
42 
43 #define DigitalSetBySTLSet_h
44 
46 // Inclusions
47 #include <iostream>
48 #include <set>
49 #include <string>
50 #include "DGtal/base/Common.h"
51 #include "DGtal/base/CowPtr.h"
52 #include "DGtal/base/Clone.h"
53 #include "DGtal/base/Alias.h"
54 #include "DGtal/base/ConstAlias.h"
55 #include "DGtal/kernel/domains/CDomain.h"
57 
58 //#include "DGtal/io/Display3D.h"
59 
60 
61 namespace DGtal
62 {
63 
65  // template class DigitalSetBySTLSet
83  template <typename TDomain, typename TCompare = std::less<typename TDomain::Point> >
85  {
86  public:
87  typedef TDomain Domain;
88  typedef TCompare Compare;
90  typedef typename Domain::Space Space;
91  typedef typename Domain::Point Point;
92  typedef typename Domain::Size Size;
93  typedef std::set<Point> Container;
94  typedef typename std::set<Point>::iterator Iterator;
95  typedef typename std::set<Point>::const_iterator ConstIterator;
96 
99 
100  // ----------------------- Standard services ------------------------------
101  public:
102 
107 
115  DigitalSetBySTLSet( Clone<Domain> d, const Compare & c = Compare() );
116 
121  DigitalSetBySTLSet ( const DigitalSetBySTLSet & other );
122 
129 
133  const Domain & domain() const;
134 
139 
140  // ----------------------- Standard Set services --------------------------
141  public:
142 
146  Size size() const;
147 
151  bool empty() const;
152 
159  void insert( const Point & p );
160 
169  template <typename PointInputIterator>
170  void insert( PointInputIterator first, PointInputIterator last );
171 
181  void insertNew( const Point & p );
182 
193  template <typename PointInputIterator>
194  void insertNew( PointInputIterator first, PointInputIterator last );
195 
202  Size erase( const Point & p );
203 
210  void erase( Iterator it );
211 
219  void erase( Iterator first, Iterator last );
220 
225  void clear();
226 
230  ConstIterator find( const Point & p ) const;
231 
236  Iterator find( const Point & p );
237 
241  ConstIterator begin() const;
242 
246  ConstIterator end() const;
247 
251  Iterator begin();
252 
256  Iterator end();
257 
262  const Container & container() const;
267  Container & container();
268 
274  ( const DigitalSetBySTLSet<Domain, Compare> & aSet );
275 
276  // ----------------------- Model of concepts::CPointPredicate -----------------------------
277  public:
278 
283  bool operator()( const Point & p ) const;
284 
285  // ----------------------- Other Set services -----------------------------
286  public:
287 
293  template< typename TOutputIterator >
294  void computeComplement(TOutputIterator& ito) const;
295 
303 
312  void computeBoundingBox( Point & lower, Point & upper ) const;
313 
314 
315  // ----------------------- Interface --------------------------------------
316  public:
317 
322  void selfDisplay ( std::ostream & out ) const;
323 
328  bool isValid() const;
329 
330  // ------------------------- Protected Datas ------------------------------
331  protected:
332 
338 
342  std::set<Point, Compare> mySet;
343 
344 
345  public:
346 
347 
348 
349  // --------------- CDrawableWithBoard2D realization ---------------------
350  public:
351 
355  std::string className() const;
356 
357 
358  // ------------------------- Hidden services ------------------------------
359  protected:
360 
366 
367  private:
368 
369 
370  // ------------------------- Internals ------------------------------------
371  private:
372 
373 
374  }; // end of class DigitalSetBySTLSet
375 
376 
383  template <typename Domain, typename Compare>
384  std::ostream&
385  operator<< ( std::ostream & out, const DigitalSetBySTLSet<Domain, Compare> & object );
386 
387 } // namespace DGtal
388 
389 
391 // Includes inline functions.
392 #include "DGtal/kernel/sets/DigitalSetBySTLSet.ih"
393 
394 // //
396 
397 #endif // !defined DigitalSetBySTLSet_h
398 
399 #undef DigitalSetBySTLSet_RECURSES
400 #endif // else defined(DigitalSetBySTLSet_RECURSES)
DGtal::Clone
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:266
DGtal::HyperRectDomain< Space >::Space
Space Space
Definition: HyperRectDomain.h:110
DGtal::DigitalSetBySTLSet::Iterator
std::set< Point >::iterator Iterator
Definition: DigitalSetBySTLSet.h:94
DGtal::DigitalSetBySTLSet::find
ConstIterator find(const Point &p) const
DGtal::DigitalSetBySTLSet::className
std::string className() const
lower
Vector lower(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:190
DGtal::DigitalSetBySTLSet::~DigitalSetBySTLSet
~DigitalSetBySTLSet()
DGtal::DigitalSetBySTLSet::size
Size size() const
DGtal::DigitalSetBySTLSet::operator=
DigitalSetBySTLSet & operator=(const DigitalSetBySTLSet &other)
DGtal::DigitalSetBySTLSet::Domain
TDomain Domain
Definition: DigitalSetBySTLSet.h:87
DGtal::DigitalSetBySTLSet::begin
ConstIterator begin() const
DGtal::DigitalSetBySTLSet::domain
const Domain & domain() const
DGtal::DigitalSetBySTLSet::domainPointer
CowPtr< Domain > domainPointer() const
DGtal::DigitalSetBySTLSet::mySet
std::set< Point, Compare > mySet
Definition: DigitalSetBySTLSet.h:342
DGtal::DigitalSetBySTLSet::computeBoundingBox
void computeBoundingBox(Point &lower, Point &upper) const
DGtal::DigitalSetBySTLSet::Container
std::set< Point > Container
Definition: DigitalSetBySTLSet.h:93
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::DigitalSetBySTLSet::clear
void clear()
DGtal::DigitalSetBySTLSet::assignFromComplement
void assignFromComplement(const DigitalSetBySTLSet< Domain, Compare > &other_set)
DGtal::HyperRectDomain< Space >::Size
Space::Size Size
Definition: HyperRectDomain.h:117
DGtal::DigitalSetBySTLSet::Self
DigitalSetBySTLSet< Domain, Compare > Self
Definition: DigitalSetBySTLSet.h:89
DGtal::DigitalSetBySTLSet::Compare
TCompare Compare
Definition: DigitalSetBySTLSet.h:88
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
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::DigitalSetBySTLSet::computeComplement
void computeComplement(TOutputIterator &ito) const
DGtal::DigitalSetBySTLSet::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
Concept checks.
DGtal::DigitalSetBySTLSet::container
const Container & container() const
DGtal::DigitalSetBySTLSet::empty
bool empty() const
DGtal::DigitalSetBySTLSet::ConstIterator
std::set< Point >::const_iterator ConstIterator
Definition: DigitalSetBySTLSet.h:95
DGtal::DigitalSetBySTLSet::end
ConstIterator end() const
DGtal::DigitalSetBySTLSet::operator()
bool operator()(const Point &p) const
DGtal::DigitalSetBySTLSet::isValid
bool isValid() const
DGtal::DigitalSetBySTLSet::DigitalSetBySTLSet
DigitalSetBySTLSet()
upper
Vector upper(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:197
DGtal::DigitalSetBySTLSet::Point
Domain::Point Point
Definition: DigitalSetBySTLSet.h:91
DGtal::DigitalSetBySTLSet::insert
void insert(const Point &p)
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::DigitalSetBySTLSet
Aim: A container class for storing sets of digital points within some given domain.
Definition: DigitalSetBySTLSet.h:84
DGtal::DigitalSetBySTLSet::insertNew
void insertNew(const Point &p)
DGtal::DigitalSetBySTLSet::myDomain
CowPtr< Domain > myDomain
Definition: DigitalSetBySTLSet.h:337
DGtal::DigitalSetBySTLSet::Size
Domain::Size Size
Definition: DigitalSetBySTLSet.h:92
DGtal::DigitalSetBySTLSet::erase
Size erase(const Point &p)
DGtal::DigitalSetBySTLSet::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::DigitalSetBySTLSet::Space
Domain::Space Space
Definition: DigitalSetBySTLSet.h:90
DGtal::CowPtr< Domain >