DGtal 1.3.0
|
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 |
ImageContainer * | getPage (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 | |
ImageFactory * | myImageFactoryPtr |
Alias on the image factory. More... | |
ReadPolicy * | myReadPolicy |
Specialized caches. More... | |
WritePolicy * | myWritePolicy |
Private Member Functions | |
ImageCache (const ImageCache &other) | |
ImageCache & | operator= (const ImageCache &other) |
Private Attributes | |
unsigned int | cacheMissRead |
cache miss values More... | |
unsigned int | cacheMissWrite |
Aim: implements an images cache with 'read and write' policies.
Description of template class 'ImageCache'
TImageContainer | an image container type (model of CImage). |
TImageFactory | an image factory type (model of CImageFactory). |
TReadPolicy | an image cache read policy class (model of CImageCacheReadPolicy). |
TWritePolicy | an image cache write policy class (model of CImageCacheWritePolicy). |
The cache provides 3 functions:
Definition at line 77 of file ImageCache.h.
typedef ImageContainer::Domain DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Domain |
Definition at line 93 of file ImageCache.h.
typedef TImageContainer DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageContainer |
Types copied from the container.
Definition at line 92 of file ImageCache.h.
typedef TImageFactory DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageFactory |
Definition at line 97 of file ImageCache.h.
typedef ImageContainer::Point DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Point |
Definition at line 94 of file ImageCache.h.
typedef TReadPolicy DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ReadPolicy |
Definition at line 99 of file ImageCache.h.
typedef ImageCache<TImageContainer, TImageFactory, TReadPolicy, TWritePolicy> DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Self |
Definition at line 83 of file ImageCache.h.
typedef ImageContainer::Value DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::Value |
Definition at line 95 of file ImageCache.h.
typedef TWritePolicy DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::WritePolicy |
Definition at line 100 of file ImageCache.h.
|
inline |
Constructor.
anImageFactory | alias on the image factory (see ImageFactoryFromImage or ImageFactoryFromHDF5). |
aReadPolicy | a read policy. |
aWritePolicy | a 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.
|
inline |
|
private |
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT | ( | (concepts::CImage< TImageContainer >) | ) |
Checking concepts.
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT | ( | (concepts::CImageCacheReadPolicy< TReadPolicy >) | ) |
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT | ( | (concepts::CImageCacheWritePolicy< TWritePolicy >) | ) |
DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::BOOST_CONCEPT_ASSERT | ( | (concepts::CImageFactory< TImageFactory >) | ) |
|
inline |
Clear the cache and reset the cache misses
Definition at line 235 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.
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::clearCacheAndResetCacheMisses().
|
inline |
Get the cacheMissRead value.
Definition at line 203 of file ImageCache.h.
References DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissRead.
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::getCacheMissRead().
|
inline |
Get the cacheMissWrite value.
Definition at line 211 of file ImageCache.h.
References DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissWrite.
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::getCacheMissWrite().
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.
aDomain | the domain. |
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::findTileFromBlockCoords().
|
inline |
Inc the cacheMissRead value.
Definition at line 219 of file ImageCache.h.
References DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissRead.
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::findTileFromBlockCoords(), and DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::operator()().
|
inline |
Inc the cacheMissWrite value.
Definition at line 227 of file ImageCache.h.
References DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::cacheMissWrite.
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::setValue().
|
inline |
Checks the validity/consistency of the object.
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().
|
private |
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.
aPoint | the point. |
aValue | the value returned. |
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::operator()().
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
void DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::update | ( | const Domain & | aDomain | ) |
Update the cache according to the read cache policy.
aDomain | the domain. |
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::findTileFromBlockCoords(), DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::operator()(), and DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::setValue().
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.
aPoint | the point. |
aValue | the value returned. |
Referenced by DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::setValue().
|
private |
cache miss values
Definition at line 263 of file ImageCache.h.
Referenced by DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::clearCacheAndResetCacheMisses(), DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::getCacheMissRead(), DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageCache(), and DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::incCacheMissRead().
|
private |
Definition at line 264 of file ImageCache.h.
Referenced by DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::clearCacheAndResetCacheMisses(), DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::getCacheMissWrite(), DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageCache(), and DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::incCacheMissWrite().
|
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().
|
protected |
Specialized caches.
Definition at line 257 of file ImageCache.h.
Referenced by DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::clearCacheAndResetCacheMisses(), and DGtal::ImageCache< TImageContainer, TImageFactory, TReadPolicy, TWritePolicy >::ImageCache().
|
protected |
Definition at line 258 of file ImageCache.h.