OpendTect 8.0
Loading...
Searching...
No Matches
PtrManBase< T > Class Template Reference

#include <ptrman.h>

Inherited by ConstPtrManBase< T >, and NonConstPtrManBase< T >.

Public Types

typedef T *(* PointerCreator) ()
 

Public Member Functions

T * createIfNull (PointerCreator=createSingleObject< T >)
 
void erase ()
 
 operator bool ()
 
 operator bool () const
 
bool operator! () const
 
template<class TT>
bool operator== (const PtrManBase< TT > &) const =delete
 
T * release ()
 Returns pointer. I won't take care of it any longer.
 
T * set (T *p, bool doerase=true)
 Returns old pointer if not erased.
 
bool setIfNull (T *p)
 
bool setIfNull (T *p, bool takeover)
 

Protected Types

typedef void(* PtrFunc) (T *)
 

Protected Member Functions

 PtrManBase (PtrFunc setfunc, PtrFunc deletor, T *)
 
virtual ~PtrManBase ()
 

Protected Attributes

PtrFunc deletefunc_
 
Threads::AtomicPointer< T > ptr_
 
PtrFunc setfunc_
 

Detailed Description

template<class T>
class PtrManBase< T >

Base class for smart pointers. Don't use directly, use PtrMan, ArrPtrMan or RefMan instead.

Member Typedef Documentation

◆ PointerCreator

template<class T>
typedef T *(* PtrManBase< T >::PointerCreator) ()

◆ PtrFunc

template<class T>
typedef void(* PtrManBase< T >::PtrFunc) (T *)
protected

Constructor & Destructor Documentation

◆ PtrManBase()

template<class T>
PtrManBase< T >::PtrManBase ( PtrFunc setfunc,
PtrFunc deletor,
T * p )
inlineprotected

◆ ~PtrManBase()

template<class T>
virtual PtrManBase< T >::~PtrManBase ( )
inlineprotectedvirtual

Member Function Documentation

◆ createIfNull()

template<class T>
T * PtrManBase< T >::createIfNull ( PointerCreator creator = createSingleObject<T>)
inline

If null, PointerCrator will be called to create new object.

◆ erase()

template<class T>
void PtrManBase< T >::erase ( )
inline

◆ operator bool() [1/2]

template<class T>
PtrManBase< T >::operator bool ( )
inline

◆ operator bool() [2/2]

template<class T>
PtrManBase< T >::operator bool ( ) const
inline

◆ operator!()

template<class T>
bool PtrManBase< T >::operator! ( ) const
inline

◆ operator==()

template<class T>
template<class TT>
bool PtrManBase< T >::operator== ( const PtrManBase< TT > & ) const
delete

◆ release()

template<class T>
T * PtrManBase< T >::release ( )
inline

Returns pointer. I won't take care of it any longer.

◆ set()

template<class T>
T * PtrManBase< T >::set ( T * p,
bool doerase = true )
inline

Returns old pointer if not erased.

◆ setIfNull() [1/2]

template<class T>
bool PtrManBase< T >::setIfNull ( T * p)
inline

◆ setIfNull() [2/2]

template<class T>
bool PtrManBase< T >::setIfNull ( T * p,
bool takeover )
inline

If takeover==true, pointer will be deleted if object was not set.

Member Data Documentation

◆ deletefunc_

template<class T>
PtrFunc PtrManBase< T >::deletefunc_
protected

◆ ptr_

template<class T>
Threads::AtomicPointer<T> PtrManBase< T >::ptr_
protected

◆ setfunc_

template<class T>
PtrFunc PtrManBase< T >::setfunc_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2026