MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Smart pointer to a shared object providing intrusive reference counting. More...
#include <mdsSharedPtr.h>
Public Types | |
enum | { TEMPLATE_PARAMETER_IS_NOT_OBJECT = T::CLASS_OBJECT } |
Check that T is derived from CObject class. More... | |
typedef T | tPointee |
Pointee type. | |
typedef T * | tPointer |
Stored pointer type. | |
Public Member Functions | |
CSharedPtr () | |
Default constructor. | |
CSharedPtr (T *p) | |
Constructor from a raw pointer. | |
CSharedPtr (const CSharedPtr &p) | |
Constructor from a raw pointer. | |
T * | get () |
Returns pointer to the encapsulated object. | |
const T * | get () const |
operator T * () | |
Conversion to the raw pointer. | |
operator void * () | |
Added conversion to the void pointer to avoid raw pointer deletion. | |
bool | operator! () const |
Enables "if (!sp) ...". | |
template<typename U > | |
bool | operator!= (const CSharedPtr< U > &r) const |
T & | operator* () const |
Returns reference to the stored object. | |
T * | operator-> () const |
Returns pointer to the encapsulated object. | |
template<typename U > | |
bool | operator< (const CSharedPtr< U > &r) const |
CSharedPtr & | operator= (const CSharedPtr &p) |
Assignment operator. | |
CSharedPtr & | operator= (T *p) |
Assignment operator. | |
template<typename U > | |
bool | operator== (const CSharedPtr< U > &r) const |
Ambiguity buster solving the comparision of two smart pointers. | |
T * | release () |
Returns pointer to the encapsulated object and decreases the reference counter. | |
~CSharedPtr () | |
Assignment operator. | |
Friends | |
bool | operator!= (const CSharedPtr &l, const T *r) |
bool | operator!= (const T *l, const CSharedPtr &r) |
template<typename U > | |
bool | operator!= (const CSharedPtr &l, const U *r) |
template<typename U > | |
bool | operator!= (const U *l, const CSharedPtr &r) |
bool | operator< (const CSharedPtr &l, const T *r) |
bool | operator< (const T *l, const CSharedPtr &r) |
template<typename U > | |
bool | operator< (const CSharedPtr &l, const U *r) |
template<typename U > | |
bool | operator< (const U *l, const CSharedPtr &r) |
bool | operator== (const CSharedPtr &l, const T *r) |
Comparision operators. | |
bool | operator== (const T *l, const CSharedPtr &r) |
template<typename U > | |
bool | operator== (const CSharedPtr &l, const U *r) |
Ambiquity buster that solves problem using comparision like "if( p == sp ) ...". | |
template<typename U > | |
bool | operator== (const U *l, const CSharedPtr &r) |
Smart pointer to a shared object providing intrusive reference counting.
Once the pointer is initialized, it takes control over the object deletion.
typedef T mds::base::CSharedPtr< T >::tPointee |
Pointee type.
typedef T* mds::base::CSharedPtr< T >::tPointer |
Stored pointer type.
anonymous enum |
Check that T is derived from CObject class.
Otherwise, you will see name of this enum somewhere in compiler error message.
mds::base::CSharedPtr< T >::CSharedPtr | ( | ) |
Default constructor.
mds::base::CSharedPtr< T >::CSharedPtr | ( | T * | p | ) |
Constructor from a raw pointer.
mds::base::CSharedPtr< T >::CSharedPtr | ( | const CSharedPtr< T > & | p | ) |
Constructor from a raw pointer.
Copy constructor.
mds::base::CSharedPtr< T >::~CSharedPtr | ( | ) |
Assignment operator.
T* mds::base::CSharedPtr< T >::get | ( | ) |
Returns pointer to the encapsulated object.
const T* mds::base::CSharedPtr< T >::get | ( | ) | const |
mds::base::CSharedPtr< T >::operator T * | ( | ) |
Conversion to the raw pointer.
mds::base::CSharedPtr< T >::operator void * | ( | ) |
Added conversion to the void pointer to avoid raw pointer deletion.
bool mds::base::CSharedPtr< T >::operator! | ( | ) | const |
Enables "if (!sp) ...".
bool mds::base::CSharedPtr< T >::operator!= | ( | const CSharedPtr< U > & | r | ) | const |
T& mds::base::CSharedPtr< T >::operator* | ( | ) | const |
Returns reference to the stored object.
T* mds::base::CSharedPtr< T >::operator-> | ( | ) | const |
Returns pointer to the encapsulated object.
bool mds::base::CSharedPtr< T >::operator< | ( | const CSharedPtr< U > & | r | ) | const |
CSharedPtr& mds::base::CSharedPtr< T >::operator= | ( | const CSharedPtr< T > & | p | ) |
Assignment operator.
CSharedPtr& mds::base::CSharedPtr< T >::operator= | ( | T * | p | ) |
Assignment operator.
bool mds::base::CSharedPtr< T >::operator== | ( | const CSharedPtr< U > & | r | ) | const |
Ambiguity buster solving the comparision of two smart pointers.
T* mds::base::CSharedPtr< T >::release | ( | ) |
Returns pointer to the encapsulated object and decreases the reference counter.
Sets the internal pointer to NULL to avoid destruction of the object.
bool operator!= | ( | const CSharedPtr< T > & | l, |
const T * | r | ||
) | [friend] |
bool operator!= | ( | const T * | l, |
const CSharedPtr< T > & | r | ||
) | [friend] |
bool operator!= | ( | const CSharedPtr< T > & | l, |
const U * | r | ||
) | [friend] |
bool operator!= | ( | const U * | l, |
const CSharedPtr< T > & | r | ||
) | [friend] |
bool operator< | ( | const CSharedPtr< T > & | l, |
const T * | r | ||
) | [friend] |
bool operator< | ( | const T * | l, |
const CSharedPtr< T > & | r | ||
) | [friend] |
bool operator< | ( | const CSharedPtr< T > & | l, |
const U * | r | ||
) | [friend] |
bool operator< | ( | const U * | l, |
const CSharedPtr< T > & | r | ||
) | [friend] |
bool operator== | ( | const CSharedPtr< T > & | l, |
const T * | r | ||
) | [friend] |
Comparision operators.
bool operator== | ( | const T * | l, |
const CSharedPtr< T > & | r | ||
) | [friend] |
bool operator== | ( | const CSharedPtr< T > & | l, |
const U * | r | ||
) | [friend] |
Ambiquity buster that solves problem using comparision like "if( p == sp ) ...".
bool operator== | ( | const U * | l, |
const CSharedPtr< T > & | r | ||
) | [friend] |