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

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

Collaboration diagram for DGtal::DigitalSetBySTLVector< TDomain >:
[legend]

Public Types

typedef TDomain Domain
 
typedef DigitalSetBySTLVector< DomainSelf
 
typedef Domain::Space Space
 
typedef Domain::Point Point
 
typedef Domain::Size Size
 
typedef std::vector< Point >::const_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 ()
 
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

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

Definition at line 89 of file DigitalSetBySTLVector.h.

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

Definition at line 83 of file DigitalSetBySTLVector.h.

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

Definition at line 88 of file DigitalSetBySTLVector.h.

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

Definition at line 90 of file DigitalSetBySTLVector.h.

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

Definition at line 86 of file DigitalSetBySTLVector.h.

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

Definition at line 84 of file DigitalSetBySTLVector.h.

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

Definition at line 87 of file DigitalSetBySTLVector.h.

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

Definition at line 85 of file DigitalSetBySTLVector.h.

Constructor & Destructor Documentation

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

Destructor.

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

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

Parameters
dany domain.
template<typename TDomain>
DGtal::DigitalSetBySTLVector< TDomain >::DigitalSetBySTLVector ( const DigitalSetBySTLVector< TDomain > &  other)

Copy constructor.

Parameters
otherthe object to clone.
template<typename TDomain>
DGtal::DigitalSetBySTLVector< TDomain >::DigitalSetBySTLVector ( )
protected

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

Member Function Documentation

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'.
template<typename TDomain>
ConstIterator DGtal::DigitalSetBySTLVector< TDomain >::begin ( ) const
Returns
a const iterator on the first element in this set.
template<typename TDomain>
Iterator DGtal::DigitalSetBySTLVector< TDomain >::begin ( )
Returns
an iterator on the first element in this set.
template<typename TDomain>
std::string DGtal::DigitalSetBySTLVector< TDomain >::className ( ) const
Returns
the style name used for drawing this object.
template<typename TDomain>
void DGtal::DigitalSetBySTLVector< TDomain >::clear ( )

Clears the set.

Postcondition
this set is empty.
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).
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
template<typename TDomain>
const Domain& DGtal::DigitalSetBySTLVector< TDomain >::domain ( ) const
Returns
the embedding domain.
template<typename TDomain>
CowPtr<Domain> DGtal::DigitalSetBySTLVector< TDomain >::domainPointer ( ) const
Returns
a copy-on-write pointer on the embedding domain.
template<typename TDomain>
bool DGtal::DigitalSetBySTLVector< TDomain >::empty ( ) const
Returns
'true' iff the set is empty (no element).
template<typename TDomain>
ConstIterator DGtal::DigitalSetBySTLVector< TDomain >::end ( ) const
Returns
a const iterator on the element after the last in this set.
template<typename TDomain>
Iterator DGtal::DigitalSetBySTLVector< TDomain >::end ( )
Returns
a iterator on the element after the last in this set.
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).
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.
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.
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().
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().
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.
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.
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.
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.
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.
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.
template<typename TDomain>
DigitalSetBySTLVector<Domain>& DGtal::DigitalSetBySTLVector< TDomain >::operator+= ( const DigitalSetBySTLVector< Domain > &  aSet)

set union to left.

Parameters
aSetany other set.
template<typename TDomain>
DigitalSetBySTLVector& DGtal::DigitalSetBySTLVector< TDomain >::operator= ( const DigitalSetBySTLVector< TDomain > &  other)

Assignment.

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

Field Documentation

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 323 of file DigitalSetBySTLVector.h.

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

The container storing the points of the set.

Definition at line 328 of file DigitalSetBySTLVector.h.


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