28 #ifndef _ResourceGroupManager_H__
29 #define _ResourceGroupManager_H__
100 virtual void resourceGroupScriptingStarted(
const String& groupName,
size_t scriptCount) = 0;
108 virtual void scriptParseStarted(
const String& scriptName,
bool& skipThisScript) = 0;
112 virtual void scriptParseEnded(
const String& scriptName,
bool skipped) = 0;
114 virtual void resourceGroupScriptingEnded(
const String& groupName) = 0;
122 { (void)groupName; (void)resourceCount; }
139 { (void)description; }
156 virtual void resourceGroupLoadStarted(
const String& groupName,
size_t resourceCount) = 0;
160 virtual void resourceLoadStarted(
const ResourcePtr& resource) = 0;
163 virtual void resourceLoadEnded(
void) = 0;
169 virtual void worldGeometryStageStarted(
const String& description) = 0;
175 virtual void worldGeometryStageEnded(
void) = 0;
177 virtual void resourceGroupLoadEnded(
const String& groupName) = 0;
337 LoadResourceOrderMap loadResourceOrderMap;
347 void removeFromIndex(
Archive* arch);
352 ResourceGroupMap mResourceGroupMap;
355 String mWorldGroupName;
377 ResourceGroup* findGroupContainingResourceImpl(const String& filename);
379 void fireResourceGroupScriptingStarted(const String& groupName,
size_t scriptCount);
381 void fireScriptStarted(const String& scriptName,
bool &skipScript);
383 void fireScriptEnded(const String& scriptName,
bool skipped);
385 void fireResourceGroupScriptingEnded(const String& groupName);
387 void fireResourceGroupLoadStarted(const String& groupName,
size_t resourceCount);
389 void fireResourceLoadStarted(const
ResourcePtr& resource);
391 void fireResourceLoadEnded(
void);
393 void fireResourceGroupLoadEnded(const String& groupName);
395 void fireResourceGroupPrepareStarted(const String& groupName,
size_t resourceCount);
397 void fireResourcePrepareStarted(const
ResourcePtr& resource);
399 void fireResourcePrepareEnded(
void);
401 void fireResourceGroupPrepareEnded(const String& groupName);
407 virtual ~ResourceGroupManager();
446 void createResourceGroup(const String& name, const
bool inGlobalPool = true);
488 void initialiseResourceGroup(const String& name);
493 void initialiseAllResourceGroups(
void);
512 void prepareResourceGroup(const String& name,
bool prepareMainResources = true,
513 bool prepareWorldGeom = true);
532 void loadResourceGroup(const String& name,
bool loadMainResources = true,
533 bool loadWorldGeom = true);
550 void unloadResourceGroup(const String& name,
bool reloadableOnly = true);
563 void unloadUnreferencedResourcesInGroup(const String& name,
564 bool reloadableOnly = true);
575 void clearResourceGroup(const String& name);
582 void destroyResourceGroup(const String& name);
591 bool isResourceGroupInitialised(const String& name);
600 bool isResourceGroupLoaded(const String& name);
605 bool resourceGroupExists(const String& name);
628 void addResourceLocation(const String& name, const String& locType,
629 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME,
bool recursive = false);
631 void removeResourceLocation(const String& name,
632 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
634 bool resourceLocationExists(const String& name,
635 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
671 void declareResource(const String& name, const String& resourceType,
672 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
713 void declareResource(const String& name, const String& resourceType,
715 const NameValuePairList& loadParameters = NameValuePairList());
726 void undeclareResource(const String& name, const String& groupName);
748 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
749 bool searchGroupsIfNotFound = true,
Resource* resourceBeingLoaded = 0);
763 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME);
773 StringVectorPtr listResourceNames(const String& groupName,
bool dirs = false);
781 FileInfoListPtr listResourceFileInfo(const String& groupName,
bool dirs = false);
794 StringVectorPtr findResourceNames(const String& groupName, const String& pattern,
801 bool resourceExists(const String& group, const String& filename);
807 bool resourceExists(
ResourceGroup* group, const String& filename);
812 bool resourceExistsInAnyGroup(const String& filename);
820 const String& findGroupContainingResource(const String& filename);
831 FileInfoListPtr findResourceFileInfo(const String& group, const String& pattern,
835 time_t resourceModifiedTime(const String& group, const String& filename);
848 StringVectorPtr findResourceLocation(const String& groupName, const String& pattern);
851 time_t resourceModifiedTime(
ResourceGroup* group, const String& filename);
867 DataStreamPtr createResource(const String& filename, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
868 bool overwrite = false, const String& locationPattern =
StringUtil::BLANK);
879 void deleteResource(const String& filename, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
880 const String& locationPattern =
StringUtil::BLANK);
891 void deleteMatchingResources(const String& filePattern, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
892 const String& locationPattern =
StringUtil::BLANK);
907 void setWorldResourceGroupName(const String& groupName) {mWorldGroupName = groupName;}
925 void linkWorldGeometryToResourceGroup(
const String& group,
932 void unlinkWorldGeometryFromResourceGroup(
const String& group);
941 bool isResourceGroupInGlobalPool(
const String& name);
944 void shutdownAll(
void);
964 void _unregisterResourceManager(
const String& resourceType);
970 mResourceManagerMap.begin(), mResourceManagerMap.end()); }
1005 void _notifyResourceGroupChanged(
const String& oldGroup,
Resource* res);
1020 void _notifyWorldGeometryStageStarted(
const String& description);
1028 void _notifyWorldGeometryStageEnded(
void);
1042 ResourceDeclarationList getResourceDeclarationList(
const String& groupName);
1048 const LocationList& getResourceLocationList(
const String& groupName);
virtual void resourcePrepareEnded(void)
This event is fired when the resource has been prepared.
float Real
Software floating point type.
map< Real, LoadUnloadResourceList * >::type LoadResourceOrderMap
Created resources which are ready to be loaded / unloaded.
virtual void resourcePrepareStarted(const ResourcePtr &resource)
This event is fired when a declared resource is about to be prepared.
virtual ~ResourceGroupListener()
virtual bool resourceCollision(Resource *resource, ResourceManager *resourceManager)=0
This event is called when a resource collides with another existing one in a resource manager...
virtual void worldGeometryPrepareStageEnded(void)
This event is fired when a stage of preparing linked world geometry has been completed.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
list< ResourceLocation * >::type LocationList
List of possible file locations.
Template class for creating single-instance global classes.
map< String, ResourceManager * >::type ResourceManagerMap
Manages the organisation and rendering of a 'scene' i.e.
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
MapIterator< ResourceManagerMap > ResourceManagerIterator
ResourceManagerMap mResourceManagerMap
Map of resource types (strings) to ResourceManagers, used to notify them to load / unload group conte...
ScriptLoaderOrderMap mScriptLoaderOrderMap
map< String, ResourceGroup * >::type ResourceGroupMap
Map from resource group names to groups.
Interface describing a manual resource loader.
virtual void worldGeometryPrepareStageStarted(const String &description)
This event is fired when a stage of preparing linked world geometry is about to start.
ResourceGroupListenerList mResourceGroupListenerList
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
static String INTERNAL_RESOURCE_GROUP_NAME
Internal resource group name (should be used by OGRE internal only)
virtual void resourceGroupPrepareEnded(const String &groupName)
This event is fired when a resource group finished preparing.
virtual void resourceStreamOpened(const String &name, const String &group, Resource *resource, DataStreamPtr &dataStream)=0
This event is called when a resource stream has been opened, but not processed yet.
Abstract class defining the interface used by classes which wish to perform script loading to define ...
static OGRE_AUTO_MUTEX String DEFAULT_RESOURCE_GROUP_NAME
Default resource group name.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
list< ResourcePtr >::type LoadUnloadResourceList
List of resources which can be loaded / unloaded.
Utility class for manipulating Strings.
bool recursive
Whether this location was added recursively.
vector< ResourceGroupListener * >::type ResourceGroupListenerList
Archive * archive
Pointer to the archive which is the destination.
vector< String >::type StringVector
virtual ~ResourceLoadingListener()
list< ResourceDeclaration >::type ResourceDeclarationList
List of resource declarations.
ResourceManagerIterator getResourceManagerIterator()
Get an iterator over the registered resource managers.
map< String, Archive * >::type ResourceLocationIndex
Resource index entry, resourcename->location.
multimap< Real, ScriptLoader * >::type ScriptLoaderOrderMap
Map of loading order (Real) to ScriptLoader, used to order script parsing.
Abstract class representing a loadable resource (e.g.
virtual DataStreamPtr resourceLoading(const String &name, const String &group, Resource *resource)=0
This event is called when a resource beings loading.
Nested struct defining a resource declaration.
This singleton class manages the list of resource groups, and notifying the various resource managers...
ManualResourceLoader * loader
Defines a generic resource handler.
static size_t RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS
The number of reference counts held per resource by the resource system.
This abstract class defines an interface which is called back during resource group loading to indica...
ResourceLoadingListener * mLoadingListener
NameValuePairList parameters
const String & getWorldResourceGroupName(void) const
Gets the resource group that 'world' resources will use.
virtual void resourceGroupPrepareStarted(const String &groupName, size_t resourceCount)
This event is fired when a resource group begins preparing.