Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CEGUI::RefCounted< T > Class Template Reference

Simple, generic, reference counted pointer class. This is primarily here for use by the Events system to track when to delete slot bindings. More...

+ Inheritance diagram for CEGUI::RefCounted< T >:

Public Member Functions

 RefCounted ()
 Default constructor.
 
 RefCounted (T *ob)
 Contruct a RefCounted object that wraps the pointer ob.
 
 RefCounted (const RefCounted< T > &other)
 Copy constructor.
 
 ~RefCounted ()
 Destructor. Only deletes the associated object if no further references exist.
 
RefCounted< T > & operator= (const RefCounted< T > &other)
 Assignment operator. Previously held object gets its reference count reduced, and is deleted if no further references exist. The newly assigned object, taken from other, gets its count increased.
 
bool operator== (const RefCounted< T > &other) const
 Return whether the two RefCounted ptrs are equal (point to the same object)
 
bool operator!= (const RefCounted< T > &other) const
 Return whether the two RefCounted ptrs are not equal (point to different objects)
 
const T & operator* () const
 Return the object referred to by the wrapped pointer. (beware of null pointers when using this!)
 
T & operator* ()
 
const T * operator-> () const
 Return the wrapped pointer.
 
T * operator-> ()
 
bool isValid () const
 Return whether the wrapped pointer is valid. i.e. that it is not null.
 

Detailed Description

template<typename T>
class CEGUI::RefCounted< T >

Simple, generic, reference counted pointer class. This is primarily here for use by the Events system to track when to delete slot bindings.

Note
Only safe to use with AllocatedObject<T> derived classes!