CrystalSpace

Public API Reference

iHierarchicalCache Struct Reference

A generic, hierarchical cache system. More...

#include <iutil/hiercache.h>

Inheritance diagram for iHierarchicalCache:

List of all members.

Public Member Functions

virtual bool CacheData (const void *data, size_t size, const char *path)=0
 Cache some data.
virtual bool ClearCache (const char *path)=0
 Clear items from the cache.
virtual void Flush ()=0
 Ensure that the cached data is written on whatever medium is behind the cache.
virtual csPtr< iHierarchicalCacheGetRootedCache (const char *base)=0
 Create a new hierarchical cache which is a view of this cache with the items root at base.
virtual csPtr< iStringArrayGetSubItems (const char *path)=0
 Get cache items directly under path.
virtual iHierarchicalCacheGetTopCache ()=0
 Get the cache which is the ultimate hierarchical ancestor of a cache.
virtual bool IsCacheWriteable () const =0
 Query if cache can be written to (as some caches may be static/read-only).
virtual csPtr< iDataBufferReadCache (const char *path)=0
 Retrieve some data from the cache.

Detailed Description

A generic, hierarchical cache system.

A client can use this to cache data that was hard to calculate. The data is not converted in any way so it is the responsability of the client to correct platform depending issues like endianess and structure padding.

Every item in a cache has a path, similar to a filesystem path. Like these each path component is separated by '/'.

Definition at line 41 of file hiercache.h.


Member Function Documentation

virtual bool iHierarchicalCache::CacheData ( const void *  data,
size_t  size,
const char *  path 
) [pure virtual]

Cache some data.

Returns true if this succeeded. path needs to be absolute.

Implemented in CS::PluginCommon::ShaderCacheHelper::MicroArchiveCache, CS::Utility::RootedHierarchicalCache, and CS::Utility::VfsHierarchicalCache.

virtual bool iHierarchicalCache::ClearCache ( const char *  path  )  [pure virtual]

Clear items from the cache.

Clears all items below the given path. path needs to be absolute.

Implemented in CS::PluginCommon::ShaderCacheHelper::MicroArchiveCache, CS::Utility::RootedHierarchicalCache, and CS::Utility::VfsHierarchicalCache.

virtual void iHierarchicalCache::Flush (  )  [pure virtual]

Ensure that the cached data is written on whatever medium is behind the cache.

Implemented in CS::PluginCommon::ShaderCacheHelper::MicroArchiveCache, CS::Utility::RootedHierarchicalCache, and CS::Utility::VfsHierarchicalCache.

virtual csPtr<iHierarchicalCache> iHierarchicalCache::GetRootedCache ( const char *  base  )  [pure virtual]

Create a new hierarchical cache which is a view of this cache with the items root at base.

You can imagine the returned cache prepending base to all item requests or storage.

Implemented in CS::PluginCommon::ShaderCacheHelper::MicroArchiveCache, CS::Utility::RootedHierarchicalCache, and CS::Utility::VfsHierarchicalCache.

virtual csPtr<iStringArray> iHierarchicalCache::GetSubItems ( const char *  path  )  [pure virtual]
virtual iHierarchicalCache* iHierarchicalCache::GetTopCache (  )  [pure virtual]

Get the cache which is the ultimate hierarchical ancestor of a cache.

Implemented in CS::PluginCommon::ShaderCacheHelper::MicroArchiveCache, CS::Utility::RootedHierarchicalCache, and CS::Utility::VfsHierarchicalCache.

virtual bool iHierarchicalCache::IsCacheWriteable (  )  const [pure virtual]

Query if cache can be written to (as some caches may be static/read-only).

Implemented in CS::PluginCommon::ShaderCacheHelper::MicroArchiveCache, CS::Utility::RootedHierarchicalCache, and CS::Utility::VfsHierarchicalCache.

virtual csPtr<iDataBuffer> iHierarchicalCache::ReadCache ( const char *  path  )  [pure virtual]

Retrieve some data from the cache.

Returns 0 if the data could not be found in the cache. path needs to be absolute.

Remarks:
Don't modify returned buffer!

Implemented in CS::PluginCommon::ShaderCacheHelper::MicroArchiveCache, CS::Utility::RootedHierarchicalCache, and CS::Utility::VfsHierarchicalCache.


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

Generated for Crystal Space 2.0 by doxygen 1.6.1