Public Types | Public Member Functions | Protected Member Functions | List of all members
istd::TOptDelPtr< Type, DelArray > Class Template Reference

Pointer wrapper providing activatable deleting pointed object during destruction. More...

#include <TOptDelPtr.h>

Inheritance diagram for istd::TOptDelPtr< Type, DelArray >:
istd::TPointerBase< Type >

Public Types

typedef TPointerBase< Type > BaseClass
 

Public Member Functions

 TOptDelPtr (Type *ptr=NULL, bool releaseFlag=false)
 Construct and init this pointer. More...
 
 TOptDelPtr (const TOptDelPtr &ptr)
 Copy constructor. More...
 
 ~TOptDelPtr ()
 Destructor. More...
 
bool IsToRelase () const
 Get state of release flag. More...
 
void Reset ()
 Remove object pointed by internal pointer and set this pointer to NULL. More...
 
void SetPtr (Type *ptr, bool releaseFlag=false)
 Set new value of internal pointer. More...
 
Type * PopPtr ()
 Reset internal pointer value without deleting instance and return previos value. More...
 
void TakeOver (TOptDelPtr &sourcePtr)
 Take internal pointer over. More...
 
TOptDelPtroperator= (const TOptDelPtr &ptr)
 Assign operator. More...
 
TOptDelPtroperator= (Type *ptr)
 Assign operator. More...
 
template<class SourceType >
bool SetCastedOrRemove (SourceType *ptr, bool releaseFlag=false)
 Set internal pointer using casted pointer of other type. More...
 
- Public Member Functions inherited from istd::TPointerBase< Type >
 TPointerBase (Type *ptr=NULL)
 Construct and assign internal pointer. More...
 
void SetPtr (Type *ptr)
 Set value of internal stored pointer. More...
 
void Reset ()
 Set internal pointer value to NULL. More...
 
Type * GetPtr () const
 Return access to internal stored pointer. More...
 
bool IsValid () const
 Check if internal pointer not NULL. More...
 
void Swap (TPointerBase &ptr)
 Swap two pointers. More...
 
Type & operator* () const
 Get an access to object pointed at. More...
 
template<class CastedType >
CastedType Cast () const
 
Type * operator-> () const
 
bool operator== (const TPointerBase< Type > &ptr) const
 
bool operator!= (const TPointerBase< Type > &ptr) const
 
bool operator< (const TPointerBase< Type > &ptr) const
 
bool operator> (const TPointerBase< Type > &ptr) const
 
bool operator<= (const TPointerBase< Type > &ptr) const
 
bool operator>= (const TPointerBase< Type > &ptr) const
 
bool operator== (const Type *ptr) const
 
bool operator!= (const Type *ptr) const
 
bool operator< (const Type *ptr) const
 
bool operator> (const Type *ptr) const
 
bool operator<= (const Type *ptr) const
 
bool operator>= (const Type *ptr) const
 

Protected Member Functions

void Detach ()
 Remove referenced object. More...
 
- Protected Member Functions inherited from istd::TPointerBase< Type >
TPointerBase< Type > & operator= (const TPointerBase< Type > ptr)
 
Type *& GetPtrRef ()
 

Detailed Description

template<class Type, bool DelArray = false>
class istd::TOptDelPtr< Type, DelArray >

Pointer wrapper providing activatable deleting pointed object during destruction.

Definition at line 20 of file TOptDelPtr.h.

Member Typedef Documentation

template<class Type, bool DelArray = false>
typedef TPointerBase<Type> istd::TOptDelPtr< Type, DelArray >::BaseClass

Definition at line 23 of file TOptDelPtr.h.

Constructor & Destructor Documentation

template<class Type, bool DelArray>
istd::TOptDelPtr< Type, DelArray >::TOptDelPtr ( Type *  ptr = NULL,
bool  releaseFlag = false 
)
inline

Construct and init this pointer.

Parameters
ptrpointer to object.
releaseFlagif true, pointed object will be automatically released.

Definition at line 124 of file TOptDelPtr.h.

template<class Type, bool DelArray>
istd::TOptDelPtr< Type, DelArray >::TOptDelPtr ( const TOptDelPtr< Type, DelArray > &  ptr)
inline

Copy constructor.

This implementation has no function and is provided only for compatibility with STL. The source pointer must be invalid (NULL).

Definition at line 131 of file TOptDelPtr.h.

References istd::TPointerBase< Type >::GetPtr(), NULL, and istd::TOptDelPtr< Type, DelArray >::SetPtr().

template<class Type , bool DelArray>
istd::TOptDelPtr< Type, DelArray >::~TOptDelPtr ( )
inline

Destructor.

It calls Reset() to delete pointed object.

Definition at line 145 of file TOptDelPtr.h.

Member Function Documentation

template<class Type , bool DelArray>
void istd::TOptDelPtr< Type, DelArray >::Detach ( )
protected

Remove referenced object.

Warning: internal pointer will be not changed.

Definition at line 222 of file TOptDelPtr.h.

References NULL.

template<class Type , bool DelArray>
bool istd::TOptDelPtr< Type, DelArray >::IsToRelase ( ) const
inline

Get state of release flag.

If this flag is true, pointed object will be automatically removed from memory. If this pointer isn't valid, returned value has no meaning.

Definition at line 159 of file TOptDelPtr.h.

template<class Type, bool DelArray = false>
TOptDelPtr& istd::TOptDelPtr< Type, DelArray >::operator= ( const TOptDelPtr< Type, DelArray > &  ptr)

Assign operator.

This implementation has no function and is provided only for compatibility with STL. The source pointer must be invalid (NULL).

template<class Type, bool DelArray>
TOptDelPtr< Type, DelArray > & istd::TOptDelPtr< Type, DelArray >::operator= ( Type *  ptr)

Assign operator.

It removes refererenced object before new is assigned.

Parameters
ptrpointer to object.

Definition at line 209 of file TOptDelPtr.h.

template<class Type , bool DelArray>
Type * istd::TOptDelPtr< Type, DelArray >::PopPtr ( )
inline

Reset internal pointer value without deleting instance and return previos value.

Definition at line 177 of file TOptDelPtr.h.

References NULL.

Referenced by istd::TOptDelPtr< Type, DelArray >::TakeOver().

template<class Type , bool DelArray>
void istd::TOptDelPtr< Type, DelArray >::Reset ( )
inline

Remove object pointed by internal pointer and set this pointer to NULL.

Definition at line 152 of file TOptDelPtr.h.

References NULL.

template<class Type, bool DelArray = false>
template<class SourceType >
bool istd::TOptDelPtr< Type, DelArray >::SetCastedOrRemove ( SourceType *  ptr,
bool  releaseFlag = false 
)
inline

Set internal pointer using casted pointer of other type.

If casting is not possible, parameter object will be removed.

Parameters
releaseFlagif true, pointed object will be automatically released.

Definition at line 93 of file TOptDelPtr.h.

template<class Type, bool DelArray>
void istd::TOptDelPtr< Type, DelArray >::SetPtr ( Type *  ptr,
bool  releaseFlag = false 
)
inline

Set new value of internal pointer.

If internal pointer wasn't NULL, it will be deleted.

Parameters
releaseFlagif true, pointed object will be automatically released.

Definition at line 166 of file TOptDelPtr.h.

Referenced by istd::TOptDelPtr< const i2d::ICalibration2d >::SetCastedOrRemove(), and istd::TOptDelPtr< Type, DelArray >::TOptDelPtr().

template<class Type , bool DelArray>
void istd::TOptDelPtr< Type, DelArray >::TakeOver ( TOptDelPtr< Type, DelArray > &  sourcePtr)

Take internal pointer over.

It set pointer from other object and detach it from them.

Definition at line 187 of file TOptDelPtr.h.

References istd::TOptDelPtr< Type, DelArray >::PopPtr().


The documentation for this class was generated from the following file:

© 2007-2017 Witold Gantzke and Kirill Lepskiy