DGtal  1.4.beta
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)
39 #define DigitalSetBySTLVector_RECURSES
40 
41 #if !defined DigitalSetBySTLVector_h
43 #define DigitalSetBySTLVector_h
44 
46 // Inclusions
47 #include <iostream>
48 #include <vector>
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"
56 
57 namespace DGtal
58 {
59 
61  // template class DigitalSetBySTLVector
79  template <typename TDomain>
81  {
82  public:
83  typedef TDomain Domain;
85  typedef typename Domain::Space Space;
86  typedef typename Domain::Point Point;
87  typedef typename Domain::Size Size;
88  typedef std::vector<Point> Container;
89  typedef typename std::vector<Point>::iterator Iterator;
90  typedef typename std::vector<Point>::const_iterator ConstIterator;
91  typedef typename std::vector<Point>::iterator MutableIterator;
92 
93  // ----------------------- Standard services ------------------------------
94  public:
95 
100 
108 
114 
121 
125  const Domain & domain() const;
126 
131 
132  // ----------------------- Standard Set services --------------------------
133  public:
134 
138  Size size() const;
139 
143  bool empty() const;
144 
151  void insert( const Point & p );
152 
161  template <typename PointInputIterator>
162  void insert( PointInputIterator first, PointInputIterator last );
163 
174  void insertNew( const Point & p );
175 
190  template <typename PointInputIterator>
191  void insertNew( PointInputIterator first, PointInputIterator last );
192 
199  Size erase( const Point & p );
200 
208  void erase( Iterator it );
209 
217  void erase( Iterator first, Iterator last );
218 
223  void clear();
224 
229  ConstIterator find( const Point & p ) const;
230 
235  Iterator find( const Point & p );
236 
241 
246 
251 
256 
261  const Container & container() const;
263 
269  ( const DigitalSetBySTLVector<Domain> & aSet );
270 
271  // ----------------------- Model of concepts::CPointPredicate -----------------------------
272  public:
273 
278  bool operator()( const Point & p ) const;
279 
280  // ----------------------- Other Set services -----------------------------
281  public:
282 
288  template< typename TOutputIterator >
289  void computeComplement(TOutputIterator& ito) const;
290 
298 
308 
309  // ----------------------- Interface --------------------------------------
310  public:
311 
316  void selfDisplay ( std::ostream & out ) const;
317 
322  bool isValid() const;
323 
324  // ------------------------- Protected Datas ------------------------------
325  protected:
326 
332 
336  std::vector<Point> myVector;
337 
338  // ------------------------- Private Datas --------------------------------
339  private:
340 
341 
342 
343  // --------------- CDrawableWithBoard2D realization --------------------
344  public:
345 
349  std::string className() const;
350 
351  public:
352 
353 
354  // ------------------------- Hidden services ------------------------------
355  protected:
356 
362 
363  // ------------------------- Internals ------------------------------------
364  private:
365 
366  }; // end of class DigitalSetBySTLVector
367 
368 
375  template <typename Domain>
376  std::ostream&
377  operator<< ( std::ostream & out,
378  const DigitalSetBySTLVector<Domain> & object );
379 
380 } // namespace DGtal
381 
382 
384 // Includes inline functions.
385 #include "DGtal/kernel/sets/DigitalSetBySTLVector.ih"
386 
387 // //
389 
390 #endif // !defined DigitalSetBySTLVector_h
391 
392 #undef DigitalSetBySTLVector_RECURSES
393 #endif // else defined(DigitalSetBySTLVector_RECURSES)
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:267
Aim: Realizes the concept CDigitalSet by using the STL container std::vector.
Size erase(const Point &p)
void insert(PointInputIterator first, PointInputIterator last)
void insertNew(const Point &p)
std::vector< Point >::iterator MutableIterator
void computeBoundingBox(Point &lower, Point &upper) const
std::vector< Point >::const_iterator ConstIterator
const Container & container() const
std::string className() const
bool operator()(const Point &p) const
std::vector< Point >::iterator Iterator
DigitalSetBySTLVector & operator=(const DigitalSetBySTLVector &other)
DigitalSetBySTLVector< Domain > Self
DigitalSetBySTLVector(Clone< Domain > d)
DigitalSetBySTLVector(const DigitalSetBySTLVector &other)
void insertNew(PointInputIterator first, PointInputIterator last)
const Domain & domain() const
Iterator find(const Point &p)
CowPtr< Domain > domainPointer() const
void computeComplement(TOutputIterator &ito) const
void erase(Iterator first, Iterator last)
void insert(const Point &p)
void selfDisplay(std::ostream &out) const
ConstIterator find(const Point &p) const
ConstIterator begin() const
void assignFromComplement(const DigitalSetBySTLVector< Domain > &other_set)
ConstIterator end() 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)
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)