DGtal  1.5.beta
DGtal::DigitalSetBySTLVector< TDomain > Class Template Reference

Aim: Realizes the concept CDigitalSet by using the STL container std::vector. More...

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

Public Types

typedef TDomain Domain
 
typedef DigitalSetBySTLVector< DomainSelf
 
typedef Domain::Space Space
 
typedef Domain::Point Point
 
typedef Domain::Size Size
 
typedef std::vector< PointContainer
 
typedef std::vector< Point >::iterator Iterator
 
typedef std::vector< Point >::const_iterator ConstIterator
 
typedef std::vector< Point >::iterator MutableIterator
 

Public Member Functions

 ~DigitalSetBySTLVector ()
 
 DigitalSetBySTLVector (Clone< Domain > d)
 
 DigitalSetBySTLVector (const DigitalSetBySTLVector &other)
 
DigitalSetBySTLVectoroperator= (const DigitalSetBySTLVector &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 ()
 
DigitalSetBySTLVector< Domain > & operator+= (const DigitalSetBySTLVector< Domain > &aSet)
 
bool operator() (const Point &p) const
 
template<typename TOutputIterator >
void computeComplement (TOutputIterator &ito) const
 
void assignFromComplement (const DigitalSetBySTLVector< Domain > &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

 DigitalSetBySTLVector ()
 

Protected Attributes

CowPtr< DomainmyDomain
 
std::vector< PointmyVector
 

Detailed Description

template<typename TDomain>
class DGtal::DigitalSetBySTLVector< TDomain >

Aim: Realizes the concept CDigitalSet by using the STL container std::vector.

Description of template class 'DigitalSetBySTLVector'

It thus describes a modifiable set of points within the given domain [Domain].

Template Parameters
TDomaina realization of the concept CDomain.
See also
CDigitalSet,CDomain
Since
0.7 Domains are now hold with counted pointers and no more only aliased. The problem was related to returning sets with a locally constructed domain. With CountedPtr, you are sure that the domain remains valid during the lifetime of your set.

Definition at line 80 of file DigitalSetBySTLVector.h.

Member Typedef Documentation

◆ ConstIterator

template<typename TDomain >
typedef std::vector<Point>::const_iterator DGtal::DigitalSetBySTLVector< TDomain >::ConstIterator

Definition at line 90 of file DigitalSetBySTLVector.h.

◆ Container

template<typename TDomain >
typedef std::vector<Point> DGtal::DigitalSetBySTLVector< TDomain >::Container

Definition at line 88 of file DigitalSetBySTLVector.h.

◆ Domain

template<typename TDomain >
typedef TDomain DGtal::DigitalSetBySTLVector< TDomain >::Domain

Definition at line 83 of file DigitalSetBySTLVector.h.

◆ Iterator

template<typename TDomain >
typedef std::vector<Point>::iterator DGtal::DigitalSetBySTLVector< TDomain >::Iterator

Definition at line 89 of file DigitalSetBySTLVector.h.

◆ MutableIterator

template<typename TDomain >
typedef std::vector<Point>::iterator DGtal::DigitalSetBySTLVector< TDomain >::MutableIterator

Definition at line 91 of file DigitalSetBySTLVector.h.

◆ Point

template<typename TDomain >
typedef Domain::Point DGtal::DigitalSetBySTLVector< TDomain >::Point

Definition at line 86 of file DigitalSetBySTLVector.h.

◆ Self

template<typename TDomain >
typedef DigitalSetBySTLVector<Domain> DGtal::DigitalSetBySTLVector< TDomain >::Self

Definition at line 84 of file DigitalSetBySTLVector.h.

◆ Size

template<typename TDomain >
typedef Domain::Size DGtal::DigitalSetBySTLVector< TDomain >::Size

Definition at line 87 of file DigitalSetBySTLVector.h.

◆ Space

template<typename TDomain >
typedef Domain::Space DGtal::DigitalSetBySTLVector< TDomain >::Space

Definition at line 85 of file DigitalSetBySTLVector.h.

Constructor & Destructor Documentation

◆ ~DigitalSetBySTLVector()

template<typename TDomain >
DGtal::DigitalSetBySTLVector< TDomain >::~DigitalSetBySTLVector ( )

Destructor.

◆ DigitalSetBySTLVector() [1/3]

template<typename TDomain >
DGtal::DigitalSetBySTLVector< TDomain >::DigitalSetBySTLVector ( Clone< Domain d)

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

Parameters
dany domain.

◆ DigitalSetBySTLVector() [2/3]

template<typename TDomain >
DGtal::DigitalSetBySTLVector< TDomain >::DigitalSetBySTLVector ( const DigitalSetBySTLVector< TDomain > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ DigitalSetBySTLVector() [3/3]

template<typename TDomain >
DGtal::DigitalSetBySTLVector< TDomain >::DigitalSetBySTLVector ( )
protected

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

Member Function Documentation

◆ assignFromComplement()

template<typename TDomain >
void DGtal::DigitalSetBySTLVector< TDomain >::assignFromComplement ( const DigitalSetBySTLVector< Domain > &  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 >
Iterator DGtal::DigitalSetBySTLVector< TDomain >::begin ( )
Returns
an iterator on the first element in this set.

◆ begin() [2/2]

template<typename TDomain >
ConstIterator DGtal::DigitalSetBySTLVector< TDomain >::begin ( ) const
Returns
a const iterator on the first element in this set.

◆ className()

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

◆ clear()

template<typename TDomain >
void DGtal::DigitalSetBySTLVector< TDomain >::clear ( )

Clears the set.

Postcondition
this set is empty.

◆ computeBoundingBox()

template<typename TDomain >
void DGtal::DigitalSetBySTLVector< TDomain >::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 >
template<typename TOutputIterator >
void DGtal::DigitalSetBySTLVector< TDomain >::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 >
Container& DGtal::DigitalSetBySTLVector< TDomain >::container ( )

◆ container() [2/2]

template<typename TDomain >
const Container& DGtal::DigitalSetBySTLVector< TDomain >::container ( ) const

Give access to the underlying container.

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

◆ domain()

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

◆ domainPointer()

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

◆ empty()

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

◆ end() [1/2]

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

◆ end() [2/2]

template<typename TDomain >
ConstIterator DGtal::DigitalSetBySTLVector< TDomain >::end ( ) const
Returns
a const iterator on the element after the last in this set.

◆ erase() [1/3]

template<typename TDomain >
Size DGtal::DigitalSetBySTLVector< TDomain >::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 >
void DGtal::DigitalSetBySTLVector< TDomain >::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 >
void DGtal::DigitalSetBySTLVector< TDomain >::erase ( Iterator  it)

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

Parameters
itan iterator on this set.
Precondition
it should point on a valid element ( it != end() ). Note: generally faster than giving just the point.

◆ find() [1/2]

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

◆ find() [2/2]

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

◆ insert() [1/2]

template<typename TDomain >
void DGtal::DigitalSetBySTLVector< TDomain >::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 >
template<typename PointInputIterator >
void DGtal::DigitalSetBySTLVector< TDomain >::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 >
void DGtal::DigitalSetBySTLVector< TDomain >::insertNew ( const Point p)

Adds point [p] to this set if the point is not already in the set. There is no defined behavior if the point is already in the set (for instance, may be present twice).

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

◆ insertNew() [2/2]

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

Adds the collection of points specified by the two iterators to this set. The collection should contain distinct points. Each of these points should also not belong already to the set. set. There is no defined behavior if the preceding requisites are not satisfied (for instance, points may be present several times in the 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 >
bool DGtal::DigitalSetBySTLVector< TDomain >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ operator()()

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

◆ operator+=()

template<typename TDomain >
DigitalSetBySTLVector<Domain>& DGtal::DigitalSetBySTLVector< TDomain >::operator+= ( const DigitalSetBySTLVector< Domain > &  aSet)

set union to left.

Parameters
aSetany other set.

◆ operator=()

template<typename TDomain >
DigitalSetBySTLVector& DGtal::DigitalSetBySTLVector< TDomain >::operator= ( const DigitalSetBySTLVector< TDomain > &  other)

Assignment.

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

◆ selfDisplay()

template<typename TDomain >
void DGtal::DigitalSetBySTLVector< TDomain >::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 >
Size DGtal::DigitalSetBySTLVector< TDomain >::size ( ) const
Returns
the number of elements in the set.

Field Documentation

◆ myDomain

template<typename TDomain >
CowPtr<Domain> DGtal::DigitalSetBySTLVector< TDomain >::myDomain
protected

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

Definition at line 331 of file DigitalSetBySTLVector.h.

◆ myVector

template<typename TDomain >
std::vector<Point> DGtal::DigitalSetBySTLVector< TDomain >::myVector
protected

The container storing the points of the set.

Definition at line 336 of file DigitalSetBySTLVector.h.


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