DGtal  1.5.beta
DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory > Class Template Reference

Aim: implements a 'FIFO' read policy cache. More...

#include <DGtal/images/ImageCachePolicies.h>

Public Types

typedef TImageFactory ImageFactory
 
typedef TImageContainer ImageContainer
 
typedef TImageContainer::Domain Domain
 
typedef TImageContainer::Point Point
 
typedef TImageContainer::Value Value
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CImage< TImageContainer >))
 Checking concepts. More...
 
 BOOST_CONCEPT_ASSERT ((concepts::CImageFactory< TImageFactory >))
 
 ImageCacheReadPolicyFIFO (Alias< ImageFactory > anImageFactory, int aFIFOSizeMax=10)
 
 ~ImageCacheReadPolicyFIFO ()
 
ImageContainergetPage (const Point &aPoint)
 
ImageContainergetPage (const Domain &aDomain)
 
ImageContainergetPageToDetach ()
 
void updateCache (const Domain &aDomain)
 
void clearCache ()
 

Protected Attributes

std::deque< ImageContainer * > myFIFOCacheImages
 Alias on the images cache. More...
 
unsigned int myFIFOSizeMax
 Size max of the FIFO. More...
 
ImageFactorymyImageFactory
 Alias on the image factory. More...
 

Private Member Functions

 ImageCacheReadPolicyFIFO (const ImageCacheReadPolicyFIFO &other)
 
ImageCacheReadPolicyFIFOoperator= (const ImageCacheReadPolicyFIFO &other)
 

Detailed Description

template<typename TImageContainer, typename TImageFactory>
class DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >

Aim: implements a 'FIFO' read policy cache.

Description of template class 'ImageCacheReadPolicyFIFO'

The cache keeps track of all the pages in memory in a queue, with the most recent arrival at the back, and the earliest arrival in front. When a page needs to be replaced, the page at the front of the queue (the oldest page) is selected.

Template Parameters
TImageContaineran image container type (model of CImage).
TImageFactoryan image factory.

The policy is done with 5 functions:

  • getPage : for getting the alias on the image that contains a point or NULL if no image in the cache contains that point
  • getPage : for getting the alias on the image that contains a domain or NULL if no image in the cache contains that domain
  • getPageToDetach : for getting the alias on the image that we have to detach or NULL if no image have to be detached
  • updateCache : for updating the cache according to the cache policy
  • clearCache : for clearing the cache

Definition at line 182 of file ImageCachePolicies.h.

Member Typedef Documentation

◆ Domain

template<typename TImageContainer , typename TImageFactory >
typedef TImageContainer::Domain DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::Domain

Definition at line 193 of file ImageCachePolicies.h.

◆ ImageContainer

template<typename TImageContainer , typename TImageFactory >
typedef TImageContainer DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::ImageContainer

Definition at line 192 of file ImageCachePolicies.h.

◆ ImageFactory

template<typename TImageContainer , typename TImageFactory >
typedef TImageFactory DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::ImageFactory

Definition at line 190 of file ImageCachePolicies.h.

◆ Point

template<typename TImageContainer , typename TImageFactory >
typedef TImageContainer::Point DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::Point

Definition at line 194 of file ImageCachePolicies.h.

◆ Value

template<typename TImageContainer , typename TImageFactory >
typedef TImageContainer::Value DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::Value

Definition at line 195 of file ImageCachePolicies.h.

Constructor & Destructor Documentation

◆ ImageCacheReadPolicyFIFO() [1/2]

template<typename TImageContainer , typename TImageFactory >
DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::ImageCacheReadPolicyFIFO ( Alias< ImageFactory anImageFactory,
int  aFIFOSizeMax = 10 
)
inline

Definition at line 197 of file ImageCachePolicies.h.

197  :
198  myFIFOSizeMax(aFIFOSizeMax), myImageFactory(&anImageFactory)
199  {
200  }
ImageFactory * myImageFactory
Alias on the image factory.
unsigned int myFIFOSizeMax
Size max of the FIFO.

◆ ~ImageCacheReadPolicyFIFO()

template<typename TImageContainer , typename TImageFactory >
DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::~ImageCacheReadPolicyFIFO ( )
inline

Destructor. Does nothing

Definition at line 206 of file ImageCachePolicies.h.

206 {}

◆ ImageCacheReadPolicyFIFO() [2/2]

template<typename TImageContainer , typename TImageFactory >
DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::ImageCacheReadPolicyFIFO ( const ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory > &  other)
private

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT() [1/2]

template<typename TImageContainer , typename TImageFactory >
DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::BOOST_CONCEPT_ASSERT ( (concepts::CImage< TImageContainer >)  )

Checking concepts.

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TImageContainer , typename TImageFactory >
DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::BOOST_CONCEPT_ASSERT ( (concepts::CImageFactory< TImageFactory >)  )

◆ clearCache()

template<typename TImageContainer , typename TImageFactory >
void DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::clearCache ( )

Clear the cache.

◆ getPage() [1/2]

template<typename TImageContainer , typename TImageFactory >
ImageContainer* DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::getPage ( const Domain aDomain)

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.

◆ getPage() [2/2]

template<typename TImageContainer , typename TImageFactory >
ImageContainer* DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::getPage ( const Point aPoint)

Get the alias on the image that contains the point aPoint or NULL if no image in the cache contains the point aPoint.

Parameters
aPointthe point.
Returns
the alias on the image container or NULL pointer.

◆ getPageToDetach()

template<typename TImageContainer , typename TImageFactory >
ImageContainer* DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::getPageToDetach ( )

Get the alias on the image that we have to detach or NULL if no image have to be detached.

Returns
the alias on the image container or NULL pointer.

◆ operator=()

template<typename TImageContainer , typename TImageFactory >
ImageCacheReadPolicyFIFO& DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::operator= ( const ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory > &  other)
private

◆ updateCache()

template<typename TImageContainer , typename TImageFactory >
void DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::updateCache ( const Domain aDomain)

Update the cache according to the cache policy.

Parameters
aDomainthe domain.

Field Documentation

◆ myFIFOCacheImages

template<typename TImageContainer , typename TImageFactory >
std::deque<ImageContainer *> DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::myFIFOCacheImages
protected

Alias on the images cache.

Definition at line 259 of file ImageCachePolicies.h.

◆ myFIFOSizeMax

template<typename TImageContainer , typename TImageFactory >
unsigned int DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::myFIFOSizeMax
protected

Size max of the FIFO.

Definition at line 262 of file ImageCachePolicies.h.

◆ myImageFactory

template<typename TImageContainer , typename TImageFactory >
ImageFactory* DGtal::ImageCacheReadPolicyFIFO< TImageContainer, TImageFactory >::myImageFactory
protected

Alias on the image factory.

Definition at line 265 of file ImageCachePolicies.h.


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