DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Data Structures | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::DomainAdjacency< TDomain, TAdjacency > Class Template Reference

#include <DomainAdjacency.h>

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

Data Structures

struct  VertexMap

Public Types

typedef TDomain::Space Space
typedef TAdjacency Adjacency
typedef TDomain::Point Point
typedef TDomain Domain
typedef DomainPredicate< DomainPredicate
typedef Point Vertex
typedef Space::Size Size
typedef DigitalSetSelector
< Domain, SMALL_DS+HIGH_ITER_DS >
::Type 
VertexSet

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
Size bestCapacity () const
Size degree (const Vertex &v) const
template<typename OutputIterator >
void writeNeighbors (OutputIterator &it, const Vertex &v) const
template<typename OutputIterator , typename VertexPredicate >
void writeNeighbors (OutputIterator &it, const Vertex &v, const VertexPredicate &pred) 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:
TDomainthe type of the domain.
TAdjacencythe type of the adjacency.

Definition at line 72 of file DomainAdjacency.h.


Member Typedef Documentation

template<typename TDomain, typename TAdjacency>
typedef TAdjacency DGtal::DomainAdjacency< TDomain, TAdjacency >::Adjacency

Definition at line 80 of file DomainAdjacency.h.

template<typename TDomain, typename TAdjacency>
typedef TDomain DGtal::DomainAdjacency< TDomain, TAdjacency >::Domain

Definition at line 84 of file DomainAdjacency.h.

template<typename TDomain, typename TAdjacency>
typedef TDomain::Point DGtal::DomainAdjacency< TDomain, TAdjacency >::Point

Definition at line 81 of file DomainAdjacency.h.

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

Definition at line 85 of file DomainAdjacency.h.

template<typename TDomain, typename TAdjacency>
typedef Space::Size DGtal::DomainAdjacency< TDomain, TAdjacency >::Size

Definition at line 89 of file DomainAdjacency.h.

template<typename TDomain, typename TAdjacency>
typedef TDomain::Space DGtal::DomainAdjacency< TDomain, TAdjacency >::Space

Definition at line 79 of file DomainAdjacency.h.

template<typename TDomain, typename TAdjacency>
typedef Point DGtal::DomainAdjacency< TDomain, TAdjacency >::Vertex

Definition at line 88 of file DomainAdjacency.h.

template<typename TDomain, typename TAdjacency>
typedef DigitalSetSelector< Domain, SMALL_DS + HIGH_ITER_DS >::Type DGtal::DomainAdjacency< TDomain, TAdjacency >::VertexSet

Definition at line 91 of file DomainAdjacency.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
aDomainthe domain which restricts the given adjacency.
adjacencyany adjacency whose range contains the given domain aDomain.

Definition at line 50 of file DomainAdjacency.ih.

