DGtal  1.5.beta
DGtal::DigitalSetBySTLSet< TDomain, TCompare > Class Template Reference

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

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

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< PointContainer
 
typedef std::set< Point >::iterator Iterator
 
typedef std::set< Point >::const_iterator ConstIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CDomain< TDomain >))
 Concept checks. More...
 
 ~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 ()
 
const Containercontainer () const
 
Containercontainer ()
 
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

◆ Compare

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.

◆ ConstIterator

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

Definition at line 95 of file DigitalSetBySTLSet.h.

◆ Container

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

Definition at line 93 of file DigitalSetBySTLSet.h.

◆ Domain

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.

◆ Iterator

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

Definition at line 94 of file DigitalSetBySTLSet.h.

◆ Point

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.

◆ Self

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.

◆ Size

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.

◆ Space

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

◆ ~DigitalSetBySTLSet()

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

Destructor.

◆ DigitalSetBySTLSet() [1/3]

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.

◆ DigitalSetBySTLSet() [2/3]

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.

◆ DigitalSetBySTLSet() [3/3]

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

◆ assignFromComplement()

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'.

◆ begin() [1/2]

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.

◆ begin() [2/2]

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.

Referenced by checkPowerMap().

◆ BOOST_CONCEPT_ASSERT()

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

Concept checks.

◆ className()

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.

◆ clear()

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

Clears the set.

Postcondition
this set is empty.

◆ computeBoundingBox()

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).

◆ computeComplement()

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

◆ container() [1/2]

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

Give access to the underlying container.

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

◆ container() [2/2]

template<typename TDomain , typename TCompare = std::less<typename TDomain::Point>>
const Container& DGtal::DigitalSetBySTLSet< TDomain, TCompare >::container ( ) const

Give access to the underlying container.

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

◆ domain()

template<typename TDomain , typename TCompare = std::less<typename TDomain::Point>>
const Domain& DGtal::DigitalSetBySTLSet< TDomain, TCompare >::domain ( ) const
Returns
the embedding domain.

◆ domainPointer()

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.

◆ empty()

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).

◆ end() [1/2]

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.

◆ end() [2/2]

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.

Referenced by checkPowerMap().

◆ erase() [1/3]

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).

◆ erase() [2/3]

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.

◆ erase() [3/3]

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.

◆ find() [1/2]

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().

◆ find() [2/2]

template<typename TDomain , typename TCompare = std::less<typename TDomain::Point>>
ConstIterator DGtal::DigitalSetBySTLSet< TDomain, TCompare >::find ( const Point p) const
Parameters
pany digital point.

◆ insert() [1/2]

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.

◆ insert() [2/2]

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.

◆ insertNew() [1/2]

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.

Referenced by checkPowerMap(), testSimple2D(), testSimple3D(), and testSimple4D().

◆ insertNew() [2/2]

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.

◆ isValid()

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.

◆ operator()()

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.

◆ operator+=()

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.

◆ operator=()

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'.

◆ selfDisplay()

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.

◆ size()

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

◆ myDomain

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 337 of file DigitalSetBySTLSet.h.

◆ mySet

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 342 of file DigitalSetBySTLSet.h.


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