CacheBase Class Reference

This class hold all functions and member which are common to all derived cache classes and do not depend on the concretely cached objects and are therefore independed from template parameters. More...

#include <cache.h>

Inheritance diagram for CacheBase:
Cache< VolumeHandle > Cache< T > VolumeCache

List of all members.

Public Member Functions

 CacheBase (const std::string &cachedObjectsClassName, const std::type_info &assignedPortType)
 Derived classed have to call this ctor in order to get "reserve" a port type and to tell which kind of objects they will cache.
const std::type_info & getAssignedPortType () const
 Returns the port type which has been assigned for derived cache classes.
std::vector< Port * > getCacheConcernedOutports (Processor *const processor) const
 Returns all ports of the passed processor matching the port type which is to be handled by derived classes.
const std::string & getCachedObjectsClassName () const
 Returns the class name of the object which can be handled from the derived object.
std::string getProcessorsInportConfig (const Processor *processor) const
 Returns a textual representation of the data which are currently assigend to the inports of the given processor.
bool isCompatible (Processor *const processor) const
 Returns true, if the given processor is compatbile with this Cache object, false otherwise.
bool isEnabled () const
 Returns whether caching is enable or not.
void setEnabled (const bool enable)
 Enables or disbaled caching for that particular Cache object.

Static Public Member Functions

static bool isCachingEnabled ()
 Checks wether caching is enabled in general.
static void setCachingEnabled (const bool enable)
 Enables or disables the general abilitiy of caching by setting a static bool.

Protected Member Functions

virtual std::string portContentToString (Port *const port) const =0

Protected Attributes

const std::type_info & assignedPortType_
const std::string cachedObjectsClassName_
bool isEnabled_

Detailed Description

This class hold all functions and member which are common to all derived cache classes and do not depend on the concretely cached objects and are therefore independed from template parameters.

Basically, this are utility methods. Furthermode this class works as the "master control" for all caches and can globally disable the ability of caching via calls to setCachingEnabled().

Author:
Dirk Feldmann, June/July 2009

Definition at line 51 of file cache.h.


Constructor & Destructor Documentation

CacheBase ( const std::string &  cachedObjectsClassName,
const std::type_info &  assignedPortType 
)

Derived classed have to call this ctor in order to get "reserve" a port type and to tell which kind of objects they will cache.

The latter is for internal and informational purpose only and could be anything, but it is strongly recommended to use the real class Name or an appropriate one, e.g. 'VolumeHandle' for the VolumeCaching which actually caches VolumeHandle objects.

Parameters:
chachedObjectsClassName The class name of the objects which will be cached by derived classes.
assignedPortType The type of ports which will be checked for data to be cached by subclasses, e.g. 'volumehandle'.

Definition at line 44 of file cache.cpp.


Member Function Documentation

std::string getProcessorsInportConfig ( const Processor processor  )  const

Returns a textual representation of the data which are currently assigend to the inports of the given processor.

The format of the string depends on the concrete port type and has to defined by the internal call to . Not that empty strings can be returned, which is regarded as an error, indicating that there are not data on the inport.

Definition at line 72 of file cache.cpp.

static bool isCachingEnabled (  )  [inline, static]

Checks wether caching is enabled in general.

Note that although the return value might be true, a concrete cache can be disabled via setEnabled(false).

Definition at line 122 of file cache.h.

bool isEnabled (  )  const

Returns whether caching is enable or not.

The return value depends on the setting set via setEnabled() of the object and the general class setting set via setCachingEnabled(). If one of the sets false, the return value of this function is false, too.

Definition at line 96 of file cache.cpp.

static void setCachingEnabled ( const bool  enable  )  [inline, static]

Enables or disables the general abilitiy of caching by setting a static bool.

This values affects the return value of isEnabled(). If it is called with false, all caches will be generally disabled.

Definition at line 129 of file cache.h.

void setEnabled ( const bool  enable  ) 

Enables or disbaled caching for that particular Cache object.

Note that the object can be enabled to cache, but that it will not take effect if setCachingEnabled(false) has been called.

Definition at line 100 of file cache.cpp.