28 #ifndef _ResourceGroupManager_H__
29 #define _ResourceGroupManager_H__
99 virtual void resourceGroupScriptingStarted(
const String& groupName,
size_t scriptCount) = 0;
107 virtual void scriptParseStarted(
const String& scriptName,
bool& skipThisScript) = 0;
111 virtual void scriptParseEnded(
const String& scriptName,
bool skipped) = 0;
113 virtual void resourceGroupScriptingEnded(
const String& groupName) = 0;
121 { (void)groupName; (void)resourceCount; }
138 { (void)description; }
155 virtual void resourceGroupLoadStarted(
const String& groupName,
size_t resourceCount) = 0;
159 virtual void resourceLoadStarted(
const ResourcePtr& resource) = 0;
162 virtual void resourceLoadEnded(
void) = 0;
168 virtual void worldGeometryStageStarted(
const String& description) = 0;
174 virtual void worldGeometryStageEnded(
void) = 0;
176 virtual void resourceGroupLoadEnded(
const String& groupName) = 0;
336 LoadResourceOrderMap loadResourceOrderMap;
346 void removeFromIndex(
Archive* arch);
351 ResourceGroupMap mResourceGroupMap;
354 String mWorldGroupName;
376 ResourceGroup* findGroupContainingResourceImpl(const String& filename);
378 void fireResourceGroupScriptingStarted(const String& groupName,
size_t scriptCount);
380 void fireScriptStarted(const String& scriptName,
bool &skipScript);
382 void fireScriptEnded(const String& scriptName,
bool skipped);
384 void fireResourceGroupScriptingEnded(const String& groupName);
386 void fireResourceGroupLoadStarted(const String& groupName,
size_t resourceCount);
388 void fireResourceLoadStarted(const
ResourcePtr& resource);
390 void fireResourceLoadEnded(
void);
392 void fireResourceGroupLoadEnded(const String& groupName);
394 void fireResourceGroupPrepareStarted(const String& groupName,
size_t resourceCount);
396 void fireResourcePrepareStarted(const
ResourcePtr& resource);
398 void fireResourcePrepareEnded(
void);
400 void fireResourceGroupPrepareEnded(const String& groupName);
406 virtual ~ResourceGroupManager();
445 void createResourceGroup(const String& name, const
bool inGlobalPool = true);
487 void initialiseResourceGroup(const String& name);
492 void initialiseAllResourceGroups(
void);
511 void prepareResourceGroup(const String& name,
bool prepareMainResources = true,
512 bool prepareWorldGeom = true);
531 void loadResourceGroup(const String& name,
bool loadMainResources = true,
532 bool loadWorldGeom = true);
549 void unloadResourceGroup(const String& name,
bool reloadableOnly = true);
562 void unloadUnreferencedResourcesInGroup(const String& name,
563 bool reloadableOnly = true);
574 void clearResourceGroup(const String& name);
581 void destroyResourceGroup(const String& name);
590 bool isResourceGroupInitialised(const String& name);
599 bool isResourceGroupLoaded(const String& name);
604 bool resourceGroupExists(const String& name);
627 void addResourceLocation(const String& name, const String& locType,
628 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME,
bool recursive = false);
630 void removeResourceLocation(const String& name,
631 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
633 bool resourceLocationExists(const String& name,
634 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
670 void declareResource(const String& name, const String& resourceType,
671 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
712 void declareResource(const String& name, const String& resourceType,
714 const NameValuePairList& loadParameters = NameValuePairList());
725 void undeclareResource(const String& name, const String& groupName);
747 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
748 bool searchGroupsIfNotFound = true,
Resource* resourceBeingLoaded = 0);
762 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME);
772 StringVectorPtr listResourceNames(const String& groupName,
bool dirs = false);
780 FileInfoListPtr listResourceFileInfo(const String& groupName,
bool dirs = false);
793 StringVectorPtr findResourceNames(const String& groupName, const String& pattern,
800 bool resourceExists(const String& group, const String& filename);
806 bool resourceExists(
ResourceGroup* group, const String& filename);
811 bool resourceExistsInAnyGroup(const String& filename);
819 const String& findGroupContainingResource(const String& filename);
830 FileInfoListPtr findResourceFileInfo(const String& group, const String& pattern,
834 time_t resourceModifiedTime(const String& group, const String& filename);
847 StringVectorPtr findResourceLocation(const String& groupName, const String& pattern);
850 time_t resourceModifiedTime(
ResourceGroup* group, const String& filename);
866 DataStreamPtr createResource(const String& filename, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
867 bool overwrite = false, const String& locationPattern =
StringUtil::BLANK);
878 void deleteResource(const String& filename, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
879 const String& locationPattern =
StringUtil::BLANK);
890 void deleteMatchingResources(const String& filePattern, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
891 const String& locationPattern =
StringUtil::BLANK);
906 void setWorldResourceGroupName(const String& groupName) {mWorldGroupName = groupName;}
924 void linkWorldGeometryToResourceGroup(
const String& group,
931 void unlinkWorldGeometryFromResourceGroup(
const String& group);
940 bool isResourceGroupInGlobalPool(
const String& name);
943 void shutdownAll(
void);
963 void _unregisterResourceManager(
const String& resourceType);
969 mResourceManagerMap.begin(), mResourceManagerMap.end()); }
1004 void _notifyResourceGroupChanged(
const String& oldGroup,
Resource* res);
1019 void _notifyWorldGeometryStageStarted(
const String& description);
1027 void _notifyWorldGeometryStageEnded(
void);
1041 ResourceDeclarationList getResourceDeclarationList(
const String& groupName);
1047 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.