Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::ResourceManager< A, HANDLE > Class Template Reference

#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 ()
 

Detailed Description

template<typename A, typename HANDLE>
class Ult::ResourceManager< A, HANDLE >

Central storage location for all objects of type A.

Constructor & Destructor Documentation

◆ ResourceManager()

template<typename A, typename HANDLE>
Ult::ResourceManager< A, HANDLE >::ResourceManager ( int hashSize = 0)

ResourceManager constructor with optional HashTable size.

◆ ~ResourceManager()

template<typename A, typename HANDLE>
Ult::ResourceManager< A, HANDLE >::~ResourceManager ( )
virtual

ResourceManger destructor.

Member Function Documentation

◆ Create()

template<typename A, typename HANDLE>
bool Ult::ResourceManager< A, HANDLE >::Create ( A * res,
const char * name,
HANDLE * handle )

Store and create a handle to the allocated A instance.

Parameters
resPointer to the object to store. Will be freed by the ResourceManager either on ResourceManager's destructor or a call to Release.
nameOptional string to use for the object's storage in the hash table. Can be used to obtain the accessor index from GetRegisteredIndex.
handleResult output handle to the A object.
Returns
True on success, false on failure.

◆ GetObjects()

template<typename A, typename HANDLE>
std::vector< A * > * Ult::ResourceManager< A, HANDLE >::GetObjects ( )

Get all of the objects stored in this manager.

◆ GetRegisteredIndex()

template<typename A, typename HANDLE>
int Ult::ResourceManager< A, HANDLE >::GetRegisteredIndex ( const char * name)

Find the accessor index of the object with the given input hash name.

Returns
-1 if not found, the accessor index otherwise.

◆ GetResource()

template<typename A, typename HANDLE>
A * Ult::ResourceManager< A, HANDLE >::GetResource ( const HANDLE & handle)

Get a pointer to the A instance given by the input handle.

◆ GetSize()

template<typename A, typename HANDLE>
int Ult::ResourceManager< A, HANDLE >::GetSize ( )

Returns the number of objects in this manager.

◆ Release()

template<typename A, typename HANDLE>
void Ult::ResourceManager< A, HANDLE >::Release ( HANDLE & handle)

Free the object given by the input handle.


The documentation for this class was generated from the following files: