Logo Search packages:      
Sourcecode: ardour version File versions  Download package

Glib::RefPtr< T_CppObject > Class Template Reference

#include <refptr.h>

List of all members.

Detailed Description

template<class T_CppObject>
class Glib::RefPtr< T_CppObject >

RefPtr<> is a reference-counting shared smartpointer.

Some objects in gtkmm are obtained from a shared store. Consequently you cannot instantiate them yourself. Instead they return a RefPtr which behaves much like an ordinary pointer in that members can be reached with the usual object_ptr->member notation. Unlike most other smart pointers, RefPtr doesn't support dereferencing through *object_ptr.

Reference counting means that a shared reference count is incremented each time a RefPtr is copied, and decremented each time a RefPtr is destroyed, for instance when it leaves its scope. When the reference count reaches zero, the contained object is deleted, meaning you don't need to remember to delete the object.

RefPtr<> can store any class that has reference() and unreference() methods. In gtkmm, that is anything derived from Glib::ObjectBase, such as Gdk::Pixmap.

See the "Memory Management" section in the "Programming with gtkmm" book for further information.

Definition at line 51 of file refptr.h.

Public Member Functions

void clear ()
 Set underlying instance to 0, decrementing reference count of existing instance appropriately.
 operator bool () const
bool operator!= (const RefPtr< T_CppObject > &src) const
 See operator==().
T_CppObject * operator-> () const
template<class T_CastFrom>
RefPtr< T_CppObject > & operator= (const RefPtr< T_CastFrom > &src)
RefPtr< T_CppObject > & operator= (const RefPtr< T_CppObject > &src)
 Copy from another RefPtr:.
bool operator== (const RefPtr< T_CppObject > &src) const
 Tests whether the RefPtr<> point to the same underlying instance.
template<class T_CastFrom>
 RefPtr (const RefPtr< T_CastFrom > &src)
 RefPtr (const RefPtr< T_CppObject > &src)
 RefPtr (T_CppObject *pCppObject)
 For use only by the create() methods.
 RefPtr ()
void swap (RefPtr< T_CppObject > &other)
 ~RefPtr ()
 Destructor - decrements reference count.

Static Public Member Functions

template<class T_CastFrom>
static RefPtr< T_CppObject > cast_dynamic (const RefPtr< T_CastFrom > &src)
template<class T_CastFrom>
static RefPtr< T_CppObject > cast_static (const RefPtr< T_CastFrom > &src)

Private Attributes

T_CppObject * pCppObject_

Related Functions

(Note that these are not member functions.)

template<class T_CppObject>
void swap (RefPtr< T_CppObject > &lhs, RefPtr< T_CppObject > &rhs)

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index