DGtal  0.9.4beta
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy > Class Template Reference

#include <DGtal/images/ImageCache.h>

Public Types

typedef ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy > Self
 
typedef TImageContainer ImageContainer
 
typedef ImageContainer::Domain Domain
 
typedef ImageContainer::Point Point
 
typedef ImageContainer::Value Value
 
typedef TImageFactory ImageFactory
 
typedef TReadPolicy ReadPolicy
 
typedef TWritePolicy WritePolicy
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CImage< TImageContainer >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CImageFactory< TImageFactory >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CImageCacheReadPolicy< TReadPolicy >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CImageCacheWritePolicy< TWritePolicy >))
 
 ImageCache (Alias< ImageFactory > anImageFactory, Alias< ReadPolicy > aReadPolicy, Alias< WritePolicy > aWritePolicy)
 
 ~ImageCache ()
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
bool read (const Point &aPoint, Value &aValue) const
 
ImageContainergetPage (const Domain &aDomain) const
 
bool write (const Point &aPoint, const Value &aValue)
 
void update (const Domain &aDomain)
 
unsigned int getCacheMissRead ()
 
unsigned int getCacheMissWrite ()
 
void incCacheMissRead ()
 
void incCacheMissWrite ()
 
void clearCacheAndResetCacheMisses ()
 

Protected Attributes

ImageFactorymyImageFactoryPtr
 
ReadPolicymyReadPolicy
 
WritePolicymyWritePolicy
 

Private Member Functions

 ImageCache (const ImageCache &other)
 
ImageCacheoperator= (const ImageCache &other)
 

Private Attributes

unsigned int cacheMissRead
 
unsigned int cacheMissWrite
 

Detailed Description

template<typename TImageContainer, typename TImageFactory, typename TReadPolicy, typename TWritePolicy>
class DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >

Aim: implements an images cache with 'read and write' policies.

Description of template class 'ImageCache'

Template Parameters
TImageContaineran image container type (model of CImage).
TImageFactoryan image factory type (model of CImageFactory).
TReadPolicyan image cache read policy class (model of CImageCacheReadPolicy).
TWritePolicyan image cache write policy class (model of CImageCacheWritePolicy).

The cache provides 3 functions:

Definition at line 77 of file ImageCache.h.

Member Typedef Documentation

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef ImageContainer::Domain DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Domain

Definition at line 93 of file ImageCache.h.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef TImageContainer DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageContainer

Types copied from the container.

Definition at line 92 of file ImageCache.h.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef TImageFactory DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageFactory

Definition at line 97 of file ImageCache.h.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef ImageContainer::Point DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Point

Definition at line 94 of file ImageCache.h.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef TReadPolicy DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ReadPolicy

Definition at line 99 of file ImageCache.h.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef ImageCache<TImageContainer, TImageFactory, TReadPolicy, TWritePolicy> DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Self

Definition at line 83 of file ImageCache.h.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef ImageContainer::Value DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Value

Definition at line 95 of file ImageCache.h.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
typedef TWritePolicy DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::WritePolicy

Definition at line 100 of file ImageCache.h.

Constructor & Destructor Documentation

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageCache ( Alias< ImageFactory anImageFactory,
Alias< ReadPolicy aReadPolicy,
Alias< WritePolicy aWritePolicy 
)
inline

Constructor.

Parameters
anImageFactoryalias on the image factory (see ImageFactoryFromImage or ImageFactoryFromHDF5).
aReadPolicya read policy.
aWritePolicya write policy.

Definition at line 112 of file ImageCache.h.

References DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissRead, DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissWrite, and DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::myReadPolicy.

112  :
113  myImageFactoryPtr(&anImageFactory), myReadPolicy(&aReadPolicy), myWritePolicy(&aWritePolicy)
114  {
115  myReadPolicy->clearCache();
116 
117  cacheMissRead = 0;
118  cacheMissWrite = 0;
119  }
ImageFactory * myImageFactoryPtr
Alias on the image factory.
Definition: ImageCache.h:254
ReadPolicy * myReadPolicy
Specialized caches.
Definition: ImageCache.h:257
WritePolicy * myWritePolicy
Definition: ImageCache.h:258
unsigned int cacheMissWrite
Definition: ImageCache.h:264
unsigned int cacheMissRead
cache miss values
Definition: ImageCache.h:263
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::~ImageCache ( )
inline

Destructor. Does nothing

Definition at line 125 of file ImageCache.h.

126  {
127  }
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageCache ( const ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy > &  other)
private

Member Function Documentation

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT ( (concepts::CImage< TImageContainer >)  )

Checking concepts.

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT ( (concepts::CImageFactory< TImageFactory >)  )
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT ( (concepts::CImageCacheReadPolicy< TReadPolicy >)  )
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT ( (concepts::CImageCacheWritePolicy< TWritePolicy >)  )
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::clearCacheAndResetCacheMisses ( )
inline
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
unsigned int DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::getCacheMissRead ( )
inline
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
unsigned int DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::getCacheMissWrite ( )
inline
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
ImageContainer* DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::getPage ( const Domain aDomain) const

Get the alias on the image that matchs the domain aDomain or NULL if no image in the cache matchs the domain aDomain.

Parameters
aDomainthe domain.
Returns
the alias on the image container or NULL pointer.

Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::findTileFromBlockCoords().

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::incCacheMissRead ( )
inline
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::incCacheMissWrite ( )
inline
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
bool DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 156 of file ImageCache.h.

References DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::myImageFactoryPtr.

Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::isValid().

157  {
158  return (myImageFactoryPtr->isValid());
159  }
ImageFactory * myImageFactoryPtr
Alias on the image factory.
Definition: ImageCache.h:254
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
ImageCache& DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::operator= ( const ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy > &  other)
private
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
bool DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::read ( const Point aPoint,
Value aValue 
) const

Get the value of an image from cache at a given position given by aPoint only if aPoint belongs to an image from cache.

Parameters
aPointthe point.
aValuethe value returned.
Returns
'true' if aPoint belongs to an image from cache, 'false' otherwise.

Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::operator()().

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::update ( const Domain aDomain)
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
bool DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::write ( const Point aPoint,
const Value aValue 
)

Set a value on an image from cache at a given position given by aPoint only if aPoint belongs to an image from cache.

Parameters
aPointthe point.
aValuethe value returned.
Returns
'true' if aPoint belongs to an image from cache, 'false' otherwise.

Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::setValue().

Field Documentation

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
unsigned int DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissRead
private
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
unsigned int DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissWrite
private
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
ImageFactory* DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::myImageFactoryPtr
protected

Alias on the image factory.

Default constructor.

Definition at line 254 of file ImageCache.h.

Referenced by DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::isValid().

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
ReadPolicy* DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::myReadPolicy
protected
template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
WritePolicy* DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::myWritePolicy
protected

Definition at line 258 of file ImageCache.h.


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