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. More...
 
 TDelPtr (const TDelPtr &ptr)
 Copy constructor. More...
 
 ~TDelPtr ()
 Destructor. More...
 
void Reset ()
 Remove object pointed by internal pointer and set this pointer to NULL. More...
 
void SetPtr (Type *ptr)
 Set new value of internal pointer. More...
 
Type * PopPtr ()
 Reset internal pointer value without deleting instance and return previos value. More...
 
void TakeOver (TDelPtr &sourcePtr)
 Take internal pointer over. More...
 
TDelPtroperator= (const TDelPtr &ptr)
 Assign operator. More...
 
TDelPtroperator= (Type *ptr)
 Assign operator. More...
 
template<class SourceType >
bool SetCastedOrRemove (SourceType *ptr)
 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, 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

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

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 111 of file TDelPtr.h.

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

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

Destructor.

It calls Reset() to delete pointed object.

Definition at line 126 of file TDelPtr.h.

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

Member Function Documentation

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 192 of file TDelPtr.h.

References NULL.

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

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

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 179 of file TDelPtr.h.

template<class Type , class Accessor >
Type * istd::TDelPtr< Type, Accessor >::PopPtr ( )
inline
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 133 of file TDelPtr.h.

References NULL.

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 83 of file TDelPtr.h.

Referenced by icomp::TComponentCloneWrap< BaseClass >::CloneMe().

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 140 of file TDelPtr.h.

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

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 159 of file TDelPtr.h.

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


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

© 2007-2017 Witold Gantzke and Kirill Lepskiy