This is the manager responsible for the loading and unloading of files. More...
#include <resourcemanager.h>
Public Types | |
typedef std::map< String, AssetGroup * > | AssetGroupContainer |
Basic container type for AssetGroup storage in this class. | |
typedef AssetGroupContainer::iterator | AssetGroupIterator |
Iterator type for AssetGroup instances stored in this class. | |
typedef AssetGroupContainer::const_iterator | ConstAssetGroupIterator |
Const Iterator type for AssetGroup instances stored in this class. | |
typedef DataStreamContainer::const_iterator | ConstDataStreamIterator |
Const Iterator type for DataStream instances stored by this class. | |
typedef NamedDataStreamContainer::const_iterator | ConstNamedDataStreamIterator |
Const Iterator type for named DataStream instances stored by this class. | |
typedef std::vector< Resource::DataStreamPtr > | DataStreamContainer |
Basic container type for DataStream storage by this class. | |
typedef DataStreamContainer::iterator | DataStreamIterator |
Iterator type for DataStream instances stored by this class. | |
typedef std::map< String, Resource::DataStreamPtr > | NamedDataStreamContainer |
Basic container type for named DataStream storage by this class. | |
typedef NamedDataStreamContainer::iterator | NamedDataStreamIterator |
Iterator type for named DataStream instances stored by this class. | |
Public Types inherited from Mezzanine::ManagerBase | |
enum | ManagerType { MT_Undefined = 0, MT_AudioManager = 1, MT_AnimationManager = 2, MT_CollisionShapeManager = 3, MT_CompositorManager = 4, MT_GraphicsManager = 5, MT_EventManager = 6, MT_InputManager = 7, MT_LogManager = 8, MT_MaterialManager = 9, MT_MeshManager = 10, MT_NetworkManager = 11, MT_ResourceManager = 12, MT_ScriptingManager = 13, MT_TextureManager = 14, MT_UIManager = 15, MT_ActorManager = 101, MT_AreaEffectManager = 102, MT_DebrisManager = 103, MT_PagingManager = 104, MT_PhysicsManager = 105, MT_SceneManager = 106, MT_SoundScapeManager = 107, MT_TerrainManager = 108, MT_VehicleManager = 109, MT_UserCreated = 512 } |
A listing of Manager Types. More... | |
Public Member Functions | |||
ResourceManager (const String &EngineDataPath=".", const ArchiveType ArchType=AT_FileSystem) | |||
Class constructor. More... | |||
ResourceManager (const XML::Node &XMLNode) | |||
XML constructor. More... | |||
virtual | ~ResourceManager () | ||
void | AddAssetLocation (const String &Location, const ArchiveType Type, const String &Group, const Boole Recursive=false) | ||
Adds a location for graphical resources. More... | |||
AssetGroup * | CreateAssetGroup (const String &GroupName) | ||
Creates a new asset group. More... | |||
Resource::DataStreamPtr | CreateDataStream (void *Buffer, const UInt32 BufferSize) | ||
Creates a stream from a memory buffer. More... | |||
Resource::DataStreamPtr | CreateDataStream (const String &AssetName, void *Buffer, const UInt32 BufferSize) | ||
Creates a named stream from a memory buffer. More... | |||
Resource::DataStreamPtr | CreateDataStream (const String &AssetName, const String &GroupName, void *Buffer, const UInt32 BufferSize) | ||
Creates a named stream from a memory buffer and adds it to the named AssetGroup. More... | |||
virtual void | Deinitialize () | ||
Removes this manager from any necessary configuration so it can be safely disposed of. More... | |||
void | DestroyAllAssetGroups () | ||
Destroys all asset groups being stored by this manager. | |||
void | DestroyAssetGroup (const String &GroupName) | ||
Destroys an asset group, unloading all of it's resources. More... | |||
void | DestroyAssetGroup (AssetGroup *ToBeDestroyed) | ||
Destroys an asset group, unloading all of it's resources. More... | |||
AssetGroup * | GetAssetGroup (const String &GroupName) | ||
Gets an AssetGroup by name. More... | |||
AssetGroup * | GetAssetGroupExcept (const String &GroupName) | ||
Gets an AssetGroup by name.
| |||
String | GetAssetPath (const String &FileName, const String &Group) | ||
Gets the actual path to an asset. More... | |||
String | GetEngineDataDirectory () const | ||
Get the pathname where engine data is stored. More... | |||
virtual String | GetImplementationTypeName () const | ||
This Allows any manager name to be sent to a stream. Primarily used for logging. More... | |||
virtual ManagerType | GetInterfaceType () const | ||
This returns the type of this manager. More... | |||
AssetGroup * | GetOrCreateAssetGroup (const String &GroupName) | ||
Gets an AssetGroup by name. If it does not exist it will be created. More... | |||
String | GetPluginExtension () const | ||
Gets the dot-and-extention of this platforms plugins. More... | |||
void | InitAssetGroup (const String &GroupName) | ||
Makes a asset group ready to use. More... | |||
virtual void | Initialize () | ||
Configures this manager for use prior to entering the main loop. More... | |||
Resource::DataStreamPtr | OpenAssetStream (const String &AssetName, const String &GroupName) | ||
Opens a stream to an asset in an AssetGroup. More... | |||
Public Member Functions inherited from Mezzanine::EntresolManager | |||
EntresolManager () | |||
Class constructor. | |||
virtual | ~EntresolManager () | ||
Class destructor. | |||
Public Member Functions inherited from Mezzanine::ManagerBase | |||
ManagerBase () | |||
Class constructor. | |||
virtual | ~ManagerBase () | ||
Class destructor. | |||
virtual String | GetInterfaceTypeAsString () const | ||
Gets a string of the interface type of this manager. More... | |||
Boole | IsInitialized () const | ||
Gets whether or not this manager has been initialized. More... | |||
Public Member Functions inherited from Mezzanine::Singleton< ResourceManager > | |||
~Singleton () | |||
Class destructor. | |||
Static Public Member Functions | |
static Resource::ArchiveType | GetArchiveTypeFromString (const String &FromString) |
Gets an ArchiveType from a string. More... | |
static String | GetStringFromArchiveType (const Resource::ArchiveType ArchType) |
Gets a string that describes an ArchiveType. More... | |
Static Public Member Functions inherited from Mezzanine::ManagerBase | |
static String | GetTypeAsString (const ManagerType &ManagerType) |
Gets the string form of the type of manager. More... | |
static ManagerType | GetTypeFromString (const String &ManagerName) |
Gets the type of manager requested from a string. More... | |
Static Public Member Functions inherited from Mezzanine::Singleton< ResourceManager > | |
static ResourceManager * | GetSingletonPtr () |
Fetches a pointer to the singleton. More... | |
static Boole | SingletonValid () |
Checks to see if the singleton pointer is valid. More... | |
Static Public Attributes | |
static const String | ImplementationName = "DefaultResourceManager" |
A String containing the name of this manager implementation. | |
static const ManagerBase::ManagerType | InterfaceType = ManagerBase::MT_ResourceManager |
A ManagerType enum value used to describe the type of interface/functionality this manager provides. | |
Protected Attributes | |
AssetGroupContainer | AssetGroups |
Container storing all of the asset groups created and managed by this manager. More... | |
String | EngineDataDir |
The location of engine data. More... | |
Ogre::ResourceGroupManager * | OgreResource |
Encapsulates the functionality of the ogre resource group manager. More... | |
Protected Attributes inherited from Mezzanine::ManagerBase | |
Boole | Initialized |
Simple Boole indicating whether or not this manager has been initialized. More... | |
Entresol * | TheEntresol |
The actual pointer to the Entresol core class. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Mezzanine::Singleton< ResourceManager > | |
Singleton () | |
Class constructor. | |
Static Protected Attributes inherited from Mezzanine::Singleton< ResourceManager > | |
static ResourceManager * | SingletonPtr |
The one and only pointer to the single object. More... | |
This is the manager responsible for the loading and unloading of files.
This class is responsible for the reading and writing of files of all kinds, be it graphical meshes, physics data, or XMl files.
Definition at line 76 of file resourcemanager.h.
Mezzanine::Resource::ResourceManager::ResourceManager | ( | const String & | EngineDataPath = "." , |
const ArchiveType | ArchType = AT_FileSystem |
||
) |
Class constructor.
Standard manager constructor.
EngineDataPath | The directory for engine specific data. |
ArchiveType | The name of the type of archive at this path. |
Definition at line 70 of file resourcemanager.cpp.
Mezzanine::Resource::ResourceManager::ResourceManager | ( | const XML::Node & | XMLNode | ) |
XML constructor.
XMLNode | The node of the xml document to construct from. |
Definition at line 78 of file resourcemanager.cpp.
|
virtual |
Class Destructor.
Definition at line 85 of file resourcemanager.cpp.
void Mezzanine::Resource::ResourceManager::AddAssetLocation | ( | const String & | Location, |
const ArchiveType | Type, | ||
const String & | Group, | ||
const Boole | Recursive = false |
||
) |
Adds a location for graphical resources.
This function will add a location on the disk to find files needed to create and manipulate graphical objects. Once an asset is added it must be initalized using ResourceManager::InitResourceGroup(String Group).
Location | The location on the file system the asset can be found. |
Type | The kind of file system the location can be found in. Options are: filesystem, zip. |
Group | The name of the group the resources at this location belong to. If the group does not exist it will be created. |
Recursive | Whether or not to search sub-directories. |
Definition at line 109 of file resourcemanager.cpp.
AssetGroup * Mezzanine::Resource::ResourceManager::CreateAssetGroup | ( | const String & | GroupName | ) |
Creates a new asset group.
GroupName | The name to be given to the created asset group. |
Definition at line 115 of file resourcemanager.cpp.
Resource::DataStreamPtr Mezzanine::Resource::ResourceManager::CreateDataStream | ( | void * | Buffer, |
const UInt32 | BufferSize | ||
) |
Creates a stream from a memory buffer.
Buffer | A pointer to the memory to stream from. |
BufferSize | The size of the provided buffer in bytes. |
Definition at line 97 of file resourcemanager.cpp.
Resource::DataStreamPtr Mezzanine::Resource::ResourceManager::CreateDataStream | ( | const String & | AssetName, |
void * | Buffer, | ||
const UInt32 | BufferSize | ||
) |
Creates a named stream from a memory buffer.
AssetName | The name to be given to the created stream. |
Buffer | A pointer to the memory to stream from. |
BufferSize | The size of the provided buffer in bytes. |
Definition at line 100 of file resourcemanager.cpp.
Resource::DataStreamPtr Mezzanine::Resource::ResourceManager::CreateDataStream | ( | const String & | AssetName, |
const String & | GroupName, | ||
void * | Buffer, | ||
const UInt32 | BufferSize | ||
) |
Creates a named stream from a memory buffer and adds it to the named AssetGroup.
AssetName | The name to be given to the created stream. |
GroupName | The name of the AssetGroup this stream will be added to. |
Buffer | A pointer to the memory to stream from. |
BufferSize | The size of the provided buffer in bytes. |
Definition at line 103 of file resourcemanager.cpp.
|
virtual |
Removes this manager from any necessary configuration so it can be safely disposed of.
Implements Mezzanine::ManagerBase.
Definition at line 223 of file resourcemanager.cpp.
void Mezzanine::Resource::ResourceManager::DestroyAssetGroup | ( | const String & | GroupName | ) |
Destroys an asset group, unloading all of it's resources.
GroupName | The name of the asset group to destroy. |
Definition at line 154 of file resourcemanager.cpp.
void Mezzanine::Resource::ResourceManager::DestroyAssetGroup | ( | AssetGroup * | ToBeDestroyed | ) |
Destroys an asset group, unloading all of it's resources.
ToBeDestroyed | A pointer to the asset group to be destroyed. |
Definition at line 163 of file resourcemanager.cpp.
|
static |
Gets an ArchiveType from a string.
FromString | The string to be converted to an archive type. |
Definition at line 242 of file resourcemanager.cpp.
AssetGroup * Mezzanine::Resource::ResourceManager::GetAssetGroup | ( | const String & | GroupName | ) |
Gets an AssetGroup by name.
GroupName | The name of the AssetGroup to retrieve. |
Definition at line 136 of file resourcemanager.cpp.
AssetGroup * Mezzanine::Resource::ResourceManager::GetAssetGroupExcept | ( | const String & | GroupName | ) |
Gets an AssetGroup by name.
If | the requested AssetGroup is not found this will throw an exception. |
GroupName | The name of the AssetGroup to retrieve. |
Definition at line 145 of file resourcemanager.cpp.
String Mezzanine::Resource::ResourceManager::GetAssetPath | ( | const String & | FileName, |
const String & | Group | ||
) |
Gets the actual path to an asset.
FileName | The name of the file to search for. |
Group | The asset group to search in for the file. |
Definition at line 186 of file resourcemanager.cpp.
String Mezzanine::Resource::ResourceManager::GetEngineDataDirectory | ( | ) | const |
Get the pathname where engine data is stored.
Definition at line 202 of file resourcemanager.cpp.
|
virtual |
This Allows any manager name to be sent to a stream. Primarily used for logging.
Implements Mezzanine::ManagerBase.
Definition at line 258 of file resourcemanager.cpp.
|
virtual |
This returns the type of this manager.
This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.
Implements Mezzanine::ManagerBase.
Definition at line 255 of file resourcemanager.cpp.
AssetGroup * Mezzanine::Resource::ResourceManager::GetOrCreateAssetGroup | ( | const String & | GroupName | ) |
Gets an AssetGroup by name. If it does not exist it will be created.
GroupName | The name of the group to create or retrieve. |
Definition at line 127 of file resourcemanager.cpp.
String Mezzanine::Resource::ResourceManager::GetPluginExtension | ( | ) | const |
Gets the dot-and-extention of this platforms plugins.
Definition at line 207 of file resourcemanager.cpp.
|
static |
Gets a string that describes an ArchiveType.
ArchType | A ArchiveType That you want to log or pass to Ogre, or just need a String that represents it. |
Definition at line 228 of file resourcemanager.cpp.
void Mezzanine::Resource::ResourceManager::InitAssetGroup | ( | const String & | GroupName | ) |
Makes a asset group ready to use.
After adding all of your assets and declaring them as nessessary, this function is the final step. After calling this function any and all assets within the defined group will be ready to use. Do not initialize any more groups then you need to however, as that will take up memory and drop performance.
GroupName | Name of the asset group. |
Definition at line 175 of file resourcemanager.cpp.
|
virtual |
Configures this manager for use prior to entering the main loop.
Implements Mezzanine::ManagerBase.
Definition at line 218 of file resourcemanager.cpp.
Resource::DataStreamPtr Mezzanine::Resource::ResourceManager::OpenAssetStream | ( | const String & | AssetName, |
const String & | GroupName | ||
) |
Opens a stream to an asset in an AssetGroup.
AssetName | The identity of the asset to be opened (commonly a file name). |
GroupName | The name of the AssetGroup where the Asset can be found. |
Definition at line 94 of file resourcemanager.cpp.
|
protected |
Container storing all of the asset groups created and managed by this manager.
Definition at line 106 of file resourcemanager.h.
|
protected |
The location of engine data.
Definition at line 109 of file resourcemanager.h.
|
protected |
Encapsulates the functionality of the ogre resource group manager.
Definition at line 112 of file resourcemanager.h.