DGtal  1.5.beta
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy > Class Template Reference

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

#include <DGtal/images/ImageCache.h>

Public Types

typedef ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy > Self
 
typedef TImageContainer ImageContainer
 Types copied from the container. More...
 
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 >))
 Checking concepts. More...
 
 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
 Alias on the image factory. More...
 
ReadPolicymyReadPolicy
 Specialized caches. More...
 
WritePolicymyWritePolicy
 

Private Member Functions

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

Private Attributes

unsigned int cacheMissRead
 cache miss values More...
 
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:

  • read : for getting the value of an image from cache at a given position given by a point only if that point belongs to an image from cache
  • write : for setting a value on an image from cache at a given position given by a point only if that point belongs to an image from cache
  • update : for updating the cache according to the read cache policy

Definition at line 77 of file ImageCache.h.

Member Typedef Documentation

◆ Domain

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.

◆ ImageContainer

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.

◆ ImageFactory

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.

◆ Point

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.

◆ ReadPolicy

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.

◆ Self

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.

◆ Value

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.

◆ WritePolicy

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

◆ ImageCache() [1/2]

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.

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

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

◆ ~ImageCache()

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  }

◆ ImageCache() [2/2]

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

◆ BOOST_CONCEPT_ASSERT() [1/4]

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

Checking concepts.

◆ BOOST_CONCEPT_ASSERT() [2/4]

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

◆ BOOST_CONCEPT_ASSERT() [3/4]

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

◆ BOOST_CONCEPT_ASSERT() [4/4]

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

◆ clearCacheAndResetCacheMisses()

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::clearCacheAndResetCacheMisses ( )
inline

◆ getCacheMissRead()

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
unsigned int DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::getCacheMissRead ( )
inline

◆ getCacheMissWrite()

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
unsigned int DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::getCacheMissWrite ( )
inline

◆ getPage()

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().

◆ incCacheMissRead()

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

◆ incCacheMissWrite()

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

◆ isValid()

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.

157  {
158  return (myImageFactoryPtr->isValid());
159  }

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

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

◆ operator=()

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

◆ read()

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()().

◆ selfDisplay()

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.

◆ update()

template<typename TImageContainer , typename TImageFactory , typename TReadPolicy , typename TWritePolicy >
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::update ( const Domain aDomain)

◆ write()

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

◆ cacheMissRead

◆ cacheMissWrite

◆ myImageFactoryPtr

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().

◆ myReadPolicy

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

◆ myWritePolicy

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: