MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Base smart pointer which transfers ownership of a handled object. More...
#include <mdsScopedPtr.h>
Public Types | |
typedef T | tPointee |
Pointee type. | |
typedef T * | tPointer |
Stored pointer type. | |
Public Member Functions | |
CScopedPtr () | |
Default constructor. | |
CScopedPtr (T *p) | |
Constructor from a raw pointer. | |
CScopedPtr (CScopedPtr &p) | |
Copy constructor. | |
void | destroy () |
Deletes the encapsulated object if required and initializes the internal pointer to NULL. | |
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 CScopedPtr< 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 CScopedPtr< U > &r) const |
CScopedPtr & | operator= (CScopedPtr &p) |
Assignment operator. | |
CScopedPtr & | operator= (T *p) |
Assignment operator. | |
template<typename U > | |
bool | operator== (const CScopedPtr< U > &r) const |
Ambiguity buster solving the comparision of two smart pointers. | |
T * | release () |
Returns pointer to the encapsulated object and clears the m_bDestroy flag, therefore an user must handle the object deletion on his own. | |
void | setDestroyFlag () |
Sets the m_bDestroy flag. | |
~CScopedPtr () | |
Destructor. | |
Friends | |
bool | operator!= (const CScopedPtr &l, const T *r) |
bool | operator!= (const T *l, const CScopedPtr &r) |
template<typename U > | |
bool | operator!= (const CScopedPtr &l, const U *r) |
template<typename U > | |
bool | operator!= (const U *l, const CScopedPtr &r) |
bool | operator< (const CScopedPtr &l, const T *r) |
bool | operator< (const T *l, const CScopedPtr &r) |
template<typename U > | |
bool | operator< (const CScopedPtr &l, const U *r) |
template<typename U > | |
bool | operator< (const U *l, const CScopedPtr &r) |
bool | operator== (const CScopedPtr &l, const T *r) |
Comparision operators. | |
bool | operator== (const T *l, const CScopedPtr &r) |
template<typename U > | |
bool | operator== (const CScopedPtr &l, const U *r) |
Ambiquity buster that solves problem using comparision like "if( p == sp ) ...". | |
template<typename U > | |
bool | operator== (const U *l, const CScopedPtr &r) |
Base smart pointer which transfers ownership of a handled object.
Once the pointer is initialized, it takes control over the pointer including object deletion.
typedef T mds::base::CScopedPtr< T >::tPointee |
Pointee type.
typedef T* mds::base::CScopedPtr< T >::tPointer |
Stored pointer type.
mds::base::CScopedPtr< T >::CScopedPtr | ( | ) |
Default constructor.
mds::base::CScopedPtr< T >::CScopedPtr | ( | T * | p | ) |
Constructor from a raw pointer.
mds::base::CScopedPtr< T >::CScopedPtr | ( | CScopedPtr< T > & | p | ) |
Copy constructor.
mds::base::CScopedPtr< T >::~CScopedPtr | ( | ) |
Destructor.
void mds::base::CScopedPtr< T >::destroy | ( | ) |
Deletes the encapsulated object if required and initializes the internal pointer to NULL.
T* mds::base::CScopedPtr< T >::get | ( | ) |
Returns pointer to the encapsulated object.
const T* mds::base::CScopedPtr< T >::get | ( | ) | const |
mds::base::CScopedPtr< T >::operator T * | ( | ) |
Conversion to the raw pointer.
mds::base::CScopedPtr< T >::operator void * | ( | ) |
Added conversion to the void pointer to avoid raw pointer deletion.
bool mds::base::CScopedPtr< T >::operator! | ( | ) | const |
Enables "if (!sp) ...".
bool mds::base::CScopedPtr< T >::operator!= | ( | const CScopedPtr< U > & | r | ) | const |
T& mds::base::CScopedPtr< T >::operator* | ( | ) | const |
Returns reference to the stored object.
T* mds::base::CScopedPtr< T >::operator-> | ( | ) | const |
Returns pointer to the encapsulated object.
bool mds::base::CScopedPtr< T >::operator< | ( | const CScopedPtr< U > & | r | ) | const |
CScopedPtr& mds::base::CScopedPtr< T >::operator= | ( | CScopedPtr< T > & | p | ) |
Assignment operator.
CScopedPtr& mds::base::CScopedPtr< T >::operator= | ( | T * | p | ) |
Assignment operator.
bool mds::base::CScopedPtr< T >::operator== | ( | const CScopedPtr< U > & | r | ) | const |
Ambiguity buster solving the comparision of two smart pointers.
T* mds::base::CScopedPtr< T >::release | ( | ) |
Returns pointer to the encapsulated object and clears the m_bDestroy flag, therefore an user must handle the object deletion on his own.
void mds::base::CScopedPtr< T >::setDestroyFlag | ( | ) |
Sets the m_bDestroy flag.
bool operator!= | ( | const CScopedPtr< T > & | l, |
const T * | r | ||
) | [friend] |
bool operator!= | ( | const T * | l, |
const CScopedPtr< T > & | r | ||
) | [friend] |
bool operator!= | ( | const CScopedPtr< T > & | l, |
const U * | r | ||
) | [friend] |
bool operator!= | ( | const U * | l, |
const CScopedPtr< T > & | r | ||
) | [friend] |
bool operator< | ( | const CScopedPtr< T > & | l, |
const T * | r | ||
) | [friend] |
bool operator< | ( | const T * | l, |
const CScopedPtr< T > & | r | ||
) | [friend] |
bool operator< | ( | const CScopedPtr< T > & | l, |
const U * | r | ||
) | [friend] |
bool operator< | ( | const U * | l, |
const CScopedPtr< T > & | r | ||
) | [friend] |
bool operator== | ( | const CScopedPtr< T > & | l, |
const T * | r | ||
) | [friend] |
Comparision operators.
bool operator== | ( | const T * | l, |
const CScopedPtr< T > & | r | ||
) | [friend] |
bool operator== | ( | const CScopedPtr< T > & | l, |
const U * | r | ||
) | [friend] |
Ambiquity buster that solves problem using comparision like "if( p == sp ) ...".
bool operator== | ( | const U * | l, |
const CScopedPtr< T > & | r | ||
) | [friend] |