#include <cel_autoptr.h>
Public Member Functions | |
AutoPtr () | |
~AutoPtr () | |
AutoPtr (T *inPtr) | |
template<typename U > | |
AutoPtr (U *inPtr) | |
AutoPtr (const AutoPtr< T > &inPtr) | |
template<class U > | |
AutoPtr (const AutoPtr< U > &inPtr) | |
AutoPtr< T > & | operator= (T *inPtr) |
template<typename U > | |
AutoPtr< T > & | operator= (U *inPtr) |
AutoPtr< T > & | operator= (const AutoPtr< T > &inPtr) |
template<class U > | |
AutoPtr< T > & | operator= (const AutoPtr< U > &inPtr) |
bool | isValid () const |
T * | getPtr () const |
T * | operator-> () const |
bool | isLastRef () const |
operator T * () const | |
operator AutoPtr< const T > () const | |
template<typename U > | |
operator AutoPtr< U > () const | |
template<typename U > | |
operator AutoPtr< const U > () const | |
T * | removeConst () const |
void | setObject (T *inPtr) |
void | swap (AutoPtr< T > &inPtr) |
void | release () |
T * | detach () |
This class controls the lifetime of classes that are derived from Referable class.
Although AutoPtr itself is completely thread-safe, you should synchronize the operations if an instance is used between several threads.
|
inline |
This constuctor initializes AutoPtr without any instance.
|
inline |
Destructs the AutoPtr and releases containing instance.
|
inline |
inPtr | a pointer that specifies Referable derivative class instance. |
inPtr | a pointer that specifies Referable derivative class instance. |
|
inline |
inPtr | Reference to an AutoPtr instance that specifies a Referable derivative class instance. |
|
inline |
inPtr | Reference to an AutoPtr instance that specifies a Referable derivative class instance. |
|
inline |
This method gives up the ownership of its holding instance; The pointer that has been held is not released by this AutoPtr instance, and you should manually call Referable::releaseRef method of that instance. This method is for advanced purpose only.
|
inline |
This method returns the raw pointer; although AutoPtr class also supports implicit cast to raw pointer, it sometimes doesn't work and you may happen to use this function instead.
Referenced by Celartem::DataStore::at(), Celartem::AutoPtr< const Celartem::DjVu::Data >::AutoPtr(), Celartem::DjVu::MemoryData::create(), Celartem::DataArray< T >::deserialize(), Celartem::DataArray< T >::duplicate(), Celartem::DjVu::MemoryData::duplicate(), Celartem::DjVu::PageInfo::encodeINFOChunk(), Celartem::DataStore::get(), and Celartem::AutoPtr< const Celartem::DjVu::Data >::operator=().
|
inline |
This method is to check whether the reference count is 1 or not.
If the reference count is equal to 1, this AutoPtr is the last reference which is keeping the instance in memory and if this AutoPtr releases the reference, the instance will be disposed. In other words, this is the only one reference to the instance and it is not shared with other AutoPtr instances.
true
if this is the last reference, otherwise false
.
|
inline |
This method checks whether the AutoPtr points to a valid Referable instance or not.
true
if it is valid, otherwise false
. Referenced by Celartem::AutoPtr< const Celartem::DjVu::Data >::isLastRef().
|
inline |
This function realizes implicit cast to const pointer types.
|
inline |
This function realizes implicit cast to static_cast-able pointer types.
|
inline |
This function realizes implicit cast to static_cast-able pointer types.
|
inline |
This function realizes implicit cast to static_cast-able pointer types.
|
inline |
This method is to fake the raw pointer.
|
inline |
inPtr | Pointer to a Referable derivative class instance. |
|
inline |
inPtr | Pointer to a Referable derivative class instance. |
|
inline |
inPtr | Reference to an AutoPtr instance that specifies a Referable derivative class instance. |
|
inline |
inPtr | Reference to an AutoPtr instance that specifies a Referable derivative class instance. |
|
inline |
This method releases the current instance. Usually, AutoPtr can automatically release the instance when it is removed.
|
inline |
This function does const_cast<> on this instance.
This should not be used frequently...
|
inline |
Set a new pointer to this AutoPtr.
inPtr | a pointer that specifies Referable derivative class instance. |
Referenced by Celartem::AutoPtr< const Celartem::DjVu::Data >::AutoPtr(), Celartem::AutoPtr< const Celartem::DjVu::Data >::operator=(), Celartem::AutoPtr< const Celartem::DjVu::Data >::release(), and Celartem::AutoPtr< const Celartem::DjVu::Data >::~AutoPtr().
|
inline |
This method swaps the pointers to the objects without reference count operation.
inPtr | AutoPtr instance to exchange the pointer. |