Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DGtal::DomainAdjacency< TDomain, TAdjacency > Class Template Reference

Aim: Given a domain and an adjacency, limits the given adjacency to the specified domain for all adjacency and neighborhood computations. More...

#include <DomainAdjacency.h>

Inheritance diagram for DGtal::DomainAdjacency< TDomain, TAdjacency >:
Inheritance graph
[legend]
Collaboration diagram for DGtal::DomainAdjacency< TDomain, TAdjacency >:
Collaboration graph
[legend]

Public Types

typedef TDomain::Space Space
typedef TAdjacency Adjacency
typedef TDomain::Point Point
typedef TDomain Domain
typedef DomainPredicate< DomainPredicate

Public Member Functions

 DomainAdjacency (const Domain &aDomain, const Adjacency &adjacency)
 DomainAdjacency (const DomainAdjacency &other)
 ~DomainAdjacency ()
const Domaindomain () const
const Predicatepredicate () const
bool isAdjacentTo (const Point &p1, const Point &p2) const
bool isProperlyAdjacentTo (const Point &p1, const Point &p2) const
template<typename OutputIterator , typename PointPredicate >
void writeNeighborhood (const Point &p, OutputIterator &out_it, const PointPredicate &pred) const
template<typename OutputIterator >
void writeNeighborhood (const Point &p, OutputIterator &out_it) const
template<typename OutputIterator , typename PointPredicate >
void writeProperNeighborhood (const Point &p, OutputIterator &out_it, const PointPredicate &pred) const
template<typename OutputIterator >
void writeProperNeighborhood (const Point &p, OutputIterator &out_it) const
void selfDisplay (std::ostream &out) const
bool isValid () const

Protected Member Functions

 DomainAdjacency ()

Private Member Functions

 BOOST_CONCEPT_ASSERT ((CDomain< TDomain >))
 BOOST_CONCEPT_ASSERT ((CAdjacency< TAdjacency >))
DomainAdjacencyoperator= (const DomainAdjacency &other)

Private Attributes

Predicate myPred
const AdjacencymyAdjacency

Detailed Description

template<typename TDomain, typename TAdjacency>
class DGtal::DomainAdjacency< TDomain, TAdjacency >

Aim: Given a domain and an adjacency, limits the given adjacency to the specified domain for all adjacency and neighborhood computations.

Description of template class 'DomainAdjacency'

This class is useful for limiting adjacencies that are defined for unlimited spaces.

Model of CAdjacency.

Template Parameters:
TDomain the type of the domain.
TAdjacency the type of the adjacency.

Member Typedef Documentation

template<typename TDomain, typename TAdjacency>
typedef TAdjacency DGtal::DomainAdjacency< TDomain, TAdjacency >::Adjacency
template<typename TDomain, typename TAdjacency>
typedef TDomain DGtal::DomainAdjacency< TDomain, TAdjacency >::Domain
template<typename TDomain, typename TAdjacency>
typedef TDomain::Point DGtal::DomainAdjacency< TDomain, TAdjacency >::Point
template<typename TDomain, typename TAdjacency>
typedef DomainPredicate< Domain > DGtal::DomainAdjacency< TDomain, TAdjacency >::Predicate
template<typename TDomain, typename TAdjacency>
typedef TDomain::Space DGtal::DomainAdjacency< TDomain, TAdjacency >::Space

Constructor & Destructor Documentation

template<typename TDomain, typename TAdjacency>
DGtal::DomainAdjacency< TDomain, TAdjacency >::DomainAdjacency ( const Domain aDomain,
const Adjacency adjacency 
)

Constructor.

template<typename TDomain, typename TAdjacency>
DGtal::DomainAdjacency< TDomain, TAdjacency >::DomainAdjacency ( const DomainAdjacency< TDomain, TAdjacency > &  other  ) 

Copy constructor.

Parameters:
other the object to clone.
template<typename TDomain, typename TAdjacency>
DGtal::DomainAdjacency< TDomain, TAdjacency >::~DomainAdjacency (  ) 

Destructor.

template<typename TDomain, typename TAdjacency>
DGtal::DomainAdjacency< TDomain, TAdjacency >::DomainAdjacency (  )  [protected]

Constructor. Forbidden by default (protected to avoid g++ warnings).


Member Function Documentation

