BengResource< T > Class Template Reference

#include <Resource.h>

List of all members.

Public Member Functions

 BengResource (void)
 ~BengResource (void)
T * loadData (const char *filepath)
T * getData (unsigned int index)
int getSize (void)
void clearData (void)


Detailed Description

template<typename T>
class BengResource< T >

The BengResource class is designed to hold media loaded externally. It consists of a list of several items of the same type which can be retrieved at any time. The list acts as a container of data which can be completely removed when necessary, simplifying resource management.

Ideally, a resource will contain related items, such as all the sprites to one character. In fact, a BengResource<BengISprite> is used internally by the layer and drawing routines to define a tileset. Since the class is templated, the container can hold any type you wish. Your class will need to follow this skeleton in order to be compatible:

MyClass::MyClass(const char *filepath)
{
this->data_ = myLoadDataFunction(filepath);

if (!this->data_)
return;

data_->myInitializationFunctions();
}

MyClass::~MyClass(void)
{
if (this->data_);
myUnloadDataFunction(this->data_);
}

void *MyClassgetRawData(void)
{
return this->data_;
}


Constructor & Destructor Documentation

template<typename T>
BengResource< T >::BengResource ( void   )  [inline]

template<typename T>
BengResource< T >::~BengResource ( void   )  [inline]


Member Function Documentation

template<typename T>
void BengResource< T >::clearData ( void   )  [inline]

template<typename T>
T* BengResource< T >::getData ( unsigned int  index  )  [inline]

template<typename T>
int BengResource< T >::getSize ( void   )  [inline]

template<typename T>
T* BengResource< T >::loadData ( const char *  filepath  )  [inline]


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

Generated on Sun May 3 21:56:25 2009 for BlitzzEngine by  doxygen 1.5.8