CS::Utility::RootedHierarchicalCache Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
CS::Utility::RootedHierarchicalCache Class Reference

iHierarchicalCache providing a 'view' into a path of another cache. More...

`#include <csutil/rootedhiercache.h>`

Inheritance diagram for CS::Utility::RootedHierarchicalCache:

List of all members.

## Public Member Functions
| RootedHierarchicalCache (iHierarchicalCache *cache, const char *root)
| Construct.
iHierarchicalCache implementation
virtual bool | CacheData (const void *data, size_t size, const char *path)
| Cache some data.
virtual csPtr< iDataBuffer > | ReadCache (const char *path)
| Retrieve some data from the cache.
virtual bool | ClearCache (const char *path)
| Clear items from the cache.
virtual void | Flush ()
| Ensure that the cached data is written on whatever medium is behind the cache.
virtual csPtr< iHierarchicalCache > | GetRootedCache (const char *base)
| Create a new hierarchical cache which is a view of this cache with the items root at base.
virtual csPtr< iStringArray > | GetSubItems (const char *path)
| Get cache items directly under path.
virtual iHierarchicalCache * | GetTopCache ()
| Get the cache which is the ultimate hierarchical ancestor of a cache.
virtual bool | IsCacheWriteable () const
| Query if cache can be written to (as some caches may be static/read-only)

## Detailed Description

iHierarchicalCache providing a 'view' into a path of another cache.

This cache takes a 'wrapped' cache and a cache path which serves as the root path of all accesses to this cache. In other words, the given cache path is prepended before passing all cache requests to the 'wrapped' cache.

Definition at line 42 of file rootedhiercache.h.

## Constructor & Destructor Documentation

CS::Utility::RootedHierarchicalCache::RootedHierarchicalCache | ( | iHierarchicalCache * | cache,
|  | const char * | root
| ) |  | `[inline]`

Construct.

Parameters:

  cache | The cache to wrap.
  root | The root directory in cache for this cache.

Definition at line 56 of file rootedhiercache.h.

## Member Function Documentation

virtual bool CS::Utility::RootedHierarchicalCache::CacheData | ( | const void * | data,
|  | size_t | size,
|  | const char * | path
| ) |  | `[inline, virtual]`

Cache some data.

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

Implements iHierarchicalCache.

Definition at line 63 of file rootedhiercache.h.

virtual bool CS::Utility::RootedHierarchicalCache::ClearCache | ( | const char * | path | ) | `[inline, virtual]`

Clear items from the cache.

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

Implements iHierarchicalCache.

Definition at line 68 of file rootedhiercache.h.

virtual void CS::Utility::RootedHierarchicalCache::Flush | ( |  | ) | `[inline, virtual]`

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

Implements iHierarchicalCache.

Definition at line 70 of file rootedhiercache.h.

virtual csPtr<iHierarchicalCache> CS::Utility::RootedHierarchicalCache::GetRootedCache | ( | const char * | base | ) | `[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.

Implements iHierarchicalCache.

virtual csPtr<iStringArray> CS::Utility::RootedHierarchicalCache::GetSubItems | ( | const char * | path | ) | `[inline, virtual]`

Get cache items directly under path.

Implements iHierarchicalCache.

Definition at line 73 of file rootedhiercache.h.

virtual iHierarchicalCache* CS::Utility::RootedHierarchicalCache::GetTopCache | ( |  | ) | `[inline, virtual]`

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

Implements iHierarchicalCache.

Definition at line 75 of file rootedhiercache.h.

virtual bool CS::Utility::RootedHierarchicalCache::IsCacheWriteable | ( |  | ) | const`[inline, virtual]`

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

Implements iHierarchicalCache.

Definition at line 77 of file rootedhiercache.h.

virtual csPtr<iDataBuffer> CS::Utility::RootedHierarchicalCache::ReadCache | ( | const char * | path | ) | `[inline, 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!

Implements iHierarchicalCache.

Definition at line 66 of file rootedhiercache.h.

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

- csutil/rootedhiercache.h