DGtal 1.4.0
|
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user. It is thus very close to the STL concept of simple associative container (like set std::set<Point>), except that there is a notion of maximal set of points (the whole domain). More...
#include <DGtal/kernel/sets/CDigitalSet.h>
Public Types | |
typedef T::Domain | Domain |
typedef T::Point | Point |
typedef T::Size | Size |
typedef T::Iterator | Iterator |
typedef T::ConstIterator | ConstIterator |
Public Types inherited from DGtal::concepts::CPointPredicate< T > | |
typedef T::Point | Point |
Public Types inherited from DGtal::concepts::CPredicate< T, T::Point > | |
typedef T::Point | Element |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CDomain< Domain >)) | |
BOOST_CONCEPT_ASSERT ((boost_concepts::ReadableIteratorConcept< ConstIterator >)) | |
BOOST_CONCEPT_ASSERT ((boost_concepts::SinglePassIteratorConcept< ConstIterator >)) | |
BOOST_CONCEPT_USAGE (CDigitalSet) | |
void | checkConstConstraints () const |
void | checkNonConstConstraints () |
Public Member Functions inherited from DGtal::concepts::CPointPredicate< T > | |
BOOST_CONCEPT_ASSERT ((CUnaryFunctor< T, Point, bool >)) | |
Public Member Functions inherited from DGtal::concepts::CUnaryFunctor< T, T::Point, bool > | |
BOOST_CONCEPT_USAGE (CUnaryFunctor) | |
Private Attributes | |
T | myX |
Domain | myDomain |
CowPtr< Domain > | myDomainPtr |
Size | mySize |
bool | myBool |
Point | myPoint |
Iterator | myIterator |
ConstIterator | myConstIterator |
Point * | myOutputIt |
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user. It is thus very close to the STL concept of simple associative container (like set std::set<Point>), except that there is a notion of maximal set of points (the whole domain).
Description of concept 'CDigitalSet'
Domain:
the domain in which points are defined, a model of concept CDomain.Size:
the type for couting elements of the set.Iterator:
the iterator type for visiting elements of the set, as well as modify the set. The iterator should be readable (model of boost_concepts::ReadableIteratorConcept) and should allow single pass traversal (model of boost_concepts::SinglePassIteratorConcept). Its value has type Point
(defined in concepts::CPointPredicate).ConstIterator:
the type for visiting elements of the set. Note that types for Iterator and ConstIterator should be the same, similarly to STL simple associative containers.X
: A type that is a model of CDigitalSetX
Point
Iterator
Name | Expression | Type requirements | Return type | Precondition | Semantics | Post condition | Complexity |
---|---|---|---|---|---|---|---|
Get domain | x.domain() | Domain | returns the domain of this set | O(1), should be returned by reference | |||
Get counted pointer on domain | x.domainPointer() | CountedPtr<Domain> | returns a counted pointer on the domain of this set | O(1) | |||
Number of elements | x.size() | Size | returns the number of elements of this set. | at most linear in the number of elements | |||
Empty container test | x.empty() | bool | returns true iff the number of elements is zero, always faster than x.size() == 0 | amortized constant time | |||
Insert point | x.insert( p ) | Inserts point p in the set | |||||
Insert new point | x.insertNew( p ) | p is not already in x | Inserts point p in the set, assuming it is not already inside | faster than insert | |||
Erase point | x.erase( p ) | Size | Erase point p from the set x, returns the number of points effectively removed from the set (thus either 0 or 1) | ||||
Erase point from iterator | x.erase( it ) | it != x.end() | Erase the point pointed by valid iterator it from the set x | ||||
Removes all points | x.clear() | Removes all the points from the set x, x.empty() is true afterwards | |||||
Get iterator on first element | x.begin() | Iterator | Returns the iterator on the first element of the set | Constant time. | |||
Get iterator after the last element | x.end() | Iterator | Returns the iterator after the last element of the set | Constant time. | |||
Get iterator on first element | x.begin() | ConstIterator | Returns the const iterator on the first element of the set | Constant time. | |||
Get iterator after the last element | x.end() | ConstIterator | Returns the const iterator after the last element of the set | Constant time. | |||
Set union to left | x += y | X & | Elements of y should be included in the domain of x | Adds all elements of y to x. Returns a reference to itself. | |||
Complement of set | x.computeComplement(outIt) | outIt is an output iterator on Point | Outputs the complement set of x in the given output iterator. | ||||
Complement of set | x.assignFromComplement(y) | Domain of x should contain the domain of y | The set x is the complement of set y afterwards. | ||||
Bounding box | x.computeBoundingBox(p1,p2) | Points p1 and p2 define respectively the lower and upper bound of the bounding box of all points of x. | Linear in x.size() | ||||
Search point | x.find( p ) | Iterator | Returns an iterator pointing on point p if it was found in the set x, or x.end() otherwise. | ||||
Search point | x.find( p ) | ConstIterator | Returns a const iterator pointing on point p if it was found in the set x, or x.end() otherwise. |
T | the type that should be a model of CDigitalSet. |
Definition at line 138 of file CDigitalSet.h.
typedef T::ConstIterator DGtal::concepts::CDigitalSet< T >::ConstIterator |
Definition at line 149 of file CDigitalSet.h.
typedef T::Domain DGtal::concepts::CDigitalSet< T >::Domain |
Definition at line 145 of file CDigitalSet.h.
typedef T::Iterator DGtal::concepts::CDigitalSet< T >::Iterator |
Definition at line 148 of file CDigitalSet.h.
typedef T::Point DGtal::concepts::CDigitalSet< T >::Point |
Definition at line 146 of file CDigitalSet.h.
typedef T::Size DGtal::concepts::CDigitalSet< T >::Size |
Definition at line 147 of file CDigitalSet.h.
DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_ASSERT | ( | (boost_concepts::ReadableIteratorConcept< ConstIterator >) | ) |
DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_ASSERT | ( | (boost_concepts::SinglePassIteratorConcept< ConstIterator >) | ) |
DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_ASSERT | ( | (concepts::CDomain< Domain >) | ) |
|
inline |
Definition at line 156 of file CDigitalSet.h.
References DGtal::concepts::CDigitalSet< T >::checkConstConstraints(), and DGtal::concepts::CDigitalSet< T >::checkNonConstConstraints().
|
inline |
This method checks const methods when a non-const version exist.
Definition at line 164 of file CDigitalSet.h.
References DGtal::concepts::CDigitalSet< T >::myBool, DGtal::concepts::CDigitalSet< T >::myConstIterator, DGtal::concepts::CDigitalSet< T >::myDomain, DGtal::concepts::CDigitalSet< T >::myDomainPtr, DGtal::concepts::CDigitalSet< T >::myPoint, DGtal::concepts::CDigitalSet< T >::mySize, DGtal::concepts::CDigitalSet< T >::myX, and DGtal::concepts::ConceptUtils::sameType().
Referenced by DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_USAGE().
|
inline |
This method checks non-const methods when a const version exist.
Definition at line 179 of file CDigitalSet.h.
References DGtal::concepts::CDigitalSet< T >::myIterator, DGtal::concepts::CDigitalSet< T >::myOutputIt, DGtal::concepts::CDigitalSet< T >::myPoint, DGtal::concepts::CDigitalSet< T >::mySize, DGtal::concepts::CDigitalSet< T >::myX, and DGtal::concepts::ConceptUtils::sameType().
Referenced by DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_USAGE().
|
private |
Definition at line 207 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkConstConstraints().
|
private |
Definition at line 210 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkConstConstraints().
|
private |
Definition at line 204 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkConstConstraints().
|
private |
Definition at line 205 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkConstConstraints().
|
private |
Definition at line 209 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkNonConstConstraints().
|
private |
Definition at line 211 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkNonConstConstraints().
|
private |
Definition at line 208 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkConstConstraints(), and DGtal::concepts::CDigitalSet< T >::checkNonConstConstraints().
|
private |
Definition at line 206 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkConstConstraints(), and DGtal::concepts::CDigitalSet< T >::checkNonConstConstraints().
|
private |
Definition at line 203 of file CDigitalSet.h.
Referenced by DGtal::concepts::CDigitalSet< T >::checkConstConstraints(), and DGtal::concepts::CDigitalSet< T >::checkNonConstConstraints().