ACF $AcfVersion:0$
Public Types | Public Member Functions | Protected Member Functions | List of all members
istd::TDelPtr< Type, Accessor > Class Template Reference

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

#include <TDelPtr.h>

Inheritance diagram for istd::TDelPtr< Type, Accessor >:
istd::TPointerBase< Type >

Public Types

typedef TPointerBase< Type > BaseClass
 

Public Member Functions

 TDelPtr (Type *ptr=NULL)
 Construct and init this pointer.
 
 TDelPtr (const TDelPtr &ptr)
 Copy constructor.
 
 TDelPtr (TDelPtr &&ptr)
 Move constructor.
 
 ~TDelPtr ()
 Destructor.
 
void Reset ()
 Remove object pointed by internal pointer and set this pointer to NULL.
 
void SetPtr (Type *ptr)
 Set new value of internal pointer.
 
Type * PopPtr ()
 Reset internal pointer value without deleting instance and return previos value.
 
void TakeOver (TDelPtr &sourcePtr)
 Take internal pointer over.
 
TDelPtroperator= (const TDelPtr &ptr)
 Assign operator.
 
TDelPtroperator= (TDelPtr &&ptr)
 Move operator.
 
TDelPtroperator= (Type *ptr)
 Assign operator.
 
template<class SourceType >
bool SetCastedOrRemove (SourceType *ptr)
 Set internal pointer using casted pointer of other type.
 
- Public Member Functions inherited from istd::TPointerBase< Type >
 TPointerBase (Type *ptr=NULL)
 Construct and assign internal pointer.
 
void SetPtr (Type *ptr)
 Set value of internal stored pointer.
 
void Reset ()
 Set internal pointer value to NULL.
 
Type * GetPtr () const
 Return access to internal stored pointer.
 
bool IsValid () const
 Check if internal pointer not NULL.
 
void Swap (TPointerBase &ptr)
 Swap two pointers.
 
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
 

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 ()
 

Detailed Description

template<class Type, class Accessor = DefaultAccessor<Type>>
class istd::TDelPtr< Type, Accessor >

Pointer wrapper providing automatic deleting pointed object during destruction.

Definition at line 20 of file TDelPtr.h.

Member Typedef Documentation

◆ BaseClass

template<class Type , class Accessor = DefaultAccessor<Type>>
typedef TPointerBase<Type> istd::TDelPtr< Type, Accessor >::BaseClass

Definition at line 23 of file TDelPtr.h.

Constructor & Destructor Documentation

◆ TDelPtr() [1/3]

template<class Type , class Accessor >
istd::TDelPtr< Type, Accessor >::TDelPtr ( Type *  ptr = NULL)
inline

Construct and init this pointer.

Parameters
ptrpointer to object.

Definition at line 124 of file TDelPtr.h.

◆ TDelPtr() [2/3]

template<class Type , class Accessor = DefaultAccessor<Type>>
istd::TDelPtr< Type, Accessor >::TDelPtr ( const TDelPtr< Type, Accessor > &  ptr)

Copy constructor.

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

◆ TDelPtr() [3/3]

template<class Type , class Accessor >
istd::TDelPtr< Type, Accessor >::TDelPtr ( TDelPtr< Type, Accessor > &&  ptr)
inline

Move constructor.

Definition at line 139 of file TDelPtr.h.

References istd::TDelPtr< Type, Accessor >::SetPtr().

◆ ~TDelPtr()

template<class Type , class Accessor >
istd::TDelPtr< Type, Accessor >::~TDelPtr ( )
inline

Destructor.

It calls Reset() to delete pointed object.

Definition at line 147 of file TDelPtr.h.

References istd::TDelPtr< Type, Accessor >::Detach().

Member Function Documentation

◆ Detach()

template<class Type , class Accessor >
void istd::TDelPtr< Type, Accessor >::Detach ( )
protected

Remove referenced object.

Warning: internal pointer will be not changed.

Definition at line 222 of file TDelPtr.h.

References NULL.

Referenced by istd::TDelPtr< Type, Accessor >::~TDelPtr().

◆ operator=() [1/3]

template<class Type , class Accessor = DefaultAccessor<Type>>
TDelPtr & istd::TDelPtr< Type, Accessor >::operator= ( const TDelPtr< Type, Accessor > &  ptr)

Assign operator.

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

◆ operator=() [2/3]

template<class Type , class Accessor >
TDelPtr< Type, Accessor > & istd::TDelPtr< Type, Accessor >::operator= ( TDelPtr< Type, Accessor > &&  ptr)

Move operator.

Definition at line 200 of file TDelPtr.h.

◆ operator=() [3/3]

template<class Type , class Accessor >
TDelPtr< Type, Accessor > & istd::TDelPtr< Type, Accessor >::operator= ( Type *  ptr)

Assign operator.

It removes refererenced object before new is assigned.

Parameters
ptrpointer to object.

Definition at line 209 of file TDelPtr.h.

◆ PopPtr()

template<class Type , class Accessor >
Type * istd::TDelPtr< Type, Accessor >::PopPtr ( )
inline

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

Definition at line 170 of file TDelPtr.h.

References NULL.

Referenced by ilog::TExtMessage< Element >::CloneMe(), and istd::TDelPtr< Type, Accessor >::TakeOver().

◆ Reset()

template<class Type , class Accessor >
void istd::TDelPtr< Type, Accessor >::Reset ( )
inline

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

Definition at line 154 of file TDelPtr.h.

References NULL.

◆ SetCastedOrRemove()

template<class Type , class Accessor = DefaultAccessor<Type>>
template<class SourceType >
bool istd::TDelPtr< Type, Accessor >::SetCastedOrRemove ( SourceType *  ptr)
inline

Set internal pointer using casted pointer of other type.

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

Definition at line 94 of file TDelPtr.h.

References NULL, and istd::TDelPtr< Type, Accessor >::SetPtr().

◆ SetPtr()

template<class Type , class Accessor >
void istd::TDelPtr< Type, Accessor >::SetPtr ( Type *  ptr)
inline

Set new value of internal pointer.

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

Definition at line 161 of file TDelPtr.h.

Referenced by icomp::CSimComponentContextBase::InsertMultiAttr(), istd::TDelPtr< Type, Accessor >::SetCastedOrRemove(), and istd::TDelPtr< Type, Accessor >::TDelPtr().

◆ TakeOver()

template<class Type , class Accessor >
void istd::TDelPtr< Type, Accessor >::TakeOver ( TDelPtr< Type, Accessor > &  sourcePtr)

Take internal pointer over.

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

Definition at line 180 of file TDelPtr.h.

References istd::TDelPtr< Type, Accessor >::PopPtr().


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