template<typename TDomain, typename TAdjacency>
DGtal::DomainAdjacency< TDomain, TAdjacency >::BOOST_CONCEPT_ASSERT ( (CDomain< TDomain >)   )  [private]
template<typename TDomain, typename TAdjacency>
DGtal::DomainAdjacency< TDomain, TAdjacency >::BOOST_CONCEPT_ASSERT ( (CAdjacency< TAdjacency >)   )  [private]
template<typename TDomain, typename TAdjacency>
const Domain& DGtal::DomainAdjacency< TDomain, TAdjacency >::domain (  )  const
Returns:
a const reference to the associated domain.
template<typename TDomain, typename TAdjacency>
bool DGtal::DomainAdjacency< TDomain, TAdjacency >::isAdjacentTo ( const Point p1,
const Point p2 
) const
Parameters:
p1 any point in this space.
p2 any point in this space.
Returns:
'true' iff p1 is adjacent to p2 according to this adjacency relation.
template<typename TDomain, typename TAdjacency>
bool DGtal::DomainAdjacency< TDomain, TAdjacency >::isProperlyAdjacentTo ( const Point p1,
const Point p2 
) const
Parameters:
p1 any point in this space.
p2 any point in this space.
Returns:
'true' iff p1 is adjacent to p2 according to this adjacency relation and p1 != p2.
template<typename TDomain, typename TAdjacency>
bool DGtal::DomainAdjacency< TDomain, TAdjacency >::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename TDomain, typename TAdjacency>
DomainAdjacency& DGtal::DomainAdjacency< TDomain, TAdjacency >::operator= ( const DomainAdjacency< TDomain, TAdjacency > &  other  )  [private]

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename TDomain, typename TAdjacency>
const Predicate& DGtal::DomainAdjacency< TDomain, TAdjacency >::predicate (  )  const
Returns:
a const reference on the predicate which can check if a given point belongs to the domain.

Useful if you want to restrict your neighborhood.

template<typename TDomain, typename TAdjacency>
void DGtal::DomainAdjacency< TDomain, TAdjacency >::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 TDomain, typename TAdjacency>
template<typename OutputIterator >
void DGtal::DomainAdjacency< TDomain, TAdjacency >::writeNeighborhood ( const Point p,
OutputIterator &  out_it 
) const

Outputs the whole neighborhood of point [p] (restricted to this domain) as a sequence of *out_it++ = ...

Template Parameters:
OutputIterator any output iterator (like std::back_insert_iterator< std::vector<int> >).
Parameters:
p any point of this space.
out_it any output iterator.
template<typename TDomain, typename TAdjacency>
template<typename OutputIterator , typename PointPredicate >
void DGtal::DomainAdjacency< TDomain, TAdjacency >::writeNeighborhood ( const Point p,
OutputIterator &  out_it,
const PointPredicate &  pred 
) const

Outputs the whole neighborhood of point [p] satisfying the given predicate as a sequence of *out_it++ = ...

Template Parameters:
OutputIterator any output iterator (like std::back_insert_iterator< std::vector<int> >).
PointPredicate any predicate object.
Parameters:
p any point of this space.
out_it any output iterator.
pred the predicate.

NB: It is up to the user to add a predicate to guarantee that the neighborhood is included in the domain. To do so, you may just mix your predicate with the object predicate() with a BinaryPointPredicate AND.

template<typename TDomain, typename TAdjacency>
template<typename OutputIterator >
void DGtal::DomainAdjacency< TDomain, TAdjacency >::writeProperNeighborhood ( const Point p,
OutputIterator &  out_it 
) const

Outputs the whole neighborhood of point [p] (except p itself, restricted to this domain) as a sequence of *out_it++ = ...

Template Parameters:
OutputIterator any output iterator (like std::back_insert_iterator< std::vector<int> >).
Parameters:
p any point of this space.
out_it any output iterator.
template<typename TDomain, typename TAdjacency>
template<typename OutputIterator , typename PointPredicate >
void DGtal::DomainAdjacency< TDomain, TAdjacency >::writeProperNeighborhood ( const Point p,
OutputIterator &  out_it,
const PointPredicate &  pred 
) const

Outputs the whole neighborhood of point [p] (except p itself) satisfying the given predicate as a sequence of *out_it++ = ...

Template Parameters:
OutputIterator any output iterator (like std::back_insert_iterator< std::vector<int> >).
PointPredicate any predicate object
Parameters:
p any point of this space.
out_it any output iterator.
pred the predicate.

NB: It is up to the user to add a predicate to guarantee that the neighborhood is included in the domain. To do so, you may just mix your predicate with the object predicate() with a BinaryPointPredicate AND.


Field Documentation

template<typename TDomain, typename TAdjacency>
const Adjacency& DGtal::DomainAdjacency< TDomain, TAdjacency >::myAdjacency [private]

The adjacency relation.

template<typename TDomain, typename TAdjacency>
Predicate DGtal::DomainAdjacency< TDomain, TAdjacency >::myPred [private]

The predicate for testing if a point belongs to the domain.


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