DGtal  0.9.4beta
Public Types | Public Member Functions | Protected Member Functions | Private Attributes
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace > Class Template Reference

#include <DGtal/geometry/surfaces/FunctorOnCells.h>

Public Types

typedef FunctorOnCells< TFunctorOnPoints, TKSpace > Self
 
typedef TFunctorOnPoints FunctorOnPoints
 
typedef TKSpace KSpace
 
typedef int Quantity
 
typedef FunctorOnPoints::Point Point
 
typedef FunctorOnPoints::Value Value
 
typedef KSpace::SCell Cell
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CPointFunctor< FunctorOnPoints >))
 
 FunctorOnCells (Alias< FunctorOnPoints > functor, ConstAlias< KSpace > kspace)
 
 FunctorOnCells (const FunctorOnCells &other)
 
 ~FunctorOnCells ()
 
Quantity operator() (const Cell &aCell) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
FunctorOnCellsoperator= (const FunctorOnCells &other)
 
const KSpacespace () const
 

Protected Member Functions

 FunctorOnCells ()
 

Private Attributes

FunctorOnPointsf
 
const KSpacemyKSpace
 

Detailed Description

template<typename TFunctorOnPoints, typename TKSpace>
class DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >

Aim: Convert a functor on Digital Point to a Functor on Khalimsky Cell.

Description of template class 'FunctorOnCells'

Template Parameters
TFunctorOnPointsa model of functor on Digital Points.
TKSpaceKhalimsky space in which the shape is defined.

Definition at line 70 of file FunctorOnCells.h.

Member Typedef Documentation

template<typename TFunctorOnPoints , typename TKSpace >
typedef KSpace::SCell DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Cell

Definition at line 81 of file FunctorOnCells.h.

template<typename TFunctorOnPoints , typename TKSpace >
typedef TFunctorOnPoints DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnPoints

Definition at line 76 of file FunctorOnCells.h.

template<typename TFunctorOnPoints , typename TKSpace >
typedef TKSpace DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::KSpace

Definition at line 77 of file FunctorOnCells.h.

template<typename TFunctorOnPoints , typename TKSpace >
typedef FunctorOnPoints::Point DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Point

Definition at line 79 of file FunctorOnCells.h.

template<typename TFunctorOnPoints , typename TKSpace >
typedef int DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Quantity

Definition at line 78 of file FunctorOnCells.h.

template<typename TFunctorOnPoints , typename TKSpace >
typedef FunctorOnCells<TFunctorOnPoints, TKSpace> DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Self

Definition at line 75 of file FunctorOnCells.h.

template<typename TFunctorOnPoints , typename TKSpace >
typedef FunctorOnPoints::Value DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Value

Definition at line 80 of file FunctorOnCells.h.

Constructor & Destructor Documentation

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnCells ( Alias< FunctorOnPoints functor,
ConstAlias< KSpace kspace 
)
inline

Constructor.

Parameters
[in]functora functor on digital points.
[in]kspaceKhalimsky space in which the shape is defined.

Definition at line 92 of file FunctorOnCells.h.

93  : f(&functor),
94  myKSpace(&kspace)
95  {}
const KSpace * myKSpace
Const pointor on Khalimsky Space. Used to convert Cell -> Point.
FunctorOnPoints * f
Const pointor on Functor on Points. Used on operator() to get the return value.
template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnCells ( const FunctorOnCells< TFunctorOnPoints, TKSpace > &  other)
inline

Copy constructor.

Parameters
otherthe object to clone.

Definition at line 101 of file FunctorOnCells.h.

102  : f( other.f ), myKSpace( other.myKSpace )
103  {}
const KSpace * myKSpace
Const pointor on Khalimsky Space. Used to convert Cell -> Point.
FunctorOnPoints * f
Const pointor on Functor on Points. Used on operator() to get the return value.
template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::~FunctorOnCells ( )

Destructor.

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnCells ( )
protected

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

Member Function Documentation

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CPointFunctor< FunctorOnPoints >)  )
template<typename TFunctorOnPoints , typename TKSpace >
bool DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TFunctorOnPoints , typename TKSpace >
Quantity DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::operator() ( const Cell aCell) const
inline

Call the functor on Point by converting the Cell to a Point.

Parameters
[in]aCellany cell in the Khalimsky space.
Returns
'ONE' if the point is inside the shape, 'ZERO' if it is strictly outside.

Definition at line 120 of file FunctorOnCells.h.

References DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace.

121  {
122  return ( f->operator()( myKSpace->sCoords(aCell) ) == NumberTraits< Value >::ZERO ) ? NumberTraits<Quantity>::ZERO : NumberTraits<Quantity>::ONE;
123  }
const KSpace * myKSpace
Const pointor on Khalimsky Space. Used to convert Cell -> Point.
template<typename TFunctorOnPoints , typename TKSpace >
FunctorOnCells& DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::operator= ( const FunctorOnCells< TFunctorOnPoints, TKSpace > &  other)
inline

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

Definition at line 142 of file FunctorOnCells.h.

References DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::f, and DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace.

143  {
144  if( this != &other )
145  {
146  f = other.f;
147  myKSpace = other.myKSpace;
148  }
149  return *this;
150  }
const KSpace * myKSpace
Const pointor on Khalimsky Space. Used to convert Cell -> Point.
template<typename TFunctorOnPoints , typename TKSpace >
void DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TFunctorOnPoints , typename TKSpace >
const KSpace& DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::space ( ) const
inline
Returns
the cellular grid space in which cells are defined.

Definition at line 155 of file FunctorOnCells.h.

References DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace.

156  {
157  return *myKSpace;
158  }
const KSpace * myKSpace
Const pointor on Khalimsky Space. Used to convert Cell -> Point.

Field Documentation

template<typename TFunctorOnPoints , typename TKSpace >
FunctorOnPoints* DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::f
private

Const pointor on Functor on Points. Used on operator() to get the return value.

Definition at line 165 of file FunctorOnCells.h.

Referenced by DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::operator=().

template<typename TFunctorOnPoints , typename TKSpace >
const KSpace* DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace
private

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