DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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"
52 
53 //#include "DGtal/io/Display3D.h"
54 
55 
56 namespace DGtal
57 {
58 
60  // template class DigitalSetBySTLSet
73  template <typename TDomain>
75  {
76  public:
77  typedef TDomain Domain;
79  typedef typename Domain::Space Space;
80  typedef typename Domain::Point Point;
81  typedef typename Domain::Size Size;
82  typedef typename std::set<Point>::iterator Iterator;
83  typedef typename std::set<Point>::const_iterator ConstIterator;
84 
85  // ----------------------- Standard services ------------------------------
86  public:
87 
92 
99  DigitalSetBySTLSet( const Domain & d );
100 
105  DigitalSetBySTLSet ( const DigitalSetBySTLSet & other );
106 
113 
117  const Domain & domain() const;
118 
119  // ----------------------- Standard Set services --------------------------
120  public:
121 
125  Size size() const;
126 
130  bool empty() const;
131 
138  void insert( const Point & p );
139 
148  template <typename PointInputIterator>
149  void insert( PointInputIterator first, PointInputIterator last );
150 
160  void insertNew( const Point & p );
161 
172  template <typename PointInputIterator>
173  void insertNew( PointInputIterator first, PointInputIterator last );
174 
181  Size erase( const Point & p );
182 
189  void erase( Iterator it );
190 
198  void erase( Iterator first, Iterator last );
199 
204  void clear();
205 
209  ConstIterator find( const Point & p ) const;
210 
215  Iterator find( const Point & p );
216 
220  ConstIterator begin() const;
221 
225  ConstIterator end() const;
226 
230  Iterator begin();
231 
235  Iterator end();
236 
241  DigitalSetBySTLSet<Domain> & operator+=
242  ( const DigitalSetBySTLSet<Domain> & aSet );
243 
244  // ----------------------- Other Set services -----------------------------
245  public:
246 
252  template< typename TOutputIterator >
253  void computeComplement(TOutputIterator& ito) const;
254 
261  void assignFromComplement( const DigitalSetBySTLSet<Domain> & other_set );
262 
271  void computeBoundingBox( Point & lower, Point & upper ) const;
272 
273 
274  // ----------------------- Interface --------------------------------------
275  public:
276 
281  void selfDisplay ( std::ostream & out ) const;
282 
287  bool isValid() const;
288 
289  // ------------------------- Protected Datas ------------------------------
290  protected:
291 
295  const Domain & myDomain;
296 
300  std::set<Point> mySet;
301 
302 
303  public:
304 
305 
306 
307  // --------------- CDrawableWithBoard2D realization ---------------------
308  public:
309 
314  //DrawableWithBoard2D* defaultStyle( std::string mode = "" ) const;
315 
319  std::string className() const;
320 
321 
322  // ------------------------- Hidden services ------------------------------
323  protected:
324 
330 
331  private:
332 
333 
334  // ------------------------- Internals ------------------------------------
335  private:
336 
337 
338  }; // end of class DigitalSetBySTLSet
339 
340 
347  template <typename Domain>
348  std::ostream&
349  operator<< ( std::ostream & out, const DigitalSetBySTLSet<Domain> & object );
350 
351 } // namespace DGtal
352 
353 
355 // Includes inline functions.
356 #include "DGtal/kernel/sets/DigitalSetBySTLSet.ih"
357 
358 // //
360 
361 #endif // !defined DigitalSetBySTLSet_h
362 
363 #undef DigitalSetBySTLSet_RECURSES
364 #endif // else defined(DigitalSetBySTLSet_RECURSES)