28 #ifndef _ResourceManager_H__
29 #define _ResourceManager_H__
63 std::pair<bool, T> ret;
71 ret.second =
mItems.front();
167 const String& group,
bool isManual =
false,
178 virtual void setMemoryBudget(
size_t bytes);
182 virtual size_t getMemoryBudget(
void)
const;
193 virtual void unload(
const String& name);
215 virtual void unloadAll(
bool reloadableOnly =
true);
228 virtual void reloadAll(
bool reloadableOnly =
true);
244 virtual void unloadUnreferencedResources(
bool reloadableOnly =
true);
259 virtual void reloadUnreferencedResources(
bool reloadableOnly =
true);
297 virtual void remove(
const String& name);
331 virtual void removeAll(
void);
347 virtual void removeUnreferencedResources(
bool reloadableOnly =
true);
359 return !getResourceByName(name).isNull();
364 return !getByHandle(handle).isNull();
370 virtual void _notifyResourceTouched(
Resource* res);
375 virtual void _notifyResourceLoaded(
Resource* res);
380 virtual void _notifyResourceUnloaded(
Resource* res);
398 const String& group,
bool isManual =
false,
400 bool backgroundThread =
false);
418 const String& group,
bool isManual =
false,
420 bool backgroundThread =
false);
453 { (void)stream; (void)groupName; }
486 const String& getName()
const;
495 void destroyResourcePool(
const String& name);
497 void destroyAllResourcePools();
537 virtual void checkUsage(
void);
AtomicScalar< ResourceHandle > mNextHandle
In bytes.
virtual bool getVerbose(void)
Gets whether this manager and its resources habitually produce log output.
String mResourceType
String identifying the resource type this manager handles.
float Real
Software floating point type.
HashMap< String, ResourcePtr > ResourceMap
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
virtual const StringVector & getScriptPatterns(void) const
Gets the file patterns which should be used to find scripts for this ResourceManager.
StringVector mScriptPatterns
Patterns to use to look for scripts if supported (e.g. *.overlay)
const String & getResourceType(void) const
Gets a string identifying the type of resource this manager handles.
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
ResourceMapIterator getResourceIterator(void)
Returns an iterator over all resources in this manager.
HashMap< String, ResourceMap > ResourceWithGroupMap
Interface describing a manual resource loader.
virtual Real getLoadingOrder(void) const
Gets the relative loading order of resources of this type.
virtual void parseScript(DataStreamPtr &stream, const String &groupName)
Parse the definition of a set of resources from a script file.
virtual void clear()
Clear the pool.
ResourceHandleMap mResourcesByHandle
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
map< ResourceHandle, ResourcePtr >::type ResourceHandleMap
#define OGRE_LOCK_AUTO_MUTEX
Abstract class defining the interface used by classes which wish to perform script loading to define ...
Template class describing a simple pool of items.
virtual std::pair< bool, T > removeItem()
Get the next item from the pool.
virtual void setVerbose(bool v)
Sets whether this manager and its resources habitually produce log output.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
std::pair< ResourcePtr, bool > ResourceCreateOrRetrieveResult
ResourcePoolMap mResourcePoolMap
vector< String >::type StringVector
Abstract class representing a loadable resource (e.g.
unsigned long long int ResourceHandle
Definition of a pool of resources, which users can use to reuse similar resources many times without ...
virtual bool resourceExists(ResourceHandle handle)
Returns whether a resource with the given handle exists in this manager.
ResourceWithGroupMap mResourcesWithGroup
virtual size_t getMemoryUsage(void) const
Gets the current memory usage, in bytes.
Real mLoadOrder
Loading order relative to other managers, higher is later.
Defines a generic resource handler.
MapIterator< ResourceHandleMap > ResourceMapIterator
map< String, ResourcePool * >::type ResourcePoolMap
virtual void addItem(const T &i)
Add a new item to the pool.
AtomicScalar< size_t > mMemoryUsage
virtual bool resourceExists(const String &name)
Returns whether the named resource exists in this manager.