OSGK::CXXAPI::Wrap< T > Class Template Reference

Wrapper class for all OffscreenGecko objects; automatically handles reference counting. More...

#include <OffscreenGecko/baseobj.h>

List of all members.

Public Types

typedef T WrappedType
typedef Wrap WrapperType

Public Member Functions

T * Detach ()
 Return the wrapped object and clear it.
T * GetObject () const
 Directly get the wrapped object.
void Invalidate ()
 Release the reference.
bool IsValid () const
 Check if the reference pointed to is valid.
Wrapoperator= (const Wrap &other)
 Copy the object from another reference.
void SetObject (T *obj)
 Directly set the wrapped object.
 Wrap (const Wrap &other)
 Construct by adding another reference to an object.
 Wrap (T *obj)
 Construct with taking ownership of a given object.
 ~Wrap ()
 Release reference to an object.

Static Public Member Functions

static WrappedTypeNull ()
 Return a null instance of the wrapped object type.

Protected Attributes

T * obj
 Wrapped object.


Detailed Description

template<typename T>
class OSGK::CXXAPI::Wrap< T >

Wrapper class for all OffscreenGecko objects; automatically handles reference counting.

Member Typedef Documentation

template<typename T>
typedef T OSGK::CXXAPI::Wrap< T >::WrappedType

template<typename T>
typedef Wrap OSGK::CXXAPI::Wrap< T >::WrapperType


Constructor & Destructor Documentation

template<typename T>
OSGK::CXXAPI::Wrap< T >::Wrap ( T *  obj  )  [inline, explicit]

Construct with taking ownership of a given object.

template<typename T>
OSGK::CXXAPI::Wrap< T >::Wrap ( const Wrap< T > &  other  )  [inline]

Construct by adding another reference to an object.

template<typename T>
OSGK::CXXAPI::Wrap< T >::~Wrap (  )  [inline]

Release reference to an object.


Member Function Documentation

template<typename T>
T* OSGK::CXXAPI::Wrap< T >::Detach (  )  [inline]

Return the wrapped object and clear it.

Equivalent to

 x = obj.GetObject(); obj.SetObject (0);
Warning:
Does not decrease the reference count of the object!

template<typename T>
T* OSGK::CXXAPI::Wrap< T >::GetObject (  )  const [inline]

Directly get the wrapped object.

template<typename T>
void OSGK::CXXAPI::Wrap< T >::Invalidate (  )  [inline]

Release the reference.

template<typename T>
bool OSGK::CXXAPI::Wrap< T >::IsValid (  )  const [inline]

Check if the reference pointed to is valid.

template<typename T>
static WrappedType* OSGK::CXXAPI::Wrap< T >::Null (  )  [inline, static]

Return a null instance of the wrapped object type.

Useful when creating objects in a delayed fashion.

template<typename T>
Wrap& OSGK::CXXAPI::Wrap< T >::operator= ( const Wrap< T > &  other  )  [inline]

Copy the object from another reference.

template<typename T>
void OSGK::CXXAPI::Wrap< T >::SetObject ( T *  obj  )  [inline]

Directly set the wrapped object.

Warning:
Does not increase the reference count of the new object or decrease the reference count of the old! Use an assignment operator for that.


Member Data Documentation

template<typename T>
T* OSGK::CXXAPI::Wrap< T >::obj [protected]

Wrapped object.


The documentation for this class was generated from the following file:
Generated on Sun Nov 2 18:15:18 2008 for OffscreenGecko by  doxygen 1.5.4