DGtal  1.5.beta
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer > Class Template Reference

Aim: A wrapper class around a STL associative container for storing sets of digital points within some given domain. More...

#include <DGtal/kernel/sets/DigitalSetByAssociativeContainer.h>

Inheritance diagram for DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >:
[legend]

Public Types

typedef TDomain Domain
 Domain type. More...
 
typedef TContainer Container
 Container type. More...
 
typedef DigitalSetByAssociativeContainer< Domain, ContainerSelf
 Self Type. More...
 
typedef Domain::Space Space
 Type of digital space. More...
 
typedef Domain::Point Point
 Type of points in the space. More...
 
typedef Container::iterator Iterator
 Iterator type of the container. More...
 
typedef Container::const_iterator ConstIterator
 ConstIterator type of the container;. More...
 
typedef Container::value_type value_type
 Value type of the container. More...
 
typedef Container::size_type Size
 Size type of the container;. More...
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CDomain< TDomain >))
 Concept checks. More...
 
 BOOST_CONCEPT_ASSERT ((concepts::CSTLAssociativeContainer< TContainer >))
 
 BOOST_STATIC_ASSERT ((boost::is_same< typename Container::key_type, Point >::value))
 
 ~DigitalSetByAssociativeContainer ()
 
 DigitalSetByAssociativeContainer (Clone< Domain > d)
 
 DigitalSetByAssociativeContainer (const DigitalSetByAssociativeContainer &other)
 
DigitalSetByAssociativeContaineroperator= (const DigitalSetByAssociativeContainer &other)
 
const Domaindomain () const
 
CowPtr< DomaindomainPointer () const
 
Size size () const
 
bool empty () const
 
void insert (const Point &p)
 
template<typename PointInputIterator >
void insert (PointInputIterator first, PointInputIterator last)
 
void insertNew (const Point &p)
 
template<typename PointInputIterator >
void insertNew (PointInputIterator first, PointInputIterator last)
 
Size erase (const Point &p)
 
void erase (Iterator it)
 
void erase (Iterator first, Iterator last)
 
void clear ()
 
ConstIterator find (const Point &p) const
 
Iterator find (const Point &p)
 
ConstIterator begin () const
 
ConstIterator end () const
 
Iterator begin ()
 
Iterator end ()
 
const Containercontainer () const
 
Containercontainer ()
 
DigitalSetByAssociativeContainer< Domain, Container > & operator+= (const DigitalSetByAssociativeContainer< Domain, Container > &aSet)
 
bool operator() (const Point &p) const
 
template<typename TOutputIterator >
void computeComplement (TOutputIterator &ito) const
 
void assignFromComplement (const DigitalSetByAssociativeContainer< Domain, Container > &other_set)
 
void computeBoundingBox (Point &lower, Point &upper) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 

Protected Member Functions

 DigitalSetByAssociativeContainer ()
 

Protected Attributes

CowPtr< DomainmyDomain
 
Container mySet
 

Detailed Description

template<typename TDomain, typename TContainer>
class DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >

Aim: A wrapper class around a STL associative container for storing sets of digital points within some given domain.

Description of template class 'DigitalSetByAssociativeContainer'

Model of CDigitalSet.

Since
0.7 Domains are now hold with copy on write pointers and no more only aliased. The problem was related to returning sets with a locally constructed domain. With CowPtr, you are sure that the domain remains valid during the lifetime of your set.
Template Parameters
TDomaintype of domain on which the set will be defined (model of concepts::CDomain).
TContainerSTL associative container to store points (model of concepts::CSTLAssociativeContainer).
Examples
dec/exampleDECSurface.cpp.

Definition at line 89 of file DigitalSetByAssociativeContainer.h.

Member Typedef Documentation

◆ ConstIterator

template<typename TDomain , typename TContainer >
typedef Container::const_iterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::ConstIterator

ConstIterator type of the container;.

Definition at line 108 of file DigitalSetByAssociativeContainer.h.

◆ Container

template<typename TDomain , typename TContainer >
typedef TContainer DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::Container

Container type.

Definition at line 97 of file DigitalSetByAssociativeContainer.h.

◆ Domain

template<typename TDomain , typename TContainer >
typedef TDomain DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::Domain

Domain type.

Definition at line 94 of file DigitalSetByAssociativeContainer.h.

◆ Iterator

template<typename TDomain , typename TContainer >
typedef Container::iterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::Iterator

Iterator type of the container.

Definition at line 106 of file DigitalSetByAssociativeContainer.h.

◆ Point

template<typename TDomain , typename TContainer >
typedef Domain::Point DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::Point

Type of points in the space.

Definition at line 104 of file DigitalSetByAssociativeContainer.h.

