DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes
DGtal::concepts::CDigitalSet< T > Struct Template Reference

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

Inheritance diagram for DGtal::concepts::CDigitalSet< T >:
[legend]
Collaboration diagram for DGtal::concepts::CDigitalSet< T >:
[legend]

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

myX
 
Domain myDomain
 
CowPtr< DomainmyDomainPtr
 
Size mySize
 
bool myBool
 
Point myPoint
 
Iterator myIterator
 
ConstIterator myConstIterator
 
PointmyOutputIt
 

Detailed Description

template<typename T>
struct DGtal::concepts::CDigitalSet< T >

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'

Refinement of

Todo:
add boost::Container ? Not for now, since coding style do not match with STL (e.g. Iterator instead of iterator).
Note
It is also a refinement of boost::Assignable from concepts::CPointPredicate.

Associated types :

Notation

Definitions

Valid expressions and semantics

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.

Invariants

Models

Notes

Template Parameters
Tthe type that should be a model of CDigitalSet.

Definition at line 138 of file CDigitalSet.h.

Member Typedef Documentation

template<typename T >
typedef T::ConstIterator DGtal::concepts::CDigitalSet< T >::ConstIterator

Definition at line 149 of file CDigitalSet.h.

template<typename T >
typedef T::Domain DGtal::concepts::CDigitalSet< T >::Domain

Definition at line 145 of file CDigitalSet.h.

template<typename T >
typedef T::Iterator DGtal::concepts::CDigitalSet< T >::Iterator

Definition at line 148 of file CDigitalSet.h.

template<typename T >
typedef T::Point DGtal::concepts::CDigitalSet< T >::Point

Definition at line 146 of file CDigitalSet.h.

template<typename T >
typedef T::Size DGtal::concepts::CDigitalSet< T >::Size

Definition at line 147 of file CDigitalSet.h.

Member Function Documentation

template<typename T >
DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< Domain >)  )
template<typename T >
DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_ASSERT ( (boost_concepts::ReadableIteratorConcept< ConstIterator >)  )
template<typename T >
DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_ASSERT ( (boost_concepts::SinglePassIteratorConcept< ConstIterator >)  )
template<typename T >
DGtal::concepts::CDigitalSet< T >::BOOST_CONCEPT_USAGE ( CDigitalSet< T >  )
inline
template<typename T >
void DGtal::concepts::CDigitalSet< T >::checkConstConstraints ( ) const
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().

template<typename T >
void DGtal::concepts::CDigitalSet< T >::checkNonConstConstraints ( )
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().

180  {
181  myX.insert( myPoint );
182  // template <typename PointInputIterator>
183  // BOOST_CONCEPT_REQUIRES
184  // ( ((boost::InputIterator<PointInputIterator>)),
185  // (void) )
186  // myX.insert( PointInputIterator, PointInputIterator );
187  myX.insertNew( myPoint );
189  myX.erase( myIterator );
190  myX.erase( myIterator, myIterator );
191  myX.clear();
192  ConceptUtils::sameType( myX, myX.operator+=( myX ) );
193  myX.computeComplement( myOutputIt );
194  myX.assignFromComplement( myX );
195  myX.computeBoundingBox( myPoint, myPoint );
199  }
void sameType(const T &t1, const T &t2)

Field Documentation

template<typename T >
bool DGtal::concepts::CDigitalSet< T >::myBool
private
template<typename T >
ConstIterator DGtal::concepts::CDigitalSet< T >::myConstIterator
private
template<typename T >
Domain DGtal::concepts::CDigitalSet< T >::myDomain
private
template<typename T >
CowPtr<Domain> DGtal::concepts::CDigitalSet< T >::myDomainPtr
private
template<typename T >
Iterator DGtal::concepts::CDigitalSet< T >::myIterator
private
template<typename T >
Point* DGtal::concepts::CDigitalSet< T >::myOutputIt
private
template<typename T >
Point DGtal::concepts::CDigitalSet< T >::myPoint
private
template<typename T >
Size DGtal::concepts::CDigitalSet< T >::mySize
private
template<typename T >
T DGtal::concepts::CDigitalSet< T >::myX
private

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