DGtal  1.1.0
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 typename std::set<Point>::iterator Iterator;
94  typedef typename std::set<Point>::const_iterator ConstIterator;
95 
98 
99  // ----------------------- Standard services ------------------------------
100  public:
101 
106 
115 
121 
128 
132  const Domain & domain() const;
133 
138 
139  // ----------------------- Standard Set services --------------------------
140  public:
141 
145  Size size() const;
146 
150  bool empty() const;
151 
158  void insert( const Point & p );
159 
168  template <typename PointInputIterator>
169  void insert( PointInputIterator first, PointInputIterator last );
170 
180  void insertNew( const Point & p );
181 
192  template <typename PointInputIterator>
193  void insertNew( PointInputIterator first, PointInputIterator last );
194 
201  Size erase( const Point & p );
202 
209  void erase( Iterator it );
210 
218  void erase( Iterator first, Iterator last );
219 
224  void clear();
225 
229  ConstIterator find( const Point & p ) const;
230 
235  Iterator find( const Point & p );
236 
241 
246 
251 
256 
262  ( const DigitalSetBySTLSet<Domain, Compare> & aSet );
263 
264  // ----------------------- Model of concepts::CPointPredicate -----------------------------
265  public:
266 
271  bool operator()( const Point & p ) const;
272 
273  // ----------------------- Other Set services -----------------------------
274  public:
275 
281  template< typename TOutputIterator >
282  void computeComplement(TOutputIterator& ito) const;
283 
291 
301 
302 
303  // ----------------------- Interface --------------------------------------
304  public:
305 
310  void selfDisplay ( std::ostream & out ) const;
311 
316  bool isValid() const;
317 
318  // ------------------------- Protected Datas ------------------------------
319  protected:
320 
326 
330  std::set<Point, Compare> mySet;
331 
332 
333  public:
334 
335 
336 
337  // --------------- CDrawableWithBoard2D realization ---------------------
338  public:
339 
343  std::string className() const;
344 
345 
346  // ------------------------- Hidden services ------------------------------
347  protected:
348 
354 
355  private:
356 
357 
358  // ------------------------- Internals ------------------------------------
359  private:
360 
361 
362  }; // end of class DigitalSetBySTLSet
363 
364 
371  template <typename Domain, typename Compare>
372  std::ostream&
373  operator<< ( std::ostream & out, const DigitalSetBySTLSet<Domain, Compare> & object );
374 
375 } // namespace DGtal
376 
377 
379 // Includes inline functions.
380 #include "DGtal/kernel/sets/DigitalSetBySTLSet.ih"
381 
382 // //
384 
385 #endif // !defined DigitalSetBySTLSet_h
386 
387 #undef DigitalSetBySTLSet_RECURSES
388 #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:267
DGtal::DigitalSetBySTLSet::find
Iterator find(const Point &p)
DGtal::HyperRectDomain< Space >::Space
Space Space
Definition: HyperRectDomain.h:110
DGtal::DigitalSetBySTLSet::Iterator
std::set< Point >::iterator Iterator
Definition: DigitalSetBySTLSet.h:93
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::begin
Iterator begin()
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:330
DGtal::DigitalSetBySTLSet::computeBoundingBox
void computeBoundingBox(Point &lower, Point &upper) const
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::DigitalSetBySTLSet::end
Iterator end()
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::DigitalSetBySTLSet::insert
void insert(PointInputIterator first, PointInputIterator last)
DGtal::DigitalSetBySTLSet::computeComplement
void computeComplement(TOutputIterator &ito) const
DGtal::DigitalSetBySTLSet::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
Concept checks.
DGtal::DigitalSetBySTLSet::empty
bool empty() const
DGtal::DigitalSetBySTLSet::insertNew
void insertNew(PointInputIterator first, PointInputIterator last)
DGtal::DigitalSetBySTLSet::ConstIterator
std::set< Point >::const_iterator ConstIterator
Definition: DigitalSetBySTLSet.h:94
DGtal::DigitalSetBySTLSet::erase
void erase(Iterator first, Iterator last)
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::DigitalSetBySTLSet::end
ConstIterator end() const
DGtal::DigitalSetBySTLSet::DigitalSetBySTLSet
DigitalSetBySTLSet(const DigitalSetBySTLSet &other)
DGtal::DigitalSetBySTLSet::erase
void erase(Iterator it)
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:593
DGtal::DigitalSetBySTLSet
Aim: A container class for storing sets of digital points within some given domain.
Definition: DigitalSetBySTLSet.h:85
DGtal::DigitalSetBySTLSet::DigitalSetBySTLSet
DigitalSetBySTLSet(Clone< Domain > d, const Compare &c=Compare())
DGtal::DigitalSetBySTLSet::insertNew
void insertNew(const Point &p)
DGtal::DigitalSetBySTLSet::myDomain
CowPtr< Domain > myDomain
Definition: DigitalSetBySTLSet.h:325
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 >