◆ Self

template<typename TDomain , typename TContainer >
typedef DigitalSetByAssociativeContainer<Domain, Container> DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::Self

Self Type.

Definition at line 100 of file DigitalSetByAssociativeContainer.h.

◆ Size

template<typename TDomain , typename TContainer >
typedef Container::size_type DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::Size

Size type of the container;.

Definition at line 112 of file DigitalSetByAssociativeContainer.h.

◆ Space

template<typename TDomain , typename TContainer >
typedef Domain::Space DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::Space

Type of digital space.

Definition at line 102 of file DigitalSetByAssociativeContainer.h.

◆ value_type

template<typename TDomain , typename TContainer >
typedef Container::value_type DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::value_type

Value type of the container.

Definition at line 110 of file DigitalSetByAssociativeContainer.h.

Constructor & Destructor Documentation

◆ ~DigitalSetByAssociativeContainer()

template<typename TDomain , typename TContainer >
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::~DigitalSetByAssociativeContainer ( )

Destructor.

◆ DigitalSetByAssociativeContainer() [1/3]

template<typename TDomain , typename TContainer >
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::DigitalSetByAssociativeContainer ( Clone< Domain d)

Constructor. Creates the empty set in the domain [d].

Parameters
dany domain.

◆ DigitalSetByAssociativeContainer() [2/3]

template<typename TDomain , typename TContainer >
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::DigitalSetByAssociativeContainer ( const DigitalSetByAssociativeContainer< TDomain, TContainer > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ DigitalSetByAssociativeContainer() [3/3]

template<typename TDomain , typename TContainer >
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::DigitalSetByAssociativeContainer ( )
protected

Default Constructor. Forbidden since a Domain is necessary for defining a set.

Member Function Documentation

◆ assignFromComplement()

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::assignFromComplement ( const DigitalSetByAssociativeContainer< Domain, Container > &  other_set)

Builds the complement in the domain of the set [other_set] in this.

Parameters
other_setdefines the set whose complement is assigned to 'this'.

Referenced by testLayers(), and testSimpleExpander().

◆ begin() [1/2]

template<typename TDomain , typename TContainer >
Iterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::begin ( )
Returns
an iterator on the first element in this set.

◆ begin() [2/2]

template<typename TDomain , typename TContainer >
ConstIterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::begin ( ) const

◆ BOOST_CONCEPT_ASSERT() [1/2]

template<typename TDomain , typename TContainer >
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< TDomain >)  )

Concept checks.

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TDomain , typename TContainer >
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CSTLAssociativeContainer< TContainer >)  )

◆ BOOST_STATIC_ASSERT()

template<typename TDomain , typename TContainer >
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::BOOST_STATIC_ASSERT ( (boost::is_same< typename Container::key_type, Point >::value)  )

◆ className()

template<typename TDomain , typename TContainer >
std::string DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::className ( ) const
Returns
the style name used for drawing this object.

Referenced by checkCut(), checkOutputConvexHullBorder(), main(), specificTestLatticePolytope2D(), testBoard2D(), and testLatticePolytope2D().

◆ clear()

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::clear ( )

Clears the set.

Postcondition
this set is empty.

Referenced by testImplicitShape().

◆ computeBoundingBox()

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::computeBoundingBox ( Point lower,
Point upper 
) const

Computes the bounding box of this set.

Parameters
lowerthe first point of the bounding box (lowest in all directions).
upperthe last point of the bounding box (highest in all directions).

◆ computeComplement()

template<typename TDomain , typename TContainer >
template<typename TOutputIterator >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::computeComplement ( TOutputIterator &  ito) const

Computes the complement in the domain of this set

Parameters
itoan output iterator
Template Parameters
TOutputIteratora model of output iterator

◆ container() [1/2]

template<typename TDomain , typename TContainer >
Container& DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::container ( )

Give access to the underlying container.

Returns
a (might be const) reference to the stored container.

◆ container() [2/2]

template<typename TDomain , typename TContainer >
const Container& DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::container ( ) const

Give access to the underlying container.

Returns
a (might be const) reference to the stored container.

◆ domain()

template<typename TDomain , typename TContainer >
const Domain& DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::domain ( ) const
Returns
the embedding domain.

Referenced by brut_force_voronoi_map_complete(), main(), and TEST_CASE().

◆ domainPointer()

template<typename TDomain , typename TContainer >
CowPtr<Domain> DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::domainPointer ( ) const
Returns
a copy on write pointer on the embedding domain.

◆ empty()

template<typename TDomain , typename TContainer >
bool DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::empty ( ) const
Returns
'true' iff the set is empty (no element).

◆ end() [1/2]

