Basic Image AlgorithmS Library
2.8.0
|
pointer with reference count and automatic deletion More...
#include <Base/Common/SharedPtr.hh>
Classes | |
class | Tester |
Public Member Functions | |
template<class U > | |
SharedPtr< T > | ConstCast (const SharedPtr< U > &rs) |
eqivalent to *this = const_cast<SharedPtr<T> >(rs) More... | |
template<class U > | |
SharedPtr< T > | DynamicCast (const SharedPtr< U > &rs) |
eqivalent to *this = dynamic_cast<SharedPtr<T> >(rs) More... | |
operator Tester * () const | |
Enable the expression "if (ptr)", while at the same time preventing "delete ptr" from compilling. More... | |
bool | operator! () const |
enable the expression "if (!ptr)" More... | |
template<class U > | |
bool | operator!= (const SharedPtr< U > &rs) const |
T & | operator* () const |
T * | operator-> () const |
template<class U > | |
bool | operator< (const SharedPtr< U > &rs) const |
ordering More... | |
template<class U > | |
bool | operator<= (const SharedPtr< U > &rs) const |
SharedPtr< T > & | operator= (const SharedPtr< T > &sp) |
template<class U > | |
bool | operator== (const SharedPtr< U > &rs) const |
comparisons More... | |
template<class U > | |
bool | operator> (const SharedPtr< U > &rs) const |
template<class U > | |
bool | operator>= (const SharedPtr< U > &rs) const |
SharedPtr () | |
template<class U > | |
SharedPtr (const SharedPtr< U > &pt) | |
needed to enable assignement of SharedPtr<T> to SharedPtr<const T> More... | |
SharedPtr (const SharedPtr< T > &pt) | |
SharedPtr (T *pt) | |
virtual | ~SharedPtr () |
Friends | |
T * | Get (SharedPtr< T > &t) |
access functions More... | |
T *const | Get (const SharedPtr< T > &t) |
std::ostream & | operator<< (std::ostream &os, const SharedPtr< T > &t) |
stream operator More... | |
unsigned | RefCount (const SharedPtr< T > &t) |
template<class U > | |
class | SharedPtr |
Related Functions | |
(Note that these are not member functions.) | |
template<class T , class U > | |
SharedPtr< T > | ConstCast (const SharedPtr< U > &src) |
DynamicCast function. More... | |
template<class T , class U > | |
SharedPtr< T > | DynamicCast (const SharedPtr< U > &src) |
DynamicCast function. More... | |
template<class T > | |
T * | Get (SharedPtr< T > &t) |
access function to the raw pointer More... | |
template<class T > | |
T *const | Get (const SharedPtr< T > &t) |
access function to the raw pointer More... | |
template<class T > | |
unsigned | RefCount (const SharedPtr< T > &t) |
access function to the reference count More... | |
pointer with reference count and automatic deletion
This class is tested see Base/Common/Tests/TestSharedPtr.cpp
!this class is not thread safe!
Definition at line 50 of file SharedPtr.hh.
BIAS::SharedPtr< T >::SharedPtr | ( | ) |
Definition at line 81 of file SharedPtrImpl.hh.
needed to enable assignement of SharedPtr<T> to SharedPtr<const T>
Definition at line 95 of file SharedPtrImpl.hh.
BIAS::SharedPtr< T >::SharedPtr | ( | const SharedPtr< T > & | pt | ) |
Definition at line 86 of file SharedPtrImpl.hh.
|
explicit |
Definition at line 109 of file SharedPtrImpl.hh.
|
virtual |
Definition at line 121 of file SharedPtrImpl.hh.
SharedPtr< T > BIAS::SharedPtr< T >::ConstCast | ( | const SharedPtr< U > & | rs | ) |
eqivalent to *this = const_cast<SharedPtr<T> >(rs)
Definition at line 251 of file SharedPtrImpl.hh.
References BIAS::Get().
Referenced by BIAS::SharedPtr< T >::ConstCast().
SharedPtr< T > BIAS::SharedPtr< T >::DynamicCast | ( | const SharedPtr< U > & | rs | ) |
eqivalent to *this = dynamic_cast<SharedPtr<T> >(rs)
Definition at line 237 of file SharedPtrImpl.hh.
References BIAS::Get().
Referenced by BIAS::SharedPtr< T >::DynamicCast().
BIAS::SharedPtr< T >::operator Tester * | ( | ) | const |
Enable the expression "if (ptr)", while at the same time preventing "delete ptr" from compilling.
enable the expression "if (ptr)", see Alexandrescu "Modern C++ design", chap 7.8, p 178
This is done by providing an automatic conversion operator to the "Tester" class. The tester class itself introduces an additional "delete" function and thus makes "delete ptr" ambiguous. See Alexandrescu "Modern C++ design", chap 7.8, p 178
Definition at line 177 of file SharedPtrImpl.hh.
bool BIAS::SharedPtr< T >::operator! | ( | ) | const |
enable the expression "if (!ptr)"
Definition at line 169 of file SharedPtrImpl.hh.
bool BIAS::SharedPtr< T >::operator!= | ( | const SharedPtr< U > & | rs | ) | const |
Definition at line 197 of file SharedPtrImpl.hh.
References BIAS::Get().
T & BIAS::SharedPtr< T >::operator* | ( | ) | const |
Definition at line 140 of file SharedPtrImpl.hh.
T * BIAS::SharedPtr< T >::operator-> | ( | ) | const |
Definition at line 152 of file SharedPtrImpl.hh.
bool BIAS::SharedPtr< T >::operator< | ( | const SharedPtr< U > & | rs | ) | const |
bool BIAS::SharedPtr< T >::operator<= | ( | const SharedPtr< U > & | rs | ) | const |
Definition at line 214 of file SharedPtrImpl.hh.
References BIAS::Get().
SharedPtr< T > & BIAS::SharedPtr< T >::operator= | ( | const SharedPtr< T > & | sp | ) |
Definition at line 127 of file SharedPtrImpl.hh.
bool BIAS::SharedPtr< T >::operator== | ( | const SharedPtr< U > & | rs | ) | const |
bool BIAS::SharedPtr< T >::operator> | ( | const SharedPtr< U > & | rs | ) | const |
Definition at line 220 of file SharedPtrImpl.hh.
References BIAS::Get().
bool BIAS::SharedPtr< T >::operator>= | ( | const SharedPtr< U > & | rs | ) | const |
Definition at line 226 of file SharedPtrImpl.hh.
References BIAS::Get().
DynamicCast function.
Definition at line 70 of file SharedPtrImpl.hh.
References BIAS::SharedPtr< T >::ConstCast().
DynamicCast function.
Definition at line 60 of file SharedPtrImpl.hh.
References BIAS::SharedPtr< T >::DynamicCast().
|
related |
access function to the raw pointer
Definition at line 39 of file SharedPtrImpl.hh.
|
related |
access function to the raw pointer
Definition at line 46 of file SharedPtrImpl.hh.
|
friend |
access functions
|
friend |
|
friend |
stream operator
|
related |
access function to the reference count
Definition at line 53 of file SharedPtrImpl.hh.
|
friend |
Definition at line 148 of file SharedPtr.hh.