DGtal  1.3.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)
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"
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 
240  ConstIterator begin() const;
241 
245  ConstIterator end() const;
246 
250  Iterator begin();
251 
255  Iterator end();
256 
261  const Container & container() const;
262  Container & container();
263 
268  DigitalSetBySTLVector<Domain> & operator+=
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 
297  void assignFromComplement( const DigitalSetBySTLVector<Domain> & other_set );
298 
307  void computeBoundingBox( Point & lower, Point & upper ) const;
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)
DGtal::Clone
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:266
DGtal::DigitalSetBySTLVector::insertNew
void insertNew(const Point &p)
DGtal::HyperRectDomain< Space >::Space
Space Space
Definition: HyperRectDomain.h:110
DGtal::DigitalSetBySTLVector::container
const Container & container() const
DGtal::DigitalSetBySTLVector::DigitalSetBySTLVector
DigitalSetBySTLVector()
lower
Vector lower(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:190
DGtal::DigitalSetBySTLVector::ConstIterator
std::vector< Point >::const_iterator ConstIterator
Definition: DigitalSetBySTLVector.h:90
DGtal::DigitalSetBySTLVector::Self
DigitalSetBySTLVector< Domain > Self
Definition: DigitalSetBySTLVector.h:84
DGtal::DigitalSetBySTLVector::insert
void insert(const Point &p)
DGtal::DigitalSetBySTLVector::computeBoundingBox
void computeBoundingBox(Point &lower, Point &upper) const
DGtal::DigitalSetBySTLVector::MutableIterator
std::vector< Point >::iterator MutableIterator
Definition: DigitalSetBySTLVector.h:91
DGtal::DigitalSetBySTLVector::className
std::string className() const
DGtal::DigitalSetBySTLVector::empty
bool empty() const
DGtal::DigitalSetBySTLVector::end
ConstIterator end() const
DGtal::DigitalSetBySTLVector::myDomain
CowPtr< Domain > myDomain
Definition: DigitalSetBySTLVector.h:331
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::HyperRectDomain< Space >::Size
Space::Size Size
Definition: HyperRectDomain.h:117
DGtal::DigitalSetBySTLVector::computeComplement
void computeComplement(TOutputIterator &ito) const
DGtal::DigitalSetBySTLVector::size
Size size() const
DGtal::DigitalSetBySTLVector::Size
Domain::Size Size
Definition: DigitalSetBySTLVector.h:87
DGtal::DigitalSetBySTLVector::domainPointer
CowPtr< Domain > domainPointer() const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::DigitalSetBySTLVector::Point
Domain::Point Point
Definition: DigitalSetBySTLVector.h:86
DGtal::DigitalSetBySTLVector::~DigitalSetBySTLVector
~DigitalSetBySTLVector()
DGtal::DigitalSetBySTLVector::myVector
std::vector< Point > myVector
Definition: DigitalSetBySTLVector.h:336
DGtal::DigitalSetBySTLVector::clear
void clear()
DGtal::DigitalSetBySTLVector::Iterator
std::vector< Point >::iterator Iterator
Definition: DigitalSetBySTLVector.h:89
DGtal::DigitalSetBySTLVector::Container
std::vector< Point > Container
Definition: DigitalSetBySTLVector.h:88
DGtal::DigitalSetBySTLVector::operator()
bool operator()(const Point &p) const
DGtal::DigitalSetBySTLVector::find
ConstIterator find(const Point &p) const
DGtal::DigitalSetBySTLVector::isValid
bool isValid() const
upper
Vector upper(const Vector &z, unsigned int k)
Definition: viewDualSurface.cpp:197
DGtal::DigitalSetBySTLVector::operator=
DigitalSetBySTLVector & operator=(const DigitalSetBySTLVector &other)
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::DigitalSetBySTLVector::begin
ConstIterator begin() const
DGtal::DigitalSetBySTLVector::Space
Domain::Space Space
Definition: DigitalSetBySTLVector.h:85
DGtal::DigitalSetBySTLVector::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::DigitalSetBySTLVector::assignFromComplement
void assignFromComplement(const DigitalSetBySTLVector< Domain > &other_set)
DGtal::DigitalSetBySTLVector::domain
const Domain & domain() const
DGtal::DigitalSetBySTLVector::Domain
TDomain Domain
Definition: DigitalSetBySTLVector.h:83
DGtal::DigitalSetBySTLVector::erase
Size erase(const Point &p)
DGtal::DigitalSetBySTLVector
Aim: Realizes the concept CDigitalSet by using the STL container std::vector.
Definition: DigitalSetBySTLVector.h:80
DGtal::CowPtr< Domain >