libglom-1.24
1.24.1
|
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. More... | |
sharedptr (T_obj* pobj, size_type* refcount) | |
Take ownership. More... | |
sharedptr (const sharedptr& src) | |
Share ownership. More... | |
void | swap (sharedptr< T_obj >& other) |
Swap the contents of two sharedptr<>. More... | |
template<class T_CastFrom > | |
sharedptr (const sharedptr< T_CastFrom >& src) | |
Copy constructor (from different, but castable type). More... | |
sharedptr& | operator= (const sharedptr& src) |
Share ownership. More... | |
template<class T_CastFrom > | |
sharedptr< T_obj >& | operator= (const sharedptr< T_CastFrom >& src) |
Copy from different, but castable type). More... | |
virtual | ~sharedptr () |
bool | operator== (const sharedptr< T_obj >& src) const |
bool | operator!= (const sharedptr< T_obj >& src) const |
virtual void | clear () |
Forget the instance. More... | |
T_obj& | operator* () |
Dereferencing. More... | |
const T_obj& | operator* () const |
Dereferencing. More... | |
T_obj* | operator-> () const |
Dereferencing. More... | |
operator bool () const | |
Test whether the sharedptr<> points to any underlying instance. More... | |
bool | operator! () const |
Test whether the sharedptr<> points to any underlying instance. More... | |
T_obj* | obj () |
Get the underlying instance: More... | |
const T_obj* | obj () const |
Get the underlying instance: More... | |
template<class T_CastFrom > | |
sharedptr< T_obj > | cast_dynamic (const sharedptr< T_CastFrom >& src) |
template<class T_CastFrom > | |
sharedptr< T_obj > | cast_static (const sharedptr< T_CastFrom >& src) |
template<class T_CastFrom > | |
sharedptr< T_obj > | cast_const (const sharedptr< T_CastFrom >& src) |
Static Public Member Functions | |
template<class T_CastFrom > | |
static sharedptr< T_obj > | cast_dynamic (const sharedptr< T_CastFrom >& src) |
Dynamic cast to derived class. More... | |
template<class T_CastFrom > | |
static sharedptr< T_obj > | cast_static (const sharedptr< T_CastFrom >& src) |
Static cast to derived class. More... | |
template<class T_CastFrom > | |
static sharedptr< T_obj > | cast_const (const sharedptr< T_CastFrom >& src) |
Cast to non-const. More... | |
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 | ( | ) |
|
explicit |
Take ownership.
|
explicit |
Take ownership.
This is only for internal use.
Glom::sharedptr< T_obj >::sharedptr | ( | const sharedptr< T_obj >& | src | ) |
Share ownership.
|
inline |
Copy constructor (from different, but castable type).
Increments the reference count.
|
virtual |
|
inlinestatic |
Cast to non-const.
The sharedptr can't be cast with the usual notation so instead you can use
|
inline |
|
inlinestatic |
Dynamic cast to derived class.
The sharedptr can't be cast with the usual notation so instead you can use
|
inline |
|
inlinestatic |
Static cast to derived class.
Like the dynamic cast; the notation is
|
inline |
|
virtual |
Forget the instance.
|
inlinestatic |
|
inline |
Get the underlying instance:
|
inline |
Get the underlying instance:
|
inline |
Test whether the sharedptr<> points to any underlying instance.
Mimics usage of ordinary pointers:
|
inline |
Test whether the sharedptr<> points to any underlying instance.
Mimics usage of ordinary pointers:
|
inline |
|
inline |
Dereferencing.
|
inline |
Dereferencing.
|
inline |
Dereferencing.
Use the methods of the underlying instance like so: sharedptr->memberfun()
.
sharedptr< T_obj >& Glom::sharedptr< T_obj >::operator= | ( | const sharedptr< T_obj >& | src | ) |
Share ownership.
|
inline |
Copy from different, but castable type).
Increments the reference count.
|
inline |
|
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.