ResourceRef< resType, initType > Class Template Reference

The class used to access resource data. More...

#include <Memory/ResourceManager.h>

List of all members.

Public Member Functions

 ResourceRef ()
 Default constructor. Constructs an invalid referance.
 ResourceRef (const ResourceRef &rf)
 Copy constructor.
bool IsValid () const
 Determines if the Resource is Valid and can be used.
bool operator! () const
 Overloaded boolean negation operator.
 operator bool () const
 Overloaded bool cast operator.
bool operator== (const ResourceRef &ref) const
 Overloaded equality operator.
bool operator!= (const ResourceRef &ref) const
 Overloaded equality operator.
ResourceID GetID () const
 Gets the ResourceID.
resType * operator-> ()
 Overloaded pointer dereferance operator.
const resType * operator-> () const
 Constant overloaded pointer dereferance operator.
void Invalidate ()
 Invalidates the ResourceRef setting it to NULL_REF in the process. Equivalent to setting the ResourceRef to NULL_REF.
ResourceRefoperator= (const ResourceRef &rhs)
 Overloaded assignment operator.

Detailed Description

template<class resType, class initType>
class ResourceRef< resType, initType >

The class used to access resource data.

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

A ResourceRef is returned by the Resource Manager when a resource is loaded. All operation on resource data should go throught this class. This class should be treated much like a pointer. Never keep a pointer to a ResourceRef, if you need to share a resource simply copy the ResourceRef. When passing a ResourceRef to a function, always pass by value.


Member Function Documentation

template<class resType , class initType >
ResourceID ResourceRef< resType, initType >::GetID (  )  const [inline]

Gets the ResourceID.

Returns:
The ResourceID for this ResourceRef, or NULL_RESOURCE if this ResourceRef is invalid.
template<class resType , class initType >
bool ResourceRef< resType, initType >::IsValid (  )  const [inline]

Determines if the Resource is Valid and can be used.

Returns:
True if the resource exists and can be used, false if the resource is invalid should not be used.
template<class resType , class initType >
ResourceRef< resType, initType >::operator bool (  )  const [inline]

Overloaded bool cast operator.

See also:
IsValid
Returns:
True if the resource exists and can be used, false if the resource is invalid should not be used.
template<class resType , class initType >
bool ResourceRef< resType, initType >::operator! (  )  const [inline]

Overloaded boolean negation operator.

See also:
IsValid
Returns:
True if the resource is invalid should not be used, false if the resource exists and can be used.
template<class resType , class initType >
bool ResourceRef< resType, initType >::operator!= ( const ResourceRef< resType, initType > &  ref  )  const [inline]

Overloaded equality operator.

Parameters:
[in] ref the ResourceRef to compare against.
Returns:
True if this ResourceRef and ref are not equal, false otherwise.
template<class resType , class initType >
const resType* ResourceRef< resType, initType >::operator-> (  )  const [inline]

Constant overloaded pointer dereferance operator.

Returns:
A const pointer to the Resource data object.
template<class resType , class initType >
resType* ResourceRef< resType, initType >::operator-> (  )  [inline]

Overloaded pointer dereferance operator.

Returns:
A pointer to the Resource data object.
template<class resType , class initType >
ResourceRef& ResourceRef< resType, initType >::operator= ( const ResourceRef< resType, initType > &  rhs  )  [inline]

Overloaded assignment operator.

Parameters:
[in] rhs the ResourceRef to set this ResourceRef to.
Returns:
A referance to this ResourceRef.
template<class resType , class initType >
bool ResourceRef< resType, initType >::operator== ( const ResourceRef< resType, initType > &  ref  )  const [inline]

Overloaded equality operator.

Parameters:
[in] ref the ResourceRef to compare against.
Returns:
True if this ResourceRef and ref are equal, false otherwise.

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