torque Torque Game Engine Documentation
CVS Revision Label 1.3.x

Resource< T > Class Template Reference

#include <resManager.h>


Detailed Description

template<class T>
class Resource< T >

Wrapper class around a ResourceInstance subclass.

       // Loading a resource...
       Resource<TerrainFile> terrRes;
          
       terrRes = ResourceManager->load(fileName);
       if(!bool(terrRes))
          Con::errorf(ConsoleLogEntry::General, "Terraformer::terrainFile - invalid terrain file '%s'.", fileName);

When the Resource<> is destroyed, it frees the lock on the resource.

See also:
ResManager


Public Member Functions

 Resource ()
 If assigned a ResourceObject, it's assumed to already have been locked, lock count is incremented only for copies or assignment from another Resource.
 Resource (ResourceObject *p)
 Resource (const Resource &res)
 ~Resource ()
 Decrements the lock count on this object, and if the lock count is 0 afterwards, adds the object to the timeoutList for deletion on execution of purge().
const char * getFilePath () const
 Returns the path of the file (without the actual name).
const char * getFileName () const
 Returns the actual file name (without the path).
Resourceoperator= (ResourceObject *p)
Resourceoperator= (const Resource &r)
U32 getCRC ()
bool isNull () const
 operator bool () const
T * operator-> ()
T & operator * ()
 operator T * () const
const T * operator-> () const
const T & operator * () const
 operator const T * () const
void unlock ()
void purge ()

Private Member Functions

void _lock ()
 Increments the lock count on this object.
void _unlock ()
 Decrements the lock count on this object.

Private Attributes

ResourceObjectobj
 Actual resource object.


Constructor & Destructor Documentation

template<class T>
Resource< T >::Resource  )  [inline]
 

If assigned a ResourceObject, it's assumed to already have been locked, lock count is incremented only for copies or assignment from another Resource.

template<class T>
Resource< T >::Resource ResourceObject p  )  [inline]
 

template<class T>
Resource< T >::Resource const Resource< T > &  res  )  [inline]
 

template<class T>
Resource< T >::~Resource  )  [inline]
 

Decrements the lock count on this object, and if the lock count is 0 afterwards, adds the object to the timeoutList for deletion on execution of purge().


Member Function Documentation

template<class T>
void Resource< T >::_lock  )  [inline, private]
 

Increments the lock count on this object.

template<class T>
void Resource< T >::_unlock  )  [inline, private]
 

Decrements the lock count on this object.

template<class T>
const char* Resource< T >::getFilePath  )  const [inline]
 

Returns the path of the file (without the actual name).

template<class T>
const char* Resource< T >::getFileName  )  const [inline]
 

Returns the actual file name (without the path).

template<class T>
Resource& Resource< T >::operator= ResourceObject p  )  [inline]
 

template<class T>
Resource& Resource< T >::operator= const Resource< T > &  r  )  [inline]
 

template<class T>
U32 Resource< T >::getCRC  )  [inline]
 

template<class T>
bool Resource< T >::isNull  )  const [inline]
 

template<class T>
Resource< T >::operator bool  )  const [inline]
 

template<class T>
T* Resource< T >::operator->  )  [inline]
 

template<class T>
T& Resource< T >::operator *  )  [inline]
 

template<class T>
Resource< T >::operator T *  )  const [inline]
 

template<class T>
const T* Resource< T >::operator->  )  const [inline]
 

template<class T>
const T& Resource< T >::operator *  )  const [inline]
 

template<class T>
Resource< T >::operator const T *  )  const [inline]
 

template<class T>
void Resource< T >::unlock  )  [inline]
 

template<class T>
void Resource< T >::purge  )  [inline]
 


Field Documentation

template<class T>
ResourceObject* Resource< T >::obj [private]
 

Actual resource object.




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen