Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
|
#include <ResourceManager.h>
Public Member Functions | |
ResourceManager (int hashSize=0) | |
virtual | ~ResourceManager () |
bool | Create (A *res, const char *name, HANDLE *handle) |
void | Release (HANDLE &handle) |
int | GetRegisteredIndex (const char *name) |
A * | GetResource (const HANDLE &handle) |
int | GetSize () |
std::vector< A * > * | GetObjects () |
Central storage location for all objects of type A.
Ult::ResourceManager< A, HANDLE >::ResourceManager | ( | int | hashSize = 0 | ) |
ResourceManager constructor with optional HashTable size.
|
virtual |
ResourceManger destructor.
bool Ult::ResourceManager< A, HANDLE >::Create | ( | A * | res, |
const char * | name, | ||
HANDLE * | handle ) |
Store and create a handle to the allocated A instance.
res | Pointer to the object to store. Will be freed by the ResourceManager either on ResourceManager's destructor or a call to Release. |
name | Optional string to use for the object's storage in the hash table. Can be used to obtain the accessor index from GetRegisteredIndex. |
handle | Result output handle to the A object. |
std::vector< A * > * Ult::ResourceManager< A, HANDLE >::GetObjects | ( | ) |
Get all of the objects stored in this manager.
int Ult::ResourceManager< A, HANDLE >::GetRegisteredIndex | ( | const char * | name | ) |
Find the accessor index of the object with the given input hash name.
A * Ult::ResourceManager< A, HANDLE >::GetResource | ( | const HANDLE & | handle | ) |
Get a pointer to the A instance given by the input handle.
int Ult::ResourceManager< A, HANDLE >::GetSize | ( | ) |
Returns the number of objects in this manager.
void Ult::ResourceManager< A, HANDLE >::Release | ( | HANDLE & | handle | ) |
Free the object given by the input handle.