
Resources are identified by keys of type Key. This is usually a string (such as a file name or similar) but may be any compatible type. Resources are created through the create function when they are first requested. After that, they are returned from the cache, provided that neither clear nor remove was called. Cached resources are destroyed when they are removed.
clear at shutdown.| T | the managed resource type | |
| Key | the key type, usually string or similar | |
| Sto | the type returned by the get function, usually either T* or Handle<T>. Other types will not be managed. |
Public Member Functions | |
| void | clear () |
| clears the cache | |
| Sto | get (const Key &k) |
retrieves the object identified by k | |
| unsigned int | getCount () const |
| bool | isCached (const Key &k) const |
checks if the object identified by k is cached | |
| void | remove (const Key &k) |
| removes an object from the cache | |
Protected Member Functions | |
| virtual Sto | create (const Key &)=0 |
| virtual void | dispose (Sto &)=0 |
| virtual std::string | toString (const Key &) const =0 |
| converts the given key to an identifier string | |
|
|||||||||
|
clears the cache All cached resources are destroyed. Note that calling this function will invalidate any pointer to a cached resource that may be held elsewhere. |
|
||||||||||
|
Implemented in ONE::util::ResourceManager< T, Key, Handle< T > >. |
|
||||||||||
|
Implemented in ONE::util::ResourceManager< T, Key, T * >, and ONE::util::ResourceManager< T, Key, Handle< T > >. |
|
||||||||||
|
retrieves the object identified by
If
|
|
|||||||||
|
|
|
||||||||||
|
checks if the object identified by
The resource will not be loaded if
|
|
||||||||||
|
removes an object from the cache
The removed object is destroyed. Note that this will invalidate any pointer to the resource that may be held elsewhere. If
|
|
||||||||||
|
converts the given key to an identifier string The return value is stored in the resource map and must serve as a unique identifier for the key. |
1.4.3