DGtal  0.9.4beta
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DGtal::DigitalSetBySTLSet< TDomain, TCompare > Class Template Reference

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

Collaboration diagram for DGtal::DigitalSetBySTLSet< TDomain, TCompare >:
[legend]

Public Types

typedef TDomain Domain
 
typedef TCompare Compare
 
typedef DigitalSetBySTLSet< Domain, CompareSelf
 
typedef Domain::Space Space
 
typedef Domain::Point Point
 
typedef Domain::Size Size
 
typedef std::set< Point >::iterator Iterator
 
typedef std::set< Point >::const_iterator ConstIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CDomain< TDomain >))
 
 ~DigitalSetBySTLSet ()
 
 DigitalSetBySTLSet (Clone< Domain > d, const Compare &c=Compare())
 
 DigitalSetBySTLSet (const DigitalSetBySTLSet &other)
 
DigitalSetBySTLSetoperator= (const DigitalSetBySTLSet &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 ()
 
DigitalSetBySTLSet< Domain, Compare > & operator+= (const DigitalSetBySTLSet< Domain, Compare > &aSet)
 
bool operator() (const Point &p) const
 
template<typename TOutputIterator >
void computeComplement (TOutputIterator &ito) const
 
void assignFromComplement (const DigitalSetBySTLSet< Domain, Compare > &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

 DigitalSetBySTLSet ()
 

Protected Attributes

CowPtr< DomainmyDomain
 
std::set< Point, ComparemySet
 

Detailed Description

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
class DGtal::DigitalSetBySTLSet< TDomain, TCompare >

Aim: A container class for storing sets of digital points within some given domain.

Description of template class 'DigitalSetBySTLSet'

This is the most versatile implementation for a set of point, and is essentially a wrapper to std::set<Point>. It adds the notion of domain.

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.

Definition at line 84 of file DigitalSetBySTLSet.h.

Member Typedef Documentation

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef TCompare DGtal::DigitalSetBySTLSet< TDomain, TCompare >::Compare

Definition at line 88 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef std::set<Point>::const_iterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::ConstIterator

Definition at line 94 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef TDomain DGtal::DigitalSetBySTLSet< TDomain, TCompare >::Domain

Definition at line 87 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef std::set<Point>::iterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::Iterator

Definition at line 93 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef Domain::Point DGtal::DigitalSetBySTLSet< TDomain, TCompare >::Point

Definition at line 91 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef DigitalSetBySTLSet<Domain, Compare> DGtal::DigitalSetBySTLSet< TDomain, TCompare >::Self

Definition at line 89 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef Domain::Size DGtal::DigitalSetBySTLSet< TDomain, TCompare >::Size

Definition at line 92 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
typedef Domain::Space DGtal::DigitalSetBySTLSet< TDomain, TCompare >::Space

Definition at line 90 of file DigitalSetBySTLSet.h.

Constructor & Destructor Documentation

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
DGtal::DigitalSetBySTLSet< TDomain, TCompare >::~DigitalSetBySTLSet ( )

Destructor.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
DGtal::DigitalSetBySTLSet< TDomain, TCompare >::DigitalSetBySTLSet ( Clone< Domain d,
const Compare c = Compare() 
)

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

Parameters
ccomparison function object.
dany domain.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
DGtal::DigitalSetBySTLSet< TDomain, TCompare >::DigitalSetBySTLSet ( const DigitalSetBySTLSet< TDomain, TCompare > &  other)

Copy constructor.

Parameters
otherthe object to clone.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
DGtal::DigitalSetBySTLSet< TDomain, TCompare >::DigitalSetBySTLSet ( )
protected

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

Member Function Documentation

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::assignFromComplement ( const DigitalSetBySTLSet< Domain, Compare > &  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 TCompare = std::less<typename TDomain::Point>>
ConstIterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::begin ( ) const
Returns
a const iterator on the first element in this set.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
Iterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::begin ( )
Returns
an iterator on the first element in this set.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
DGtal::DigitalSetBySTLSet< TDomain, TCompare >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< TDomain >)  )

Concept checks.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
std::string DGtal::DigitalSetBySTLSet< TDomain, TCompare >::className ( ) const
Returns
the style name used for drawing this object.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::clear ( )

Clears the set.

Postcondition
this set is empty.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
template<typename TOutputIterator >
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
const Domain& DGtal::DigitalSetBySTLSet< TDomain, TCompare >::domain ( ) const
Returns
the embedding domain.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
CowPtr<Domain> DGtal::DigitalSetBySTLSet< TDomain, TCompare >::domainPointer ( ) const
Returns
a copy on write pointer on the embedding domain.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
bool DGtal::DigitalSetBySTLSet< TDomain, TCompare >::empty ( ) const
Returns
'true' iff the set is empty (no element).
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
ConstIterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::end ( ) const
Returns
a const iterator on the element after the last in this set.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
Iterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::end ( )
Returns
a iterator on the element after the last in this set.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
Size DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
ConstIterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::find ( const Point p) const
Parameters
pany digital point.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
Iterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::find ( const Point p)
Parameters
pany digital point.
Returns
an iterator pointing on [p] if found, otherwise end().
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
template<typename PointInputIterator >
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
template<typename PointInputIterator >
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
bool DGtal::DigitalSetBySTLSet< TDomain, TCompare >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
bool DGtal::DigitalSetBySTLSet< TDomain, TCompare >::operator() ( const Point p) const
Parameters
pany point.
Returns
'true' if and only if p belongs to this set.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
DigitalSetBySTLSet<Domain, Compare>& DGtal::DigitalSetBySTLSet< TDomain, TCompare >::operator+= ( const DigitalSetBySTLSet< Domain, Compare > &  aSet)

set union to left.

Parameters
aSetany other set.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
DigitalSetBySTLSet& DGtal::DigitalSetBySTLSet< TDomain, TCompare >::operator= ( const DigitalSetBySTLSet< TDomain, TCompare > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.
template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
void DGtal::DigitalSetBySTLSet< TDomain, TCompare >::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 TCompare = std::less<typename TDomain::Point>>
Size DGtal::DigitalSetBySTLSet< TDomain, TCompare >::size ( ) const
Returns
the number of elements in the set.

Field Documentation

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
CowPtr<Domain> DGtal::DigitalSetBySTLSet< TDomain, TCompare >::myDomain
protected

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

Definition at line 325 of file DigitalSetBySTLSet.h.

template<typename TDomain, typename TCompare = std::less<typename TDomain::Point>>
std::set<Point, Compare> DGtal::DigitalSetBySTLSet< TDomain, TCompare >::mySet
protected

The container storing the points of the set.

Definition at line 330 of file DigitalSetBySTLSet.h.


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