ResourceMgr< resType, initType > Class Template Reference

Loads and manages Resource data of a spacific type. More...

#include <Memory/ResourceManager.h>

List of all members.

Public Member Functions

 ResourceMgr ()
 Constructor.
 ~ResourceMgr ()
 Deconstructor.
void SetDefaultResource (const char *defaultResourcePath, const initType *initData=NULL)
 Sets the default resource to use when a resource is loaded that doesn't exist.
ref_type LoadResource (const char *fileName, const initType *initData=NULL, bool useResourcePath=true)
 Loads a resource.
void DestoryAllResources ()
 Destroys all resouces. All resource managed by this class will become invalid.
uint GetDataUsageInBytes ()
 Estimates the total number of bytes used by all managed resources.
uint GetNumberOfResourcesLoaded ()
 Gets the number of resources being managed.
void SetResourcePath (const char *p)
 Sets a path to be concatenated onto all file names when loading resources.
std::vector< resType * > GetResources () const
 Gets the resource data.

Friends

class ResourceRef< resType, initType >

Detailed Description

template<class resType, class initType>
class ResourceMgr< resType, initType >

Loads and manages Resource data of a spacific type.

Template Parameters:
resType The type of the Resource being managed. Must inherit from the Resource class.
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 resType , class initType >
uint ResourceMgr< resType, initType >::GetDataUsageInBytes (  )  [inline]

Estimates the total number of bytes used by all managed resources.

Returns:
The estimated number of bytes used.
template<class resType , class initType >
uint ResourceMgr< resType, initType >::GetNumberOfResourcesLoaded (  )  [inline]

Gets the number of resources being managed.

Returns:
The number of managed resources.
template<class resType , class initType >
std::vector<resType*> ResourceMgr< resType, initType >::GetResources (  )  const [inline]

Gets the resource data.

Returns:
The vector of resources.
template<class resType , class initType >
ResourceRef< resType, initType > ResourceMgr< resType, initType >::LoadResource ( const char *  fileName,
const initType *  initData = NULL,
bool  useResourcePath = true 
) [inline]

Loads a resource.

Parameters:
[in] fileName name of the resource file to load.
[in] initData pointer to the initialization data. Defaults to NULL.
[in] useResourcePath set to true to use the currently set resource path. Defaults to true.
Returns:
A Resource Referance to the loaded data or an invalid if the file couldn't be loaded.
template<class resType , class initType >
void ResourceMgr< resType, initType >::SetDefaultResource ( const char *  defaultResourcePath,
const initType *  initData = NULL 
) [inline]

Sets the default resource to use when a resource is loaded that doesn't exist.

Parameters:
[in] defaultResourcePath the path to a default resource that must exist or NULL if no default resource is needed.
[in] initData the initialization data for the default resource. Defaults to NULL.
template<class resType , class initType >
void ResourceMgr< resType, initType >::SetResourcePath ( const char *  p  )  [inline]

Sets a path to be concatenated onto all file names when loading resources.

Parameters:
[in] p the path.

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