Poco::AutoPtr< C > Class Template Reference
#include <AutoPtr.h>
Detailed Description
template<class C>
class Poco::AutoPtr< C >
AutoPtr is a "smart" pointer for classes implementing reference counting based garbage collection. To be usable with the
AutoPtr template, a class must implement the following behaviour: A class must maintain a reference count. The constructors of the object initialize the reference count to one. The class must implement a public
duplicate() method: void
duplicate(); that increments the reference count by one. The class must implement a public release() method: void release() that decrements the reference count by one, and, if the reference count reaches zero, deletes the object.
AutoPtr works in the following way: If an AutoPtr is assigned an ordinary pointer to an object (via the constructor or the assignment operator), it takes ownership of the object and the object's reference count remains unchanged. If the AutoPtr is assigned another AutoPtr, the object's reference count is incremented by one by calling duplicate() on its object. The destructor of AutoPtr calls release() on its object. AutoPtr supports dereferencing with both the -> and the * operator. An attempt to dereference a null AutoPtr results in a NullPointerException being thrown. AutoPtr also implements all relational operators. Note that AutoPtr allows casting of its encapsulated data types.
Definition at line 88 of file AutoPtr.h.
Constructor & Destructor Documentation
template<class C>
template<class Other>
Member Function Documentation
template<class C>
template<class Other>
template<class C>
template<class Other>
template<class C>
template<class Other>
Casts the AutoPtr via a dynamic cast to the given type. Returns an AutoPtr containing NULL if the cast fails. Example: (assume class Sub: public Super) AutoPtr<Super> super(new Sub()); AutoPtr<Sub> sub = super.cast<Sub>(); poco_assert (sub.get());.
Definition at line 217 of file AutoPtr.h.
template<class C>
template<class Other>
Casts the AutoPtr via a static cast to the given type. Example: (assume class Sub: public Super) AutoPtr<Super> super(new Sub()); AutoPtr<Sub> sub = super.unsafeCast<Sub>(); poco_assert (sub.get());.
Definition at line 230 of file AutoPtr.h.
template<class C>
| bool Poco::AutoPtr< C >::operator== |
( |
const C * |
ptr |
) |
const [inline] |
template<class C>
| bool Poco::AutoPtr< C >::operator!= |
( |
const C * |
ptr |
) |
const [inline] |
template<class C>
| bool Poco::AutoPtr< C >::operator< |
( |
const C * |
ptr |
) |
const [inline] |
template<class C>
| bool Poco::AutoPtr< C >::operator<= |
( |
const C * |
ptr |
) |
const [inline] |
template<class C>
| bool Poco::AutoPtr< C >::operator> |
( |
const C * |
ptr |
) |
const [inline] |
template<class C>
| bool Poco::AutoPtr< C >::operator>= |
( |
const C * |
ptr |
) |
const [inline] |
Field Documentation
Definition at line 400 of file AutoPtr.h.
Referenced by Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::assign(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::AutoPtr(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::cast(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::duplicate(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::get(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::isNull(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator const Poco::ThreadImpl::ThreadData *(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator Poco::ThreadImpl::ThreadData *(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator!(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator!=(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator*(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator->(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator<(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator<=(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator==(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator>(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::operator>=(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::swap(), Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::unsafeCast(), and Poco::AutoPtr< Poco::ThreadImpl::ThreadData >::~AutoPtr().
The documentation for this class was generated from the following file: