Data Structures | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

DGtal::DigitalSetBySTLVector< Domain > Class Template Reference

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

#include <DigitalSetBySTLVector.h>

Data Structures

struct  DefaultDrawStyle
struct  SelfDrawStyle

Public Types

typedef Domain DomainType
typedef Domain::Point Point
typedef Domain::Size Size
typedef std::vector< Point >
::iterator 
Iterator
typedef std::vector< Point >
::const_iterator 
ConstIterator

Public Member Functions

 ~DigitalSetBySTLVector ()
 DigitalSetBySTLVector (const Domain &d)
 DigitalSetBySTLVector (const DigitalSetBySTLVector &other)
DigitalSetBySTLVectoroperator= (const DigitalSetBySTLVector &other)
const Domain & domain () 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)
DigitalSetBySTLVector< Domain > computeComplement () const
void assignFromComplement (const DigitalSetBySTLVector< Domain > &other_set)
void computeBoundingBox (Point &lower, Point &upper) const
void selfDisplay (std::ostream &out) const
bool isValid () const
DrawableWithDGtalBoarddefaultStyle (std::string mode="") const
std::string styleName () const
void selfDraw (DGtalBoard &board) const
template<typename Functor >
void selfDraw (DGtalBoard &board) const

Protected Member Functions

 DigitalSetBySTLVector ()

Protected Attributes

const Domain & myDomain
std::vector< PointmyVector

Detailed Description

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

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:
Domain a realization of the concept CDomain.
See also:
CDigitalSet,CDomain

Member Typedef Documentation

template<typename Domain>
typedef std::vector<Point>::const_iterator DGtal::DigitalSetBySTLVector< Domain >::ConstIterator
template<typename Domain>
typedef Domain DGtal::DigitalSetBySTLVector< Domain >::DomainType
template<typename Domain>
typedef std::vector<Point>::iterator DGtal::DigitalSetBySTLVector< Domain >::Iterator
template<typename Domain>
typedef Domain::Point DGtal::DigitalSetBySTLVector< Domain >::Point
template<typename Domain>
typedef Domain::Size DGtal::DigitalSetBySTLVector< Domain >::Size

Constructor & Destructor Documentation

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

Destructor.

template<typename Domain>
DGtal::DigitalSetBySTLVector< Domain >::DigitalSetBySTLVector ( const Domain &  d  ) 

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

Parameters:
d any domain.
template<typename Domain>
DGtal::DigitalSetBySTLVector< Domain >::DigitalSetBySTLVector ( const DigitalSetBySTLVector< Domain > &  other  ) 

Copy constructor.

Parameters:
other the object to clone.
template<typename Domain>
DGtal::DigitalSetBySTLVector< Domain >::DigitalSetBySTLVector (  )  [protected]

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


Member Function Documentation

template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::assignFromComplement ( const DigitalSetBySTLVector< Domain > &  other_set  ) 

Builds the complement in the domain of the set [other_set] in this.

Parameters:
other_set defines the set whose complement is assigned to 'this'.
template<typename Domain>
ConstIterator DGtal::DigitalSetBySTLVector< Domain >::begin (  )  const
Returns:
a const iterator on the first element in this set.
template<typename Domain>
Iterator DGtal::DigitalSetBySTLVector< Domain >::begin (  ) 
Returns:
an iterator on the first element in this set.
template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::clear (  ) 

Clears the set.

Postcondition:
this set is empty.
template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::computeBoundingBox ( Point lower,
Point upper 
) const

Computes the bounding box of this set.

Parameters:
lower the first point of the bounding box (lowest in all directions).
upper the last point of the bounding box (highest in all directions).
template<typename Domain>
DigitalSetBySTLVector<Domain> DGtal::DigitalSetBySTLVector< Domain >::computeComplement (  )  const
Returns:
the complement of this set in the domain.

NB: be aware of the overhead cost when returning the object.

template<typename Domain>
DrawableWithDGtalBoard* DGtal::DigitalSetBySTLVector< Domain >::defaultStyle ( std::string  mode = ""  )  const

Default drawing style object.

