28 #ifndef _ResourceManager_H__ 29 #define _ResourceManager_H__ 63 std::pair<bool, T> ret;
71 ret.second = mItems.front();
166 virtual ResourceCreateOrRetrieveResult createOrRetrieve(
const String& name,
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);
571 return ResourceMapIterator(mResourcesByHandle.begin(), mResourcesByHandle.end());
std::pair< ResourcePtr, bool > ResourceCreateOrRetrieveResult
Abstract class defining the interface used by classes which wish to perform script loading to define ...
const String & getResourceType(void) const
Gets a string identifying the type of resource this manager handles.
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 bool resourceExists(const String &name)
Returns whether the named resource exists in this manager.
Template class describing a simple pool of items.
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
MapIterator< ResourceHandleMap > ResourceMapIterator
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
float Real
Software floating point type.
ResourcePoolMap mResourcePoolMap
virtual std::pair< bool, T > removeItem()
Get the next item from the pool.
vector< String >::type StringVector
Abstract class representing a loadable resource (e.g.
Interface describing a manual resource loader.
Real mLoadOrder
Loading order relative to other managers, higher is later.
unsigned long long int ResourceHandle
#define OGRE_LOCK_AUTO_MUTEX
virtual void clear()
Clear the pool.
map< ResourceHandle, ResourcePtr >::type ResourceHandleMap
HashMap< String, ResourcePtr > ResourceMap
virtual bool getVerbose(void)
Gets whether this manager and its resources habitually produce log output.
virtual void addItem(const T &i)
Add a new item to the pool.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
ResourceMapIterator getResourceIterator(void)
Returns an iterator over all resources in this manager.
AtomicScalar< size_t > mMemoryUsage
String mResourceType
String identifying the resource type this manager handles.
Defines a generic resource handler.
virtual bool resourceExists(ResourceHandle handle)
Returns whether a resource with the given handle exists in this manager.
HashMap< String, ResourceMap > ResourceWithGroupMap
virtual const StringVector & getScriptPatterns(void) const
Gets the file patterns which should be used to find scripts for this ResourceManager.
Definition of a pool of resources, which users can use to reuse similar resources many times without ...
AtomicScalar< ResourceHandle > mNextHandle
In bytes.
ResourceHandleMap mResourcesByHandle
ResourceWithGroupMap mResourcesWithGroup
map< String, ResourcePool * >::type ResourcePoolMap
virtual size_t getMemoryUsage(void) const
Gets the current memory usage, in bytes.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
StringVector mScriptPatterns
Patterns to use to look for scripts if supported (e.g. *.overlay)
virtual void setVerbose(bool v)
Sets whether this manager and its resources habitually produce log output.