DGtal  0.9.3beta
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer > Class Template Reference

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

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

Public Types

typedef TDomain Domain
 
typedef TContainer Container
 
typedef DigitalSetByAssociativeContainer< Domain, ContainerSelf
 
typedef Domain::Space Space
 
typedef Domain::Point Point
 
typedef Container::iterator Iterator
 
typedef Container::const_iterator ConstIterator
 
typedef Container::value_type value_type
 
typedef Container::size_type Size
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CDomain< TDomain >))
 
 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 ()
 
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, geometry/tools/exampleAlphaShape.cpp, geometry/tools/exampleConvexHull2D.cpp, geometry/volumes/distance/voronoimap2D.cpp, io/boards/dgtalBoard3D-1-points.cpp, io/digitalSetFromVol.cpp, io/display3DToOFF.cpp, shapes/exampleEuclideanShapesDecorator.cpp, topology/3dBorderExtraction.cpp, topology/3dBorderExtractionImg.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, and tutorial-examples/freemanChainFromImage.cpp.

Definition at line 89 of file DigitalSetByAssociativeContainer.h.

Member Typedef Documentation

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.

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

Container type.

Definition at line 97 of file DigitalSetByAssociativeContainer.h.

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

Domain type.

Definition at line 94 of file DigitalSetByAssociativeContainer.h.

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.

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.

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

Self Type.

Definition at line 100 of file DigitalSetByAssociativeContainer.h.

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.

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.

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

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

Destructor.

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.
template<typename TDomain, typename TContainer>
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::DigitalSetByAssociativeContainer ( const DigitalSetByAssociativeContainer< TDomain, TContainer > &  other)

Copy constructor.

Parameters
otherthe object to clone.
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

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'.
template<typename TDomain, typename TContainer>
ConstIterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::begin ( ) const
Returns
a const iterator on the first element in this set.
template<typename TDomain, typename TContainer>
Iterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::begin ( )
Returns
an iterator on the first element in this set.
template<typename TDomain, typename TContainer>
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< TDomain >)  )

Concept checks.

template<typename TDomain, typename TContainer>
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CSTLAssociativeContainer< TContainer >)  )
template<typename TDomain, typename TContainer>
DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::BOOST_STATIC_ASSERT ( (boost::is_same< typename Container::key_type, Point >::value)  )
template<typename TDomain, typename TContainer>
std::string DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::className ( ) const
Returns
the style name used for drawing this object.
Examples:
shapes/exampleEuclideanShapesDecorator.cpp.
template<typename TDomain, typename TContainer>
void DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::clear ( )

Clears the set.

Postcondition
this set is empty.
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).
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
template<typename TDomain, typename TContainer>
const Domain& DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::domain ( ) const
Returns
the embedding domain.
template<typename TDomain, typename TContainer>
CowPtr<Domain> DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::domainPointer ( ) const
Returns
a copy on write pointer on the embedding domain.
template<typename TDomain, typename TContainer>
bool DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::empty ( ) const
Returns
'true' iff the set is empty (no element).
template<typename TDomain, typename TContainer>
ConstIterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::end ( ) const
Returns
a const iterator on the element after the last in this set.
template<typename TDomain, typename TContainer>
Iterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::end ( )
Returns
a iterator on the element after the last in this set.
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).
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.
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.
template<typename TDomain, typename TContainer>
ConstIterator DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::find ( const Point p) const
Parameters
pany digital point.
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().
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.
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.
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.
Examples:
geometry/volumes/distance/voronoimap2D.cpp, and io/boards/dgtalBoard3D-1-points.cpp.
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.
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.
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.
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.
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'.
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.
template<typename TDomain, typename TContainer>
Size DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::size ( ) const
Returns
the number of elements in the set.

Field Documentation

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 340 of file DigitalSetByAssociativeContainer.h.

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

The container storing the points of the set.

Definition at line 345 of file DigitalSetByAssociativeContainer.h.


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