|
TexGen
|
Object container to help handle memory management issues. More...
#include <ObjectContainer.h>
Public Member Functions | |
| CObjectContainer () | |
| CObjectContainer (const T &Object) | |
| CObjectContainer (const CObjectContainer< T > &CopyMe) | |
| ~CObjectContainer () | |
| CObjectContainer & | operator= (const CObjectContainer< T > &CopyMe) |
| CObjectContainer & | operator= (const T &Object) |
| operator T* () | |
| Conversion operator. More... | |
| T * | operator-> () |
| Pointer overload operator to act as a pointer of type T. More... | |
| void | Clear () |
| Remove the object contained within the container class. More... | |
| operator const T * () const | |
| Conversion operator for when the class is defined as const. More... | |
| const T * | operator-> () const |
| Pointer overload operator for the class when it is defined as const. More... | |
Private Attributes | |
| T * | m_pObject |
| Object contained within the class. More... | |
Object container to help handle memory management issues.
This class acts as a pointer to an object with a little more functionality. It is automatically initialised to NULL and whenever the object needs to be copied it creates a copy of the object it contains. The difference with a normal pointer is that a normal pointer will not create a copy of the object it points to. It simply creates a copy of the address, which can lead to problems when the object is deleted. The copied pointers will no longer be valid. This problem is avoided by creating a copy of the object it contains. For this to work the object must have a function called "Copy" that creates a copy of itself and returns a pointer to the new copy.
Note: This is NOT a reference counting system.
Definition at line 38 of file ObjectContainer.h.
|
inline |
Definition at line 41 of file ObjectContainer.h.
|
inline |
Definition at line 42 of file ObjectContainer.h.
|
inline |
Definition at line 46 of file ObjectContainer.h.
|
inline |
Definition at line 50 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject.
|
inline |
Remove the object contained within the container class.
Definition at line 80 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject, and NULL.
|
inline |
Conversion operator for when the class is defined as const.
Definition at line 82 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject.
|
inline |
Conversion operator.
If the container object is passed to a function that expects to receive an object of type T* then it will be converted automatically. Similarly if the container object is dereferenced an object of type T will be obtained.
Definition at line 76 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject.
|
inline |
Pointer overload operator to act as a pointer of type T.
Definition at line 78 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject.
|
inline |
Pointer overload operator for the class when it is defined as const.
Definition at line 84 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject.
|
inline |
Definition at line 54 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject, and NULL.
|
inline |
Definition at line 63 of file ObjectContainer.h.
References TexGen::CObjectContainer< T >::m_pObject.
|
private |
Object contained within the class.
Definition at line 87 of file ObjectContainer.h.
Referenced by TexGen::CObjectContainer< T >::Clear(), TexGen::CObjectContainer< T >::operator const T *(), TexGen::CObjectContainer< T >::operator T*(), TexGen::CObjectContainer< T >::operator->(), TexGen::CObjectContainer< T >::operator=(), and TexGen::CObjectContainer< T >::~CObjectContainer().