DGtal 1.3.0
Loading...
Searching...
No Matches
DigitalSetByAssociativeContainer.h
1
17#pragma once
18
39#if defined(DigitalSetByAssociativeContainer_RECURSES)
40#error Recursive header files inclusion detected in DigitalSetByAssociativeContainer.h
41#else // defined(DigitalSetByAssociativeContainer_RECURSES)
43#define DigitalSetByAssociativeContainer_RECURSES
44
45#if !defined DigitalSetByAssociativeContainer_h
47#define DigitalSetByAssociativeContainer_h
48
50// Inclusions
51#include <iostream>
52#include <set>
53#include <string>
54#include "DGtal/base/Common.h"
55#include "DGtal/base/CowPtr.h"
56#include "DGtal/base/Clone.h"
57#include "DGtal/base/Alias.h"
58#include "DGtal/base/ConstAlias.h"
59#include "DGtal/kernel/domains/CDomain.h"
60#include "DGtal/base/CSTLAssociativeContainer.h"
62
63//#include "DGtal/io/Display3D.h"
64
65
66namespace DGtal
67{
68
70 // template class DigitalSetByAssociativeContainer
88 template <typename TDomain, typename TContainer >
90 {
91 public:
92
94 typedef TDomain Domain;
95
97 typedef TContainer Container;
98
102 typedef typename Domain::Space Space;
104 typedef typename Domain::Point Point;
106 typedef typename Container::iterator Iterator;
108 typedef typename Container::const_iterator ConstIterator;
110 typedef typename Container::value_type value_type;
112 typedef typename Container::size_type Size;
113
117 BOOST_STATIC_ASSERT(( boost::is_same<typename Container::key_type, Point>::value ));
118
119 // ----------------------- Standard services ------------------------------
120 public:
121
126
134
140
147
151 const Domain & domain() const;
152
157
158 // ----------------------- Standard Set services --------------------------
162 Size size() const;
163
167 bool empty() const;
168
175 void insert( const Point & p );
176
185 template <typename PointInputIterator>
186 void insert( PointInputIterator first, PointInputIterator last );
187
197 void insertNew( const Point & p );
198
209 template <typename PointInputIterator>
210 void insertNew( PointInputIterator first, PointInputIterator last );
211
218 Size erase( const Point & p );
219
226 void erase( Iterator it );
227
235 void erase( Iterator first, Iterator last );
236
241 void clear();
242
246 ConstIterator find( const Point & p ) const;
247
252 Iterator find( const Point & p );
253
258
263
268
273
278 const Container & container() const;
284
291
292 // ----------------------- Model of concepts::CPointPredicate -----------------------------
293 public:
294
299 bool operator()( const Point & p ) const;
300
301 // ----------------------- Other Set services -----------------------------
302
308 template< typename TOutputIterator >
309 void computeComplement(TOutputIterator& ito) const;
310
318
328
329
330 // ----------------------- Interface --------------------------------------
331
336 void selfDisplay ( std::ostream & out ) const;
337
342 bool isValid() const;
343
344 // ------------------------- Protected Datas ------------------------------
345 protected:
346
352
357
358 // --------------- CDrawableWithBoard2D realization ---------------------
359 public:
360
364 std::string className() const;
365
366
367 // ------------------------- Hidden services ------------------------------
368 protected:
369
375
376 }; // end of class DigitalSetByAssociativeContainer
377
378
385 template <typename Domain, typename Container>
386 std::ostream&
387 operator<< ( std::ostream & out, const DigitalSetByAssociativeContainer<Domain, Container> & object );
388
389} // namespace DGtal
390
391
393// Includes inline functions.
394#include "DGtal/kernel/sets/DigitalSetByAssociativeContainer.ih"
395
396// //
398
399#endif // !defined DigitalSetByAssociativeContainer_h
400
401#undef DigitalSetByAssociativeContainer_RECURSES
402#endif // else defined(DigitalSetByAssociativeContainer_RECURSES)
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:267
Aim: Copy on write shared pointer.
Definition: CowPtr.h:68
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
void insertNew(PointInputIterator first, PointInputIterator last)
BOOST_STATIC_ASSERT((boost::is_same< typename Container::key_type, Point >::value))
BOOST_CONCEPT_ASSERT((concepts::CSTLAssociativeContainer< TContainer >))
void assignFromComplement(const DigitalSetByAssociativeContainer< Domain, Container > &other_set)
DigitalSetByAssociativeContainer(Clone< Domain > d)
Domain::Point Point
Type of points in the space.
void erase(Iterator first, Iterator last)
DigitalSetByAssociativeContainer(const DigitalSetByAssociativeContainer &other)
CowPtr< Domain > domainPointer() const
Container::size_type Size
Size type of the container;.
DigitalSetByAssociativeContainer & operator=(const DigitalSetByAssociativeContainer &other)
ConstIterator find(const Point &p) const
void insert(PointInputIterator first, PointInputIterator last)
Container::value_type value_type
Value type of the container.
DigitalSetByAssociativeContainer< Domain, Container > Self
Self Type.
void computeComplement(TOutputIterator &ito) const
void computeBoundingBox(Point &lower, Point &upper) const
void selfDisplay(std::ostream &out) const
Container::iterator Iterator
Iterator type of the container.
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
Concept checks.
bool operator()(const Point &p) const
const Container & container() const
Container::const_iterator ConstIterator
ConstIterator type of the container;.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:130
Aim: Defines the concept describing an Associative Container of the STL (https://www....
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)