![]() |
ICF 3.1.1.10
Technical documentation of ICF Libraries
|
Pointer wrapper providing activatable deleting pointed object during destruction. More...
#include <TOptDelPtr.h>
Public Types | |
| typedef TPointerBase< Type > | BaseClass |
| typedef std::function< void(Type *)> | ReleaseFn |
Public Member Functions | |
| TOptDelPtr (const TOptDelPtr &ptr)=delete | |
| TOptDelPtr (Type *ptr=nullptr, ReleaseFn releaseFn=nullptr) | |
| Construct and init this pointer. | |
| TOptDelPtr (Type *ptr, bool releaseFlag) | |
| Construct and init this pointer. | |
| TOptDelPtr (TOptDelPtr &&ptr) | |
| Move constructor. | |
| TOptDelPtr (std::unique_ptr< Type > &&ptr) | |
| Construct and init this pointer using unique pointer. | |
| ~TOptDelPtr () | |
| Destructor. | |
| bool | IsToRelase () const |
| Get state of release flag. | |
| void | Reset () |
| Remove object pointed by internal pointer and set this pointer to nullptr. | |
| void | SetPtr (Type *ptr, ReleaseFn releaseFn=nullptr) |
| Set new value of internal pointer. | |
| Type * | GetFreePtr () const |
| Get internal pointer only if it is free, it means will be not released. | |
| Type * | release () |
| Reset internal pointer value without deleting instance and return previos value. | |
| void | Swap (TOptDelPtr &ptr) |
| Swap two pointers. | |
| TOptDelPtr & | operator= (const TOptDelPtr &ptr) |
| Assign operator. | |
| TOptDelPtr & | operator= (TOptDelPtr &&ptr) |
| Assign move operator. | |
| TOptDelPtr & | operator= (std::unique_ptr< Type > &&ptr) |
| Assign operator. | |
| TOptDelPtr & | operator= (Type *ptr) |
| Assign operator. | |
| template<class SourceType > | |
| bool | SetCastedOrRemove (SourceType *ptr, ReleaseFn releaseFn=nullptr) |
| Set internal pointer using casted pointer of other type. | |
| template<class SourcePtrType > | |
| bool | SetCastedOrRemove (std::unique_ptr< SourcePtrType > ptr) |
| Set internal pointer using casted pointer of other type. | |
Public Member Functions inherited from istd::TPointerBase< Type > | |
| TPointerBase (Type *ptr=nullptr) | |
| Construct and assign internal pointer. | |
| void | SetPtr (Type *ptr) |
| Set value of internal stored pointer. | |
| void | Reset () |
| Set internal pointer value to nullptr. | |
| Type * | get () const |
| Return access to internal stored pointer. | |
| bool | IsValid () const |
| Check if internal pointer not nullptr. | |
| Type & | operator* () const |
| Get an access to object pointed at. | |
| 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 |
| operator bool () const | |
Static Public Member Functions | |
| static void | SimpleDeleter (Type *ptr) |
| Function calling delete operator. | |
Protected Member Functions | |
| void | Detach () |
| Remove referenced object. | |
Protected Member Functions inherited from istd::TPointerBase< Type > | |
| TPointerBase< Type > & | operator= (const TPointerBase< Type > ptr) |
| Type *& | GetPtrRef () |
| void | Swap (TPointerBase &ptr) |
| Swap two pointers. | |
Additional Inherited Members | |
Protected Attributes inherited from istd::TPointerBase< Type > | |
| Type * | m_ptr |
Pointer wrapper providing activatable deleting pointed object during destruction.
Definition at line 22 of file TOptDelPtr.h.
| TPointerBase<Type> istd::TOptDelPtr< Type, DelArray >::BaseClass |
Definition at line 25 of file TOptDelPtr.h.
| std::function<void (Type*)> istd::TOptDelPtr< Type, DelArray >::ReleaseFn |
Definition at line 27 of file TOptDelPtr.h.
|
delete |
|
inline |
Construct and init this pointer.
| ptr | pointer to object. |
| releaseFn | if set, pointed object will be automatically released by this function. |
Definition at line 190 of file TOptDelPtr.h.
|
inline |
Construct and init this pointer.
| ptr | pointer to object. |
| releaseFlag | if true, pointed object will be automatically released. |
Definition at line 197 of file TOptDelPtr.h.
|
inline |
Move constructor.
Definition at line 204 of file TOptDelPtr.h.
|
inline |
Construct and init this pointer using unique pointer.
| ptr | pointer to object, responsibility will be overtaken. |
Definition at line 212 of file TOptDelPtr.h.
|
inline |
|
protected |
Remove referenced object.
Warning: internal pointer will be not changed.
Definition at line 345 of file TOptDelPtr.h.
| Type * istd::TOptDelPtr< Type, DelArray >::GetFreePtr | ( | ) | const |
Get internal pointer only if it is free, it means will be not released.
Definition at line 251 of file TOptDelPtr.h.
|
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 233 of file TOptDelPtr.h.
| TOptDelPtr< Type, DelArray > & 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 (nullptr).
Definition at line 284 of file TOptDelPtr.h.
References istd::TPointerBase< Type >::m_ptr.
| TOptDelPtr< Type, DelArray > & istd::TOptDelPtr< Type, DelArray >::operator= | ( | std::unique_ptr< Type > && | ptr | ) |
| TOptDelPtr< Type, DelArray > & istd::TOptDelPtr< Type, DelArray >::operator= | ( | TOptDelPtr< Type, DelArray > && | ptr | ) |
Assign move operator.
The source pointer must be invalid (nullptr) is it takes responsibility over the object life cycle.
Definition at line 299 of file TOptDelPtr.h.
| TOptDelPtr< Type, DelArray > & istd::TOptDelPtr< Type, DelArray >::operator= | ( | Type * | ptr | ) |
Assign operator.
It removes refererenced object before new is assigned.
| ptr | pointer to object. |
Definition at line 320 of file TOptDelPtr.h.
|
inline |
Reset internal pointer value without deleting instance and return previos value.
Definition at line 262 of file TOptDelPtr.h.
|
inline |
Remove object pointed by internal pointer and set this pointer to nullptr.
Definition at line 226 of file TOptDelPtr.h.
|
inline |
Set internal pointer using casted pointer of other type.
If casting is not possible, pointed object ptr will be deleted.
| releaseFn | if set, pointed object will be automatically deleted by this function. |
Definition at line 128 of file TOptDelPtr.h.
References istd::TOptDelPtr< Type, DelArray >::SetPtr().
|
inline |
Set internal pointer using casted pointer of other type.
If casting is not possible, pointed object ptr will be deleted.
| releaseFn | if set, pointed object will be automatically deleted by this function. |
Definition at line 152 of file TOptDelPtr.h.
References istd::TOptDelPtr< Type, DelArray >::SetPtr(), and istd::TOptDelPtr< Type, DelArray >::SimpleDeleter().
|
inline |
Set new value of internal pointer.
If internal pointer wasn't nullptr, it will be deleted.
| ptr | new pointer value. |
| releaseFn | if set, pointed object will be automatically released by this function. |
Definition at line 240 of file TOptDelPtr.h.
Referenced by istd::TOptDelPtr< Type, DelArray >::SetCastedOrRemove(), and istd::TOptDelPtr< Type, DelArray >::SetCastedOrRemove().
|
static |
Function calling delete operator.
Definition at line 331 of file TOptDelPtr.h.
Referenced by istd::TOptDelPtr< Type, DelArray >::SetCastedOrRemove().
| void istd::TOptDelPtr< Type, DelArray >::Swap | ( | TOptDelPtr< Type, DelArray > & | ptr | ) |
Swap two pointers.
Definition at line 276 of file TOptDelPtr.h.
© Witold Gantzke and Kirill Lepskiy