Go to the documentation of this file.
28 #ifndef _ResourceGroupManager_H__
29 #define _ResourceGroupManager_H__
122 { (void)groupName; (void)resourceCount; }
139 { (void)description; }
533 bool prepareWorldGeom =
true);
553 bool loadWorldGeom =
true);
584 bool reloadableOnly =
true);
649 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME,
bool recursive =
false,
bool readOnly =
true);
652 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
655 const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
692 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
768 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
769 bool searchGroupsIfNotFound =
true,
Resource* resourceBeingLoaded = 0);
783 const String& groupName = DEFAULT_RESOURCE_GROUP_NAME);
981 mResourceManagerMap.begin(), mResourceManagerMap.end()); }
bool resourceGroupExists(const String &name)
virtual void worldGeometryPrepareStageStarted(const String &description)
This event is fired when a stage of preparing linked world geometry is about to start.
void undeclareResource(const String &name, const String &groupName)
Undeclare a resource.
void _unregisterScriptLoader(ScriptLoader *su)
Internal method for unregistering a ScriptLoader.
ResourceLocationIndex resourceIndexCaseSensitive
Index of resource names to locations, built for speedy access (case sensitive archives)
void createResourceGroup(const String &name, const bool inGlobalPool=true)
Create a resource group.
ScriptLoader * _findScriptLoader(const String &pattern)
Method used to directly query for registered script loaders.
virtual void resourceRemove(const ResourcePtr &resource)
This event is fired when a resource is about to be removed.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
static String INTERNAL_RESOURCE_GROUP_NAME
Internal resource group name (should be used by OGRE internal only)
bool resourceLocationExists(const String &name, const String &resGroup=DEFAULT_RESOURCE_GROUP_NAME)
Verify if a resource location exists for the given group.
static size_t RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS
The number of reference counts held per resource by the resource system.
void fireResourceGroupScriptingStarted(const String &groupName, size_t scriptCount)
Internal event firing method.
void removeResourceGroupListener(ResourceGroupListener *l)
Removes a ResourceGroupListener.
Nested struct defining a resource declaration.
list< ResourcePtr >::type LoadUnloadResourceList
List of resources which can be loaded / unloaded.
FileInfoListPtr findResourceFileInfo(const String &group, const String &pattern, bool dirs=false)
Find all files or directories matching a given pattern in a group and get some detailed information a...
FileInfoListPtr listResourceFileInfo(const String &groupName, bool dirs=false)
List all files in a resource group with accompanying information.
void deleteResource(const String &filename, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, const String &locationPattern=StringUtil::BLANK)
Delete a single resource file.
ScriptLoaderOrderMap mScriptLoaderOrderMap
void createDeclaredResources(ResourceGroup *grp)
Create all the pre-declared resources.
const String & getWorldResourceGroupName(void) const
Gets the resource group that 'world' resources will use.
vector< String >::type StringVector
ResourceGroup * mCurrentGroup
Stored current group - optimisation for when bulk loading a group.
void setLoadingListener(ResourceLoadingListener *listener)
Sets a new loading listener.
void declareResource(const String &name, const String &resourceType, const String &groupName, ManualResourceLoader *loader, const NameValuePairList &loadParameters=NameValuePairList())
Declares a resource to be a part of a resource group, allowing you to load and unload it as part of t...
ResourceGroupListenerList mResourceGroupListenerList
void fireResourceLoadStarted(const ResourcePtr &resource)
Internal event firing method.
ResourceGroup * getResourceGroup(const String &name)
Get resource group.
SceneManager * worldGeometrySceneManager
Scene manager to use with linked world geometry.
static ResourceGroupManager & getSingleton(void)
Override standard Singleton retrieval.
virtual DataStreamPtr resourceLoading(const String &name, const String &group, Resource *resource)=0
This event is called when a resource beings loading.
void deleteGroup(ResourceGroup *grp)
Delete a group for shutdown - don't notify ResourceManagers.
void _notifyAllResourcesRemoved(ResourceManager *manager)
Internal method called by ResourceManager when all resources for that manager are removed.
bool isResourceGroupInitialised(const String &name)
Checks the status of a resource group.
void fireResourceCreated(const ResourcePtr &resource)
Internal event firing method.
bool isResourceGroupInGlobalPool(const String &name)
Checks the status of a resource group.
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
ResourceLoadingListener * mLoadingListener
void unloadResourceGroup(const String &name, bool reloadableOnly=true)
Unloads a resource group.
void fireResourceGroupPrepareStarted(const String &groupName, size_t resourceCount)
Internal event firing method.
void shutdownAll(void)
Shutdown all ResourceManagers, performed as part of clean-up.
void _notifyResourceGroupChanged(const String &oldGroup, Resource *res)
Internal method to notify the group manager that a resource has changed group (only applicable for au...
ResourceManagerMap mResourceManagerMap
Map of resource types (strings) to ResourceManagers, used to notify them to load / unload group conte...
void _notifyResourceRemoved(ResourcePtr &res)
Internal method called by ResourceManager when a resource is removed.
virtual void resourceGroupPrepareStarted(const String &groupName, size_t resourceCount)
This event is fired when a resource group begins preparing.
void _registerResourceManager(const String &resourceType, ResourceManager *rm)
Internal method for registering a ResourceManager (which should be a singleton).
This abstract class defines an interface which is called back during resource group loading to indica...
void fireResourceGroupScriptingEnded(const String &groupName)
Internal event firing method.
list< ResourceDeclaration >::type ResourceDeclarationList
List of resource declarations.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
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.
ResourceGroupMap mResourceGroupMap
void removeFromIndex(const String &filename, Archive *arch)
multimap< Real, ScriptLoader * >::type ScriptLoaderOrderMap
Map of loading order (Real) to ScriptLoader, used to order script parsing.
void fireResourceGroupLoadStarted(const String &groupName, size_t resourceCount)
Internal event firing method.
String worldGeometry
Linked world geometry, as passed to setWorldGeometry.
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
void loadResourceGroup(const String &name, bool loadMainResources=true, bool loadWorldGeom=true)
Loads a resource group.
bool recursive
Whether this location was added recursively.
void initialiseAllResourceGroups(void)
Initialise all resource groups which are yet to be initialised.
bool isResourceGroupLoaded(const String &name)
Checks the status of a resource group.
ResourceDeclarationList resourceDeclarations
Pre-declared resources, ready to be created.
virtual void scriptParseEnded(const String &scriptName, bool skipped)=0
This event is fired when the script has been fully parsed.
list< ResourceLocation * >::type LocationList
List of possible file locations.
virtual ~ResourceGroupListener()
Manages the organisation and rendering of a 'scene' i.e.
void _notifyWorldGeometryStageEnded(void)
Notify this manager that one stage of world geometry loading has been completed.
void dropGroupContents(ResourceGroup *grp)
Drops contents of a group, leave group there, notify ResourceManagers.
virtual void resourceGroupLoadEnded(const String &groupName)=0
This event is fired when a resource group finished loading.
virtual void worldGeometryStageEnded(void)=0
This event is fired when a stage of loading linked world geometry has been completed.
void fireResourceGroupLoadEnded(const String &groupName)
Internal event firing method.
void fireResourcePrepareEnded(void)
Internal event firing method.
static ResourceGroupManager * getSingletonPtr(void)
Override standard Singleton retrieval.
ResourceLoadingListener * getLoadingListener()
Returns the current loading listener.
const LocationList & getResourceLocationList(const String &groupName)
Get the list of resource locations for the specified group name.
Template class for creating single-instance global classes.
static String DEFAULT_RESOURCE_GROUP_NAME
Default resource group name.
OGRE_AUTO_MUTEX
General mutex for dealing with group content.
virtual void resourceLoadStarted(const ResourcePtr &resource)=0
This event is fired when a declared resource is about to be loaded.
void destroyResourceGroup(const String &name)
Destroys a resource group, clearing it first, destroying the resources which are part of it,...
virtual void resourceGroupScriptingStarted(const String &groupName, size_t scriptCount)=0
This event is fired when a resource group begins parsing scripts.
void addResourceLocation(const String &name, const String &locType, const String &resGroup=DEFAULT_RESOURCE_GROUP_NAME, bool recursive=false, bool readOnly=true)
Method to add a resource location to for a given resource group.
void fireResourceLoadEnded(void)
Internal event firing method.
void fireResourceRemove(const ResourcePtr &resource)
Internal event firing method.
map< Real, LoadUnloadResourceList * >::type LoadResourceOrderMap
Created resources which are ready to be loaded / unloaded.
map< String, ResourceGroup * >::type ResourceGroupMap
Map from resource group names to groups.
void clearResourceGroup(const String &name)
Clears a resource group.
ResourceManagerIterator getResourceManagerIterator()
Get an iterator over the registered resource managers.
StringVectorPtr listResourceLocations(const String &groupName)
List all resource locations in a resource group.
DataStreamPtr openResource(const String &resourceName, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, bool searchGroupsIfNotFound=true, Resource *resourceBeingLoaded=0)
Open a single resource by name and return a DataStream pointing at the source of the data.
Defines a generic resource handler.
void removeResourceLocation(const String &name, const String &resGroup=DEFAULT_RESOURCE_GROUP_NAME)
Removes a resource location from the search path.
const String & findGroupContainingResource(const String &filename)
Find the group in which a resource exists.
void deleteMatchingResources(const String &filePattern, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, const String &locationPattern=StringUtil::BLANK)
Delete all matching resource files.
void setWorldResourceGroupName(const String &groupName)
Sets the resource group that 'world' resources will use.
virtual void worldGeometryStageStarted(const String &description)=0
This event is fired when a stage of loading linked world geometry is about to start.
void _notifyResourceCreated(ResourcePtr &res)
Internal method called by ResourceManager when a resource is created.
virtual ~ResourceGroupManager()
ResourceDeclarationList getResourceDeclarationList(const String &groupName)
Get the list of resource declarations for the specified group name.
StringVectorPtr findResourceLocation(const String &groupName, const String &pattern)
Find all resource location names matching a given pattern in a resource group.
DataStreamPtr createResource(const String &filename, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, bool overwrite=false, const String &locationPattern=StringUtil::BLANK)
Create a new resource file in a given group.
bool resourceExists(ResourceGroup *group, const String &filename)
Find out if the named file exists in a group.
Abstract class defining the interface used by classes which wish to perform script loading to define ...
Archive * archive
Pointer to the archive which is the destination.
virtual void resourcePrepareEnded(void)
This event is fired when the resource has been prepared.
virtual void resourcePrepareStarted(const ResourcePtr &resource)
This event is fired when a declared resource is about to be prepared.
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
void fireScriptEnded(const String &scriptName, bool skipped)
Internal event firing method.
void fireResourcePrepareStarted(const ResourcePtr &resource)
Internal event firing method.
StringVectorPtr listResourceNames(const String &groupName, bool dirs=false)
List all file or directory names in a resource group.
ManualResourceLoader * loader
Abstract class representing a loadable resource (e.g.
vector< ResourceGroupListener * >::type ResourceGroupListenerList
void addToIndex(const String &filename, Archive *arch)
Status groupStatus
Group status.
void unloadUnreferencedResourcesInGroup(const String &name, bool reloadableOnly=true)
Unload all resources which are not referenced by any other object.
map< String, Archive * >::type ResourceLocationIndex
Resource index entry, resourcename->location.
map< String, ResourceManager * >::type ResourceManagerMap
time_t resourceModifiedTime(const String &group, const String &filename)
Retrieve the modification time of a given file.
void linkWorldGeometryToResourceGroup(const String &group, const String &worldGeometry, SceneManager *sceneManager)
Associates some world geometry with a resource group, causing it to be loaded / unloaded with the res...
MapIterator< ResourceManagerMap > ResourceManagerIterator
StringVectorPtr findResourceNames(const String &groupName, const String &pattern, bool dirs=false)
Find all file or directory names matching a given pattern in a resource group.
void _notifyWorldGeometryStageStarted(const String &description)
Notify this manager that one stage of world geometry loading has been started.
void fireScriptStarted(const String &scriptName, bool &skipScript)
Internal event firing method.
ResourceLocationIndex resourceIndexCaseInsensitive
Index of resource names to locations, built for speedy access (case insensitive archives)
LoadResourceOrderMap loadResourceOrderMap
virtual void resourceCreated(const ResourcePtr &resource)
This event is fired when a resource was just created.
void removeFromIndex(Archive *arch)
void declareResource(const String &name, const String &resourceType, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, const NameValuePairList &loadParameters=NameValuePairList())
Declares a resource to be a part of a resource group, allowing you to load and unload it as part of t...
void _registerScriptLoader(ScriptLoader *su)
Internal method for registering a ScriptLoader.
virtual void scriptParseStarted(const String &scriptName, bool &skipThisScript)=0
This event is fired when a script is about to be parsed.
virtual void worldGeometryPrepareStageEnded(void)
This event is fired when a stage of preparing linked world geometry has been completed.
void prepareResourceGroup(const String &name, bool prepareMainResources=true, bool prepareWorldGeom=true)
Prepares a resource group.
virtual void resourceLoadEnded(void)=0
This event is fired when the resource has been loaded.
void parseResourceGroupScripts(ResourceGroup *grp)
Parses all the available scripts found in the resource locations for the given group,...
virtual ~ResourceLoadingListener()
StringVector getResourceGroups(void)
Get a list of the currently defined resource groups.
void fireResourceGroupPrepareEnded(const String &groupName)
Internal event firing method.
time_t resourceModifiedTime(ResourceGroup *group, const String &filename)
Internal modification time retrieval.
NameValuePairList parameters
virtual bool resourceCollision(Resource *resource, ResourceManager *resourceManager)=0
This event is called when a resource collides with another existing one in a resource manager.
LocationList locationList
List of possible locations to search.
Interface describing a manual resource loader.
void unlinkWorldGeometryFromResourceGroup(const String &group)
Clear any link to world geometry from a resource group.
virtual void resourceGroupLoadStarted(const String &groupName, size_t resourceCount)=0
This event is fired when a resource group begins loading.
DataStreamListPtr openResources(const String &pattern, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME)
Open all resources matching a given pattern (which can contain the character '*' as a wildcard),...
bool resourceExists(const String &group, const String &filename)
Find out if the named file exists in a group.
OGRE_MUTEX(statusMutex)
Status-specific mutex, separate from content-changing mutex.
String mWorldGroupName
Group name for world resources.
ResourceManager * _getResourceManager(const String &resourceType)
Internal method for getting a registered ResourceManager.
void _unregisterResourceManager(const String &resourceType)
Internal method for unregistering a ResourceManager.
void addCreatedResource(ResourcePtr &res, ResourceGroup &group)
Adds a created resource to a group.
bool resourceExistsInAnyGroup(const String &filename)
Find out if the named file exists in any group.
ResourceGroup * findGroupContainingResourceImpl(const String &filename)
Internal find method for auto groups.
This singleton class manages the list of resource groups, and notifying the various resource managers...
virtual void resourceGroupPrepareEnded(const String &groupName)
This event is fired when a resource group finished preparing.
virtual void resourceGroupScriptingEnded(const String &groupName)=0
This event is fired when a resource group finished parsing scripts.
void initialiseResourceGroup(const String &name)
Initialises a resource group.
void addResourceGroupListener(ResourceGroupListener *l)
Adds a ResourceGroupListener which will be called back during resource loading events.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.