: myPred( aDomain ), myAdjacency( adjacency )
{
}
template<typename TDomain , typename TAdjacency >
DGtal::DomainAdjacency< TDomain, TAdjacency >::DomainAdjacency ( const DomainAdjacency< TDomain, TAdjacency > &  other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

Definition at line 59 of file DomainAdjacency.ih.

: myPred( other.myPred ), myAdjacency( other.myAdjacency )
{
}
template<typename TDomain , typename TAdjacency >
DGtal::DomainAdjacency< TDomain, TAdjacency >::~DomainAdjacency ( )
inline

Destructor.

Definition at line 44 of file DomainAdjacency.ih.

{}
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 >::Size DGtal::DomainAdjacency< TDomain, TAdjacency >::bestCapacity ( ) const
inline
Returns:
maximum number of neighbors for this adjacency

Definition at line 141 of file DomainAdjacency.ih.

References DGtal::DomainAdjacency< TDomain, TAdjacency >::bestCapacity().

Referenced by DGtal::DomainAdjacency< TDomain, TAdjacency >::bestCapacity().

{
return myAdjacency.bestCapacity();
}
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 >
DGtal::DomainAdjacency< TDomain, TAdjacency >::Size DGtal::DomainAdjacency< TDomain, TAdjacency >::degree ( const Vertex v) const
inline
Parameters:
vany vertex
Returns:
the number of neighbors of this vertex

Definition at line 155 of file DomainAdjacency.ih.

References DGtal::DomainAdjacency< TDomain, TAdjacency >::degree().

Referenced by DGtal::DomainAdjacency< TDomain, TAdjacency >::degree().

{
return myAdjacency.degree( v );
}
template<typename TDomain , typename TAdjacency >
const TDomain & DGtal::DomainAdjacency< TDomain, TAdjacency >::domain ( ) const
inline
Returns:
a const reference to the associated domain.

Definition at line 68 of file DomainAdjacency.ih.

References DGtal::DomainAdjacency< TDomain, TAdjacency >::domain().

Referenced by DGtal::DomainAdjacency< TDomain, TAdjacency >::domain().

{
return myPred.domain();
}
template<typename TDomain , typename TAdjacency >
bool DGtal::DomainAdjacency< TDomain, TAdjacency >::isAdjacentTo ( const Point p1,
const Point p2 
) const
inline
Parameters:
p1any point in this space.
p2any point in this space.
Returns:
'true' iff p1 is adjacent to p2 according to this adjacency relation.

Definition at line 86 of file DomainAdjacency.ih.

{
ASSERT( myPred( p1 ) );
ASSERT( myPred( p2 ) );
return isAdjacentTo( p1, p2 );
}
template<typename TDomain , typename TAdjacency >
bool DGtal::DomainAdjacency< TDomain, TAdjacency >::isProperlyAdjacentTo ( const Point p1,
const Point p2 
) const
inline
Parameters:
p1any point in this space.
p2any point in this space.
Returns:
'true' iff p1 is adjacent to p2 according to this adjacency relation and p1 != p2.

Definition at line 97 of file DomainAdjacency.ih.

{
ASSERT( myPred( p1 ) );
ASSERT( myPred( p2 ) );
return isProperlyAdjacentTo( p1, p2 );
}
template<typename TDomain , typename TAdjacency >
bool DGtal::DomainAdjacency< TDomain, TAdjacency >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Definition at line 117 of file DomainAdjacency.ih.

{
return true;
}
template<typename TDomain, typename TAdjacency>
DomainAdjacency& DGtal::DomainAdjacency< TDomain, TAdjacency >::operator= ( const DomainAdjacency< TDomain, TAdjacency > &  other)
private

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename TDomain , typename TAdjacency >
const DGtal::DomainAdjacency< TDomain, TAdjacency >::Predicate & DGtal::DomainAdjacency< TDomain, TAdjacency >::predicate ( ) const
inline
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.

Definition at line 77 of file DomainAdjacency.ih.

{
return myPred;
}
template<typename TDomain , typename TAdjacency >
void DGtal::DomainAdjacency< TDomain, TAdjacency >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 108 of file DomainAdjacency.ih.

{
out << "[DomainAdjacency]";
}
template<typename TDomain , typename TAdjacency >
template<typename OutputIterator >
void DGtal::DomainAdjacency< TDomain, TAdjacency >::writeNeighbors ( OutputIterator &  it,
const Vertex v 
) const
inline

Writes the neighbors of a vertex using an output iterator

Template Parameters:
OutputObjectIteratorthe type of an output iterator writing in a container of vertices.
Parameters:
itthe output iterator
vthe vertex whose neighbors will be writen

Writes the neighbors of a vertex using an output iterator

Template Parameters:
OutputObjectIteratorthe type of an output iterator writing in a container of vertices.
Parameters:
itthe output iterator
vthe vertex whose neighbors will be written

Definition at line 176 of file DomainAdjacency.ih.

References DGtal::DomainAdjacency< TDomain, TAdjacency >::writeNeighbors().

Referenced by DGtal::DomainAdjacency< TDomain, TAdjacency >::writeNeighbors().

{
//myAdjacency.writeProperNeighborhood( v, it, myPred );//writeNeighbors<OutputIterator>( v, it );
myAdjacency.writeNeighbors( it, v );
}
template<typename TDomain , typename TAdjacency >
template<typename OutputIterator , typename VertexPredicate >
void DGtal::DomainAdjacency< TDomain, TAdjacency >::writeNeighbors ( OutputIterator &  it,
const Vertex v,
const VertexPredicate &  pred 
) const

Writes the neighbors of a vertex which satisfy a predicate using an output iterator

Template Parameters:
OutputObjectIteratorthe type of an output iterator writing in a container of vertices.
VertexPredicatethe type of the predicate
Parameters:
itthe output iterator
vthe vertex whose neighbors will be written
predthe predicate that must be satisfied

Definition at line 202 of file DomainAdjacency.ih.

{
vector<Vertex> vect;
back_insert_iterator< vector<Vertex> > out_it(vect);
//myAdjacency.writeProperNeighborhood( vect, out_it, myPred );
myAdjacency.writeNeighbors( out_it, v, myPred );
for( typename vector<Vertex>::const_iterator cit = vect.begin(); cit != vect.end(); cit ++ )
{
if( pred(*cit) )
{
*it++ = *cit;
}
}
//myAdjacency.writeNeighbors<OutputIterator, VertexPredicate>( v, it, pred );
}

Field Documentation

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

The adjacency relation.

Definition at line 233 of file DomainAdjacency.h.

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

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

Definition at line 228 of file DomainAdjacency.h.


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