ContRap-Core
|
Class SPtr is a template typed reference counting pointer. More...
#include <pointer.h>
Public Member Functions | |
SPtr () | |
Empty constructor constructs an invalid pointer. | |
SPtr (T *object, PointerMode mode=INSTANT) | |
Pointer constructor from a pure object. | |
SPtr (T *object, const DPtr &source, PointerMode mode=SOURCE) | |
Pointer constructor from a pure object with reference data. | |
SPtr (const DPtr &object, MetaInfo *meta_info) | |
Creates a smart pointer from reference pointer. | |
SPtr (const SPtr< T > &pointer) | |
Copy constructor. | |
~SPtr () | |
Pointer destructor. | |
void | operator= (const SPtr< T > &pointer) |
Assignment operator. | |
void | operator= (T *pointer) |
Assignment operator from a pure pointer. | |
void | copy_to (T *pointer) const |
Assignment operator using the assign function of the meta info. | |
void | copy_to_create (T *pointer) const |
Assignment operator using the assign function of the meta info. | |
void | copy_from (const SPtr< T > &pointer) |
Assignment operator using the assign function of the meta info. | |
bool | operator== (const SPtr< T > &pointer) const |
Comparison operator. | |
operator T * () | |
Returns the original object. | |
operator const T * () const | |
Returns the original object. | |
T & | operator* () |
Dereferences the pointer. | |
const T & | operator* () const |
Dereferences the pointer. | |
T * | operator-> () |
Dereferences the pointer. | |
const T * | operator-> () const |
Dereferences the pointer. | |
T * | get_ptr () |
Returns the pointer explicitly. | |
const T * | get_ptr () const |
Returns the pointer explicitly. | |
void | destroy () |
Destroys the referenced object. | |
Static Public Member Functions | |
static void | copy (const T *from, T *to) |
Static copy method for the given type. | |
static MetaInfo * | get_static_meta_info () |
Returns the static meta information. | |
Static Protected Attributes | |
static MetaInfo * | static_meta_info = 0 |
Static meta info object. |
Class SPtr is a template typed reference counting pointer.
By overloading the copy constructor it is possible to assign smart pointers thus counting the number of references to the wrapped object. As the reference number goes down to zero the wrapped object is deleted.
Empty constructor constructs an invalid pointer.
crp::SPtr< T >::SPtr | ( | T * | object, |
PointerMode | mode = INSTANT |
||
) | [inline] |
Pointer constructor from a pure object.
The ContRap policy forbids to use this constructor in all cases except immediately after you have created a new instance of the wrapped object.
object | Pointer to the object |
mode | Destruction mode |
crp::SPtr< T >::SPtr | ( | T * | object, |
const DPtr & | source, | ||
PointerMode | mode = SOURCE |
||
) | [inline] |
Pointer constructor from a pure object with reference data.
The reference object will not be deleted until the last copy of this pointer is deleted. The deletion mode of this pointer is per default PERSISTENT.
The ContRap policy forbids to use this constructor in all cases except immediately after you have created a new instance of the wrapped object.
object | Pointer to the object |
source | Source object of the data |
mode | Destruction mode of the pointer |
Creates a smart pointer from reference pointer.
object | Reference object |
meta_info | Meta info of the object |
Copy constructor.
pointer | Other reference pointer |
static void crp::SPtr< T >::copy | ( | const T * | from, |
T * | to | ||
) | [inline, static] |
Static copy method for the given type.
from | Source object |
to | Target object |
Assignment operator using the assign function of the meta info.
pointer | Other reference |
void crp::SPtr< T >::copy_to | ( | T * | pointer | ) | const [inline] |
Assignment operator using the assign function of the meta info.
pointer | Other reference |
void crp::SPtr< T >::copy_to_create | ( | T * | pointer | ) | const [inline] |
Assignment operator using the assign function of the meta info.
pointer | Other reference |
void crp::SPtr< T >::destroy | ( | ) | [inline] |
Destroys the referenced object.
Reimplemented from crp::DPtr.
T* crp::SPtr< T >::get_ptr | ( | ) | [inline] |
const T* crp::SPtr< T >::get_ptr | ( | ) | const [inline] |
Returns the pointer explicitly.
Returns the static meta information.
crp::SPtr< T >::operator const T * | ( | ) | const [inline] |
Returns the original object.
crp::SPtr< T >::operator T * | ( | ) | [inline] |
Returns the original object.
T& crp::SPtr< T >::operator* | ( | ) | [inline] |
Dereferences the pointer.
const T& crp::SPtr< T >::operator* | ( | ) | const [inline] |
Dereferences the pointer.
T* crp::SPtr< T >::operator-> | ( | ) | [inline] |
Dereferences the pointer.
const T* crp::SPtr< T >::operator-> | ( | ) | const [inline] |
Dereferences the pointer.
void crp::SPtr< T >::operator= | ( | T * | pointer | ) | [inline] |
Assignment operator from a pure pointer.
pointer | Object to assign |
Assignment operator.
pointer | Other reference pointer |
Comparison operator.
pointer | Other reference pointer |
MetaInfo * crp::SPtr< T >::static_meta_info = 0 [static, protected] |
Static meta info object.
Static meta information for each smart pointer class.