DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DigitalSetBySTLVector.h
1 
17 #pragma once
18 
35 #if defined(DigitalSetBySTLVector_RECURSES)
36 #error Recursive header files inclusion detected in DigitalSetBySTLVector.h
37 #else // defined(DigitalSetBySTLVector_RECURSES)
38 
39 #define DigitalSetBySTLVector_RECURSES
40 
41 #if !defined DigitalSetBySTLVector_h
42 
43 #define DigitalSetBySTLVector_h
44 
46 // Inclusions
47 #include <iostream>
48 #include <vector>
49 #include <string>
50 #include "DGtal/base/Common.h"
52 
53 namespace DGtal
54 {
55 
57  // template class DigitalSetBySTLVector
69  template <typename TDomain>
71  {
72  public:
73  typedef TDomain Domain;
75  typedef typename Domain::Space Space;
76  typedef typename Domain::Point Point;
77  typedef typename Domain::Size Size;
78  typedef typename std::vector<Point>::iterator Iterator;
79  typedef typename std::vector<Point>::const_iterator ConstIterator;
80 
81  // ----------------------- Standard services ------------------------------
82  public:
83 
88 
95  DigitalSetBySTLVector( const Domain & d );
96 
102 
109 
113  const Domain & domain() const;
114 
115 
116  // ----------------------- Standard Set services --------------------------
117  public:
118 
122  Size size() const;
123 
127  bool empty() const;
128 
135  void insert( const Point & p );
136 
145  template <typename PointInputIterator>
146  void insert( PointInputIterator first, PointInputIterator last );
147 
158  void insertNew( const Point & p );
159 
174  template <typename PointInputIterator>
175  void insertNew( PointInputIterator first, PointInputIterator last );
176 
183  Size erase( const Point & p );
184 
192  void erase( Iterator it );
193 
201  void erase( Iterator first, Iterator last );
202 
207  void clear();
208 
213  ConstIterator find( const Point & p ) const;
214 
219  Iterator find( const Point & p );
220 
224  ConstIterator begin() const;
225 
229  ConstIterator end() const;
230 
234  Iterator begin();
235 
239  Iterator end();
240 
245  DigitalSetBySTLVector<Domain> & operator+=
246  ( const DigitalSetBySTLVector<Domain> & aSet );
247 
248  // ----------------------- Other Set services -----------------------------
249  public:
250 
256  template< typename TOutputIterator >
257  void computeComplement(TOutputIterator& ito) const;
258 
265  void assignFromComplement( const DigitalSetBySTLVector<Domain> & other_set );
266 
275  void computeBoundingBox( Point & lower, Point & upper ) const;
276 
277  // ----------------------- Interface --------------------------------------
278  public:
279 
284  void selfDisplay ( std::ostream & out ) const;
285 
290  bool isValid() const;
291 
292  // ------------------------- Protected Datas ------------------------------
293  protected:
294 
298  const Domain & myDomain;
299 
303  std::vector<Point> myVector;
304 
305  // ------------------------- Private Datas --------------------------------
306  private:
307 
308 
309 
310  // --------------- CDrawableWithBoard2D realization --------------------
311  public:
312 
317  //DrawableWithBoard2D* defaultStyle( std::string mode = "" ) const;
318 
322  std::string className() const;
323 
324  public:
325 
326 
327  // ------------------------- Hidden services ------------------------------
328  protected:
329 
335 
336  // ------------------------- Internals ------------------------------------
337  private:
338 
339  }; // end of class DigitalSetBySTLVector
340 
341 
348  template <typename Domain>
349  std::ostream&
350  operator<< ( std::ostream & out,
351  const DigitalSetBySTLVector<Domain> & object );
352 
353 } // namespace DGtal
354 
355 
357 // Includes inline functions.
358 #include "DGtal/kernel/sets/DigitalSetBySTLVector.ih"
359 
360 // //
362 
363 #endif // !defined DigitalSetBySTLVector_h
364 
365 #undef DigitalSetBySTLVector_RECURSES
366 #endif // else defined(DigitalSetBySTLVector_RECURSES)