template<typename TDomain , typename TContainer >
Iterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::end ( )
Returns
a iterator on the element after the last in this set.

◆ end() [2/2]

template<typename TDomain , typename TContainer >
ConstIterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::end ( ) const

◆ erase() [1/3]

template<typename TDomain , typename TContainer >
Size DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::erase ( const Point p)

Removes point [p] from the set.

Parameters
pthe point to remove.
Returns
the number of removed elements (0 or 1).

Referenced by main(), Object3D(), testSetTable(), testSimplePoints2D(), testSimplePoints3D(), and testVoronoiMap().

◆ erase() [2/3]

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::erase ( Iterator  first,
Iterator  last 
)

Removes the collection of points specified by the two iterators from this set.

Parameters
firstthe start point in this set.
lastthe last point in this set.

◆ erase() [3/3]

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::erase ( Iterator  it)

Removes the point pointed by [it] from the set.

Parameters
itan iterator on this set. Note: generally faster than giving just the point.

◆ find() [1/2]

template<typename TDomain , typename TContainer >
Iterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::find ( const Point p)
Parameters
pany digital point.
Returns
an iterator pointing on [p] if found, otherwise end().

◆ find() [2/2]

template<typename TDomain , typename TContainer >
ConstIterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::find ( const Point p) const
Parameters
pany digital point.

Referenced by checkCut(), and testSetFromImage().

◆ insert() [1/2]

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insert ( const Point p)

Adds point [p] to this set.

Parameters
pany digital point.
Precondition
p should belong to the associated domain.

Referenced by main(), TEST_CASE(), testFindABel(), testImageFromSet(), testLayers(), testOrderingDigitalSurfaceFacesAroundVertex(), testSimpleExpander(), testSimpleRandom2D(), and testSimpleRandom3D().

◆ insert() [2/2]

template<typename TDomain , typename TContainer >
template<typename PointInputIterator >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insert ( PointInputIterator  first,
PointInputIterator  last 
)

Adds the collection of points specified by the two iterators to this set.

Parameters
firstthe start point in the collection of Point.
lastthe last point in the collection of Point.
Precondition
all points should belong to the associated domain.

◆ insertNew() [1/2]

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insertNew ( const Point p)

Adds point [p] to this set if the point is not already in the set.

Parameters
pany digital point.
Precondition
p should belong to the associated domain.
p should not belong to this.

Referenced by main(), Object3D(), TEST_CASE(), testBoard2D(), testBoard3D(), testExactMetricBalls(), testExpander(), testImageAdapter(), testInexactMetricBalls(), testObject3D(), testObjectBorder(), testObjectGraph(), testSimple2D(), testSimple3D(), testSimplePoints3D(), and testVoronoiMap().

◆ insertNew() [2/2]

template<typename TDomain , typename TContainer >
template<typename PointInputIterator >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insertNew ( PointInputIterator  first,
PointInputIterator  last 
)

Adds the collection of points specified by the two iterators to this set.

Parameters
firstthe start point in the collection of Point.
lastthe last point in the collection of Point.
Precondition
all points should belong to the associated domain.
each point should not belong to this.

◆ isValid()

template<typename TDomain , typename TContainer >
bool DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

Referenced by TEST_CASE().

◆ operator()()

template<typename TDomain , typename TContainer >
bool DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::operator() ( const Point p) const
Parameters
pany point.
Returns
'true' if and only if p belongs to this set.

◆ operator+=()

template<typename TDomain , typename TContainer >
DigitalSetByAssociativeContainer<Domain, Container>& DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::operator+= ( const DigitalSetByAssociativeContainer< Domain, Container > &  aSet)

set union to left.

Parameters
aSetany other set.

◆ operator=()

template<typename TDomain , typename TContainer >
DigitalSetByAssociativeContainer& DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::operator= ( const DigitalSetByAssociativeContainer< TDomain, TContainer > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ selfDisplay()

template<typename TDomain , typename TContainer >
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ size()

template<typename TDomain , typename TContainer >
Size DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::size ( ) const
Returns
the number of elements in the set.

Referenced by checkCut(), main(), TEST_CASE(), testObjectGraph(), and testSetFromImage().

Field Documentation

◆ myDomain

template<typename TDomain , typename TContainer >
CowPtr<Domain> DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::myDomain
protected

The associated domain. The pointed domain may be changed but it remains valid during the lifetime of the set.

Definition at line 351 of file DigitalSetByAssociativeContainer.h.

◆ mySet

template<typename TDomain , typename TContainer >
Container DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::mySet
protected

The container storing the points of the set.

Definition at line 356 of file DigitalSetByAssociativeContainer.h.


The documentation for this class was generated from the following file: