40 #ifndef _resourcemanager_cpp
41 #define _resourcemanager_cpp
44 #include "Resource/resourceenumerations.h"
47 #include "Resource/assetgroup.h"
49 #include "Graphics/meshmanager.h"
51 #include "stringtool.h"
63 template<> Resource::ResourceManager* Singleton<Resource::ResourceManager>::SingletonPtr = NULL;
72 this->
OgreResource = Ogre::ResourceGroupManager::getSingletonPtr();
80 this->
OgreResource = Ogre::ResourceGroupManager::getSingletonPtr();
140 return (*GroupIt).second;
151 return (*GroupIt).second;
158 delete (*GroupIt).second;
171 {
delete (*GroupIt).second; }
179 (*GroupIt).second->InitializeAssets();
188 Ogre::FileInfoListPtr FileList = this->
OgreResource->listResourceFileInfo(Group);
189 for(
Whole X = 0 ; X < FileList->size() ; ++X )
191 if( FileName == FileList->at(X).filename ) {
193 return FileList->at(X).archive->getName() +
"/" + FileList->at(X).path;
233 return String(
"FileSystem");
244 if(
String(
"FileSystem")==FromString)
246 if(
String(
"Zip")==FromString)
282 if( Params.empty() ) {
286 String EngineDataPath =
".";
288 for( NameValuePairList::const_iterator ParIt = Params.begin() ; ParIt != Params.end() ; ++ParIt )
290 String Lower = (*ParIt).first;
292 if(
"enginedatapath" == Lower ) {
293 EngineDataPath = (*ParIt).second;
294 }
else if(
"archivetype" == Lower ) {
311 {
delete ToBeDestroyed; }
virtual String GetImplementationTypeName() const
This Allows any manager name to be sent to a stream. Primarily used for logging.
DefaultResourceManagerFactory()
Class constructor.
virtual ~DefaultResourceManagerFactory()
Class destructor.
Thrown when duplicates of teh same identity string exist.
AssetGroup * GetOrCreateAssetGroup(const String &GroupName)
Gets an AssetGroup by name. If it does not exist it will be created.
bool Boole
Generally acts a single bit, true or false.
Resource::DataStreamPtr OpenAssetStream(const String &AssetName, const String &GroupName)
Opens a stream to an asset in an AssetGroup.
Ogre::ResourceGroupManager * OgreResource
Encapsulates the functionality of the ogre resource group manager.
AssetGroup * CreateAssetGroup(const String &GroupName)
Creates a new asset group.
String EngineDataDir
The location of engine data.
ManagerType
A listing of Manager Types.
ManagerBase::ManagerType GetManagerType() const
Gets the type of manager that is created by this factory.
Thrown when the requested identity could not be found.
void InitAssetGroup(const String &GroupName)
Makes a asset group ready to use.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
String GetManagerImplName() const
Gets the name of the manager that is created by this factory.
A simple reference counting pointer.
Declaration of FileStream.
virtual void Deinitialize()
Removes this manager from any necessary configuration so it can be safely disposed of...
String GetAssetPath(const String &FileName, const String &Group)
Gets the actual path to an asset.
ArchiveType
Used to indicate what kind of resources the Entrosol should look for.
const String & GetName() const
Gets the name of this asset group.
static Resource::ArchiveType GetArchiveTypeFromString(const String &FromString)
Gets an ArchiveType from a string.
static Boole SingletonValid()
Checks to see if the singleton pointer is valid.
static ResourceManager * GetSingletonPtr()
Fetches a pointer to the singleton.
This is the base class for all managers that do no describe properties of a single world...
Resource::DataStreamPtr CreateDataStream(void *Buffer, const UInt32 BufferSize)
Creates a stream from a memory buffer.
AssetGroupContainer::iterator AssetGroupIterator
Iterator type for AssetGroup instances stored in this class.
A light-weight handle for manipulating nodes in DOM tree.
uint32_t UInt32
An 32-bit unsigned integer.
String GetEngineDataDirectory() const
Get the pathname where engine data is stored.
static const String ImplementationName
A String containing the name of this manager implementation.
This is the manager responsible for the loading and unloading of files.
This is a class that stores a specific grouping of Assets, usually based on thier location...
The defintion of the Resource Manager.
Resource::DataStreamPtr CreateDataStream(void *Buffer, const UInt32 BufferSize)
Creates a stream from a memory buffer.
void AddAssetLocation(const String &Location, const ArchiveType Type, const String &Group, const Boole Recursive=false)
Adds a location for graphical resources.
void DestroyManager(EntresolManager *ToBeDestroyed)
Destroys a Manager created by this factory.
Declaration of MemoryStream.
std::list< NameValuePair > NameValuePairList
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
static String GetStringFromArchiveType(const Resource::ArchiveType ArchType)
Gets a string that describes an ArchiveType.
Look for stuff in zip files even if the extension is not '.zip'.
Thrown when parameters are checked at runtime and found invalid.
virtual void Initialize()
Configures this manager for use prior to entering the main loop.
virtual ~ResourceManager()
EntresolManager * CreateManager(const NameValuePairList &Params)
Creates a manager of the type represented by this factory.
String GetPluginExtension() const
Gets the dot-and-extention of this platforms plugins.
AssetGroupContainer AssetGroups
Container storing all of the asset groups created and managed by this manager.
void DestroyAllAssetGroups()
Destroys all asset groups being stored by this manager.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
ResourceManager(const String &EngineDataPath=".", const ArchiveType ArchType=AT_FileSystem)
Class constructor.
AssetGroup * GetAssetGroup(const String &GroupName)
Gets an AssetGroup by name.
AssetGroup * GetAssetGroupExcept(const String &GroupName)
Gets an AssetGroup by name. the requested AssetGroup is not found this will throw an exception...
static const ManagerBase::ManagerType InterfaceType
A ManagerType enum value used to describe the type of interface/functionality this manager provides...
void DestroyAssetGroup(const String &GroupName)
Destroys an asset group, unloading all of it's resources.
Indicates this valid was messed up unrecoverably, most likely by a bug.
Resource::DataStreamPtr OpenAssetStream(const String &AssetName)
Opens a stream to an asset in an AssetGroup.
std::string String
A datatype used to a series of characters.
virtual ManagerType GetInterfaceType() const
This returns the type of this manager.
Boole Initialized
Simple Boole indicating whether or not this manager has been initialized.