Returns:
the dyn. alloc. default style for this object.
template<typename Domain>
const Domain& DGtal::DigitalSetBySTLVector< Domain >::domain (  )  const
Returns:
the embedding domain.
template<typename Domain>
bool DGtal::DigitalSetBySTLVector< Domain >::empty (  )  const
Returns:
'true' iff the set is empty (no element).
template<typename Domain>
ConstIterator DGtal::DigitalSetBySTLVector< Domain >::end (  )  const
Returns:
a const iterator on the element after the last in this set.
template<typename Domain>
Iterator DGtal::DigitalSetBySTLVector< Domain >::end (  ) 
Returns:
a iterator on the element after the last in this set.
template<typename Domain>
Size DGtal::DigitalSetBySTLVector< Domain >::erase ( const Point p  ) 

Removes point [p] from the set.

Parameters:
p the point to remove.
Returns:
the number of removed elements (0 or 1).
template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::erase ( Iterator  it  ) 

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

Parameters:
it an iterator on this set.
Precondition:
it should point on a valid element ( it != end() ). Note: generally faster than giving just the point.
template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::erase ( Iterator  first,
Iterator  last 
)

Removes the collection of points specified by the two iterators from this set.

Parameters:
first the start point in this set.
last the last point in this set.
template<typename Domain>
ConstIterator DGtal::DigitalSetBySTLVector< Domain >::find ( const Point p  )  const
Parameters:
p any digital point.
Returns:
a const iterator pointing on [p] if found, otherwise end().
template<typename Domain>
Iterator DGtal::DigitalSetBySTLVector< Domain >::find ( const Point p  ) 
Parameters:
p any digital point.
Returns:
an iterator pointing on [p] if found, otherwise end().
template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::insert ( const Point p  ) 

Adds point [p] to this set.

Parameters:
p any digital point.
Precondition:
p should belong to the associated domain.
template<typename Domain>
template<typename PointInputIterator >
void DGtal::DigitalSetBySTLVector< Domain >::insert ( PointInputIterator  first,
PointInputIterator  last 
)

Adds the collection of points specified by the two iterators to this set.

Parameters:
first the start point in the collection of Point.
last the last point in the collection of Point.
Precondition:
all points should belong to the associated domain.
template<typename Domain>
template<typename PointInputIterator >
void DGtal::DigitalSetBySTLVector< Domain >::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:
first the start point in the collection of Point.
last the 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 Domain>
void DGtal::DigitalSetBySTLVector< Domain >::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:
p any digital point.
Precondition:
p should belong to the associated domain.
p should not belong to this.
template<typename Domain>
bool DGtal::DigitalSetBySTLVector< Domain >::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename Domain>
DigitalSetBySTLVector<Domain>& DGtal::DigitalSetBySTLVector< Domain >::operator+= ( const DigitalSetBySTLVector< Domain > &  aSet  ) 

set union to left.

Parameters:
aSet any other set.
template<typename Domain>
DigitalSetBySTLVector& DGtal::DigitalSetBySTLVector< Domain >::operator= ( const DigitalSetBySTLVector< Domain > &  other  ) 

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'.
template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::selfDisplay ( std::ostream &  out  )  const

Writes/Displays the object on an output stream.

Parameters:
out the output stream where the object is written.
template<typename Domain>
void DGtal::DigitalSetBySTLVector< Domain >::selfDraw ( DGtalBoard board  )  const

Draw the object on a DGtalBoard board.

Parameters:
board the output board where the object is drawn.
template<typename Domain>
template<typename Functor >
void DGtal::DigitalSetBySTLVector< Domain >::selfDraw ( DGtalBoard board  )  const

Draw the object on a LiBoard board

Parameters:
board the output board where the object is drawn.
Template Parameters:
Functor a Functor to specialize the Board style
template<typename Domain>
Size DGtal::DigitalSetBySTLVector< Domain >::size (  )  const
Returns:
the number of elements in the set.
template<typename Domain>
std::string DGtal::DigitalSetBySTLVector< Domain >::styleName (  )  const
Returns:
the style name used for drawing this object.

Field Documentation

template<typename Domain>
const Domain& DGtal::DigitalSetBySTLVector< Domain >::myDomain [protected]

The associated domain.

template<typename Domain>
std::vector<Point> DGtal::DigitalSetBySTLVector< Domain >::myVector [protected]

The container storing the points of the set.


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