A ref-counting smart-pointer for the underlying C++ object. More...
| Public Types | |
| typedef size_t | size_type | 
| typedef T_obj | object_type | 
| Public Member Functions | |
| sharedptr () | |
| sharedptr (T_obj* pobj) | |
| Take ownership. | |
| sharedptr (T_obj* pobj, size_type* refcount) | |
| Take ownership. | |
| sharedptr (const sharedptr& src) | |
| Share ownership. | |
| void | swap (sharedptr< T_obj >& other) | 
| Swap the contents of two sharedptr<>. | |
| template<class T_CastFrom > | |
| sharedptr (const sharedptr< T_CastFrom >& src) | |
| Copy constructor (from different, but castable type). | |
| sharedptr& | operator= (const sharedptr& src) | 
| Share ownership. | |
| template<class T_CastFrom > | |
| sharedptr< T_obj >& | operator= (const sharedptr< T_CastFrom >& src) | 
| Copy from different, but castable type). | |
| virtual | ~sharedptr () | 
| bool | operator== (const sharedptr< T_obj >& src) const | 
| bool | operator!= (const sharedptr< T_obj >& src) const | 
| virtual void | clear () | 
| Forget the instance. | |
| T_obj& | operator* () | 
| Dereferencing. | |
| const T_obj& | operator* () const | 
| Dereferencing. | |
| T_obj* | operator-> () const | 
| Dereferencing. | |
| operator bool () const | |
| Test whether the sharedptr<> points to any underlying instance. | |
| bool | operator! () const | 
| Test whether the sharedptr<> points to any underlying instance. | |
| T_obj* | obj () | 
| Get the underlying instance: | |
| const T_obj* | obj () const | 
| Get the underlying instance: | |
| template<typename T_obj> | |
| sharedptr (T_obj* pobj, size_t* refcount) | |
| Static Public Member Functions | |
| template<class T_CastFrom > | |
| static sharedptr< T_obj > | cast_dynamic (const sharedptr< T_CastFrom >& src) | 
| Dynamic cast to derived class. | |
| template<class T_CastFrom > | |
| static sharedptr< T_obj > | cast_static (const sharedptr< T_CastFrom >& src) | 
| Static cast to derived class. | |
| template<class T_CastFrom > | |
| static sharedptr< T_obj > | cast_const (const sharedptr< T_CastFrom >& src) | 
| Cast to non-const. | |
| static sharedptr< T_obj > | create () | 
A ref-counting smart-pointer for the underlying C++ object.
You can copy these smarpointers-of-C++-resources, and therefore the C++ classes can have simple copy constructors which just share the underlying resources.
| typedef T_obj Glom::sharedptr< T_obj >::object_type | 
| typedef size_t Glom::sharedptr< T_obj >::size_type | 
| Glom::sharedptr< T_obj >::sharedptr | ( | ) | 
| Glom::sharedptr< T_obj >::sharedptr | ( | T_obj * | pobj | ) |  [explicit] | 
Take ownership.
| Glom::sharedptr< T_obj >::sharedptr | ( | T_obj * | pobj, | |
| size_type* | refcount | |||
| ) |  [explicit] | 
Take ownership.
This is only for internal use.
| Glom::sharedptr< T_obj >::sharedptr | ( | const sharedptr< T_obj >& | src | ) | 
Share ownership.
| Glom::sharedptr< T_obj >::sharedptr | ( | const sharedptr< T_CastFrom >& | src | ) |  [inline] | 
Copy constructor (from different, but castable type).
Increments the reference count.
| Glom::sharedptr< T_obj >::~sharedptr | ( | ) |  [virtual] | 
| Glom::sharedptr< T_obj >::sharedptr | ( | T_obj * | pobj, | |
| size_t * | refcount | |||
| ) | 
| sharedptr< T_obj > Glom::sharedptr< T_obj >::cast_const | ( | const sharedptr< T_CastFrom >& | src | ) |  [inline, static] | 
Cast to non-const.
The sharedptr can't be cast with the usual notation so instead you can use
ptr_unconst = sharedptr<UnConstType>::cast_const(ptr_const);
| sharedptr< T_obj > Glom::sharedptr< T_obj >::cast_dynamic | ( | const sharedptr< T_CastFrom >& | src | ) |  [inline, static] | 
Dynamic cast to derived class.
The sharedptr can't be cast with the usual notation so instead you can use
ptr_derived = sharedptr<Derived>::cast_dynamic(ptr_base);
| sharedptr< T_obj > Glom::sharedptr< T_obj >::cast_static | ( | const sharedptr< T_CastFrom >& | src | ) |  [inline, static] | 
Static cast to derived class.
Like the dynamic cast; the notation is
ptr_derived = sharedptr<Derived>::cast_static(ptr_base);
| void Glom::sharedptr< T_obj >::clear | ( | ) |  [virtual] | 
Forget the instance.
| static sharedptr<T_obj> Glom::sharedptr< T_obj >::create | ( | ) |  [inline, static] | 
| T_obj* Glom::sharedptr< T_obj >::obj | ( | ) |  [inline] | 
Get the underlying instance:
| const T_obj* Glom::sharedptr< T_obj >::obj | ( | ) | const  [inline] | 
Get the underlying instance:
| Glom::sharedptr< T_obj >::operator bool | ( | ) | const  [inline] | 
Test whether the sharedptr<> points to any underlying instance.
Mimics usage of ordinary pointers:
 if(ptr)
     do_something();
| bool Glom::sharedptr< T_obj >::operator! | ( | ) | const  [inline] | 
Test whether the sharedptr<> points to any underlying instance.
Mimics usage of ordinary pointers:
 if(!ptr)
     do_something();
| bool Glom::sharedptr< T_obj >::operator!= | ( | const sharedptr< T_obj >& | src | ) | const  [inline] | 
| const T_obj& Glom::sharedptr< T_obj >::operator* | ( | ) | const  [inline] | 
Dereferencing.
| T_obj& Glom::sharedptr< T_obj >::operator* | ( | ) |  [inline] | 
Dereferencing.
| T_obj* Glom::sharedptr< T_obj >::operator-> | ( | ) | const  [inline] | 
Dereferencing.
Use the methods of the underlying instance like so: sharedptr->memberfun(). 
| sharedptr< T_obj >& Glom::sharedptr< T_obj >::operator= | ( | const sharedptr< T_CastFrom >& | src | ) |  [inline] | 
Copy from different, but castable type).
Increments the reference count.
| sharedptr< T_obj >& Glom::sharedptr< T_obj >::operator= | ( | const sharedptr< T_obj >& | src | ) | 
Share ownership.
| bool Glom::sharedptr< T_obj >::operator== | ( | const sharedptr< T_obj >& | src | ) | const  [inline] | 
| void Glom::sharedptr< T_obj >::swap | ( | sharedptr< T_obj >& | other | ) |  [inline] | 
Swap the contents of two sharedptr<>.
This method swaps the internal pointers. This can be done safely without involving a reference/unreference cycle and is therefore highly efficient.
 1.7.1
 1.7.1