The base type for all managed resources. More...
#include <Memory/ResourceManager.h>
Public Member Functions | |
const std::string & | GetFileName () const |
Gets the file name for the resource. | |
ResourceID | GetID () const |
Gets the ResourceID for the resource. | |
virtual bool | Load (const char *filePath, const char *fileName, const initType *initData)=0 |
Loads the specified resource. | |
virtual void | Destroy ()=0 |
Destroys the resource. | |
virtual uint | GetDataUsageInBytes () const |
Estimates the number of bytes used by the loaded resource. |
The base type for all managed resources.
initType | The data type of the object passed into the Load function. initType must have a default constructor and have the following operators overloaded:
|
virtual void Resource< initType >::Destroy | ( | ) | [pure virtual] |
Destroys the resource.
Deallocates all data allocated when the resource was loaded. Must be implemented by all classes that inherit from the Resource class but should never be called outside of the ResourceMgr class.
Implemented in Font, Image, SoundSample, and SoundStream.
const std::string& Resource< initType >::GetFileName | ( | ) | const [inline] |
Gets the file name for the resource.
ResourceID Resource< initType >::GetID | ( | ) | const [inline] |
Gets the ResourceID for the resource.
virtual bool Resource< initType >::Load | ( | const char * | filePath, | |
const char * | fileName, | |||
const initType * | initData | |||
) | [pure virtual] |
Loads the specified resource.
[in] | filePath | the full path to the resource including the file name. |
[in] | fileName | the name of the resource file. |
[in] | initData | a pointer to the initialization data, can be NULL. |
This function must be implemented by all resources but should never be called outside of the ResourceMgr class. The helper macro pairs DECLARE_RESOURCE_LOAD_FUNCTION / IMPLEMENT_RESOURCE_LOAD_FUNCTION and DECLARE_COMPLEX_RESOURCE_LOAD_FUNCTION / IMPLEMENT_COMPLEX_RESOURCE_LOAD_FUNCTION can be used in child classes.