DGtal  1.4.2
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)
39 #define DigitalSetBySTLSet_RECURSES
40 
41 #if !defined DigitalSetBySTLSet_h
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 
116 
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 
242 
247 
252 
257 
262  const Container & container() const;
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 
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)
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:267
Aim: A container class for storing sets of digital points within some given domain.
void selfDisplay(std::ostream &out) const
std::set< Point >::const_iterator ConstIterator
std::set< Point, Compare > mySet
void insert(const Point &p)
DigitalSetBySTLSet(Clone< Domain > d, const Compare &c=Compare())
CowPtr< Domain > domainPointer() const
void computeComplement(TOutputIterator &ito) const
ConstIterator end() const
bool operator()(const Point &p) const
void insertNew(const Point &p)
const Container & container() const
void assignFromComplement(const DigitalSetBySTLSet< Domain, Compare > &other_set)
ConstIterator find(const Point &p) const
void insertNew(PointInputIterator first, PointInputIterator last)
Size erase(const Point &p)
void computeBoundingBox(Point &lower, Point &upper) const
void insert(PointInputIterator first, PointInputIterator last)
std::set< Point >::iterator Iterator
Iterator find(const Point &p)
DigitalSetBySTLSet< Domain, Compare > Self
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
Concept checks.
std::string className() const
void erase(Iterator it)
const Domain & domain() const
DigitalSetBySTLSet(const DigitalSetBySTLSet &other)
DigitalSetBySTLSet & operator=(const DigitalSetBySTLSet &other)
void erase(Iterator first, Iterator last)
ConstIterator begin() const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:130
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)