Resource< initType > Class Template Reference

The base type for all managed resources. More...

#include <Memory/ResourceManager.h>

List of all members.

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.

Detailed Description

template<class initType = VoidResourceInitData>
class Resource< initType >

The base type for all managed resources.

Template Parameters:
initType The data type of the object passed into the Load function. initType must have a default constructor and have the following operators overloaded:

  1. bool operator==(const initType&) const

Member Function Documentation

template<class initType = VoidResourceInitData>
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.

template<class initType = VoidResourceInitData>
const std::string& Resource< initType >::GetFileName (  )  const [inline]

Gets the file name for the resource.

Returns:
The file name for this resource.
template<class initType = VoidResourceInitData>
ResourceID Resource< initType >::GetID (  )  const [inline]

Gets the ResourceID for the resource.

Returns:
The ResoueceID for this resource or NULL_RESOURCEID if the resource is not valid.
template<class initType = VoidResourceInitData>
virtual bool Resource< initType >::Load ( const char *  filePath,
const char *  fileName,
const initType *  initData 
) [pure virtual]

Loads the specified resource.

Parameters:
[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.
See also:
Image
Font
Returns:
True if the resource was loaded succesfully, false otherwise.

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.


The documentation for this class was generated from the following file:
Generated on Mon Apr 5 19:08:06 2010 for BrickOut |ReDuX| by  doxygen 1.6.3