ACF $AcfVersion:0$
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl > Class Template Reference

Base template for polymorphic interface pointers. More...

#include <TInterfacePtr.h>

Inheritance diagram for istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >:
istd::TSharedInterfacePtr< InterfaceType, icomp::IComponent > istd::TSharedInterfacePtr< i2d::ICalibration2d > istd::TSharedInterfacePtr< istd::IChangeable > istd::TSharedInterfacePtr< idoc::IUndoManager > istd::TSharedInterfacePtr< istd::IPolymorphic > istd::TSharedInterfacePtr< iser::IObject > istd::TSharedInterfacePtr< iprm::IParamsSet > istd::TSharedInterfacePtr< iser::ISerializable > istd::TUniqueInterfacePtr< istd::IChangeable > istd::TUniqueInterfacePtr< iser::ISerializable > istd::TUniqueInterfacePtr< i2d::ICalibration2d > istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType > istd::TUniqueInterfacePtr< InterfaceType, RootIntefaceType >

Public Types

typedef PolymorphicPointerImpl RootObjectPtr
 
typedef std::function< InterfaceType *()> ExtractInterfaceFunc
 

Public Member Functions

bool IsValid () const noexcept
 
template<typename Interface = InterfaceType>
Interface * GetPtr () noexcept
 
template<typename Interface = InterfaceType>
const Interface * GetPtr () const noexcept
 
const InterfaceType * operator-> () const noexcept
 
InterfaceType * operator-> () noexcept
 
const InterfaceType & operator* () const noexcept
 
InterfaceType & operator* () noexcept
 
void Reset () noexcept
 
void SetPtr (InterfaceType *interfacePtr)
 
void SetPtr (istd::IPolymorphic *rootPtr, const ExtractInterfaceFunc &extractInterface)
 
void SetPtr (istd::IPolymorphic *rootPtr, InterfaceType *interfacePtr) noexcept
 
RootObjectPtrGetBasePtr () noexcept
 
const RootObjectPtrGetBasePtr () const noexcept
 
InterfaceType * get () noexcept
 
const InterfaceType * get () const noexcept
 
 operator bool () const noexcept
 
bool operator== (std::nullptr_t) const noexcept
 
bool operator!= (std::nullptr_t) const noexcept
 
TInterfacePtroperator= (std::nullptr_t) noexcept
 

Protected Member Functions

 TInterfacePtr (const TInterfacePtr &)=delete
 
TInterfacePtroperator= (const TInterfacePtr &)=delete
 
 TInterfacePtr () noexcept
 
 TInterfacePtr (InterfaceType *interfacePtr) noexcept
 
 TInterfacePtr (std::nullptr_t) noexcept
 
 TInterfacePtr (istd::IPolymorphic *rootPtr, const ExtractInterfaceFunc &extractInterface) noexcept
 
 TInterfacePtr (istd::IPolymorphic *rootPtr, InterfaceType *interfacePtr) noexcept
 
 TInterfacePtr (TInterfacePtr &&ptr) noexcept
 
TInterfacePtroperator= (TInterfacePtr &&ptr) noexcept
 

Protected Attributes

RootObjectPtr m_rootPtr
 
InterfaceType * m_interfacePtr = nullptr
 

Detailed Description

template<class InterfaceType, class PolymorphicPointerImpl>
class istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >

Base template for polymorphic interface pointers.

Specialized polymorphic pointer that manages the allocated root object (m_rootPtr) and simultaneously provides a pointer to the actual interface implementation (m_interfacePtr). The interface instance is "derived" from the root object using the provided extractor (ExtractInterfaceFunc) or an alternative extraction mechanism. Ownership and lifetime are tied to m_rootPtr; m_interfacePtr is a non-owning view into the interface and may point to a different (sub)object than m_rootPtr.

Template Parameters
InterfaceTypeThe interface type to expose.
PolymorphicPointerImplThe underlying smart pointer type (std::unique_ptr or std::shared_ptr).
Note
This class is not meant to be used directly. Use TUniqueInterfacePtr or TSharedInterfacePtr instead.

Definition at line 39 of file TInterfacePtr.h.

Member Typedef Documentation

◆ ExtractInterfaceFunc

template<class InterfaceType , class PolymorphicPointerImpl >
typedef std::function<InterfaceType* ()> istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::ExtractInterfaceFunc

Definition at line 43 of file TInterfacePtr.h.

◆ RootObjectPtr

template<class InterfaceType , class PolymorphicPointerImpl >
typedef PolymorphicPointerImpl istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::RootObjectPtr

Definition at line 42 of file TInterfacePtr.h.

Constructor & Destructor Documentation

◆ TInterfacePtr() [1/7]

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::TInterfacePtr ( const TInterfacePtr< InterfaceType, PolymorphicPointerImpl > &  )
protecteddelete

◆ TInterfacePtr() [2/7]

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::TInterfacePtr ( )
inlineprotectednoexcept

Definition at line 186 of file TInterfacePtr.h.

◆ TInterfacePtr() [3/7]

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::TInterfacePtr ( InterfaceType *  interfacePtr)
inlineprotectednoexcept

◆ TInterfacePtr() [4/7]

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::TInterfacePtr ( std::nullptr_t  )
inlineprotectednoexcept

Definition at line 197 of file TInterfacePtr.h.

◆ TInterfacePtr() [5/7]

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::TInterfacePtr ( istd::IPolymorphic rootPtr,
const ExtractInterfaceFunc extractInterface 
)
inlineprotectednoexcept

◆ TInterfacePtr() [6/7]

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::TInterfacePtr ( istd::IPolymorphic rootPtr,
InterfaceType *  interfacePtr 
)
inlineprotectednoexcept

◆ TInterfacePtr() [7/7]

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::TInterfacePtr ( TInterfacePtr< InterfaceType, PolymorphicPointerImpl > &&  ptr)
inlineprotectednoexcept

Definition at line 214 of file TInterfacePtr.h.

Member Function Documentation

◆ get() [1/2]

template<class InterfaceType , class PolymorphicPointerImpl >
const InterfaceType * istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::get ( ) const
inlinenoexcept
Note
different from std::unique_ptr/shared_ptr get() - returns const pointer

Definition at line 155 of file TInterfacePtr.h.

References istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::GetPtr().

◆ get() [2/2]

template<class InterfaceType , class PolymorphicPointerImpl >
InterfaceType * istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::get ( )
inlinenoexcept

◆ GetBasePtr() [1/2]

template<class InterfaceType , class PolymorphicPointerImpl >
const RootObjectPtr & istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::GetBasePtr ( ) const
inlinenoexcept

◆ GetBasePtr() [2/2]

template<class InterfaceType , class PolymorphicPointerImpl >
RootObjectPtr & istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::GetBasePtr ( )
inlinenoexcept

◆ GetPtr() [1/2]

template<class InterfaceType , class PolymorphicPointerImpl >
template<typename Interface = InterfaceType>
const Interface * istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::GetPtr ( ) const
inlinenoexcept

◆ GetPtr() [2/2]

template<class InterfaceType , class PolymorphicPointerImpl >
template<typename Interface = InterfaceType>
Interface * istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::GetPtr ( )
inlinenoexcept

◆ IsValid()

template<class InterfaceType , class PolymorphicPointerImpl >
bool istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::IsValid ( ) const
inlinenoexcept

◆ operator bool()

template<class InterfaceType , class PolymorphicPointerImpl >
istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator bool ( ) const
inlineexplicitnoexcept

◆ operator!=()

template<class InterfaceType , class PolymorphicPointerImpl >
bool istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator!= ( std::nullptr_t  ) const
inlinenoexcept

◆ operator*() [1/2]

template<class InterfaceType , class PolymorphicPointerImpl >
const InterfaceType & istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator* ( ) const
inlinenoexcept

◆ operator*() [2/2]

template<class InterfaceType , class PolymorphicPointerImpl >
InterfaceType & istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator* ( )
inlinenoexcept

◆ operator->() [1/2]

template<class InterfaceType , class PolymorphicPointerImpl >
const InterfaceType * istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator-> ( ) const
inlinenoexcept

◆ operator->() [2/2]

template<class InterfaceType , class PolymorphicPointerImpl >
InterfaceType * istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator-> ( )
inlinenoexcept

◆ operator=() [1/3]

template<class InterfaceType , class PolymorphicPointerImpl >
TInterfacePtr & istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator= ( const TInterfacePtr< InterfaceType, PolymorphicPointerImpl > &  )
protecteddelete

◆ operator=() [2/3]

template<class InterfaceType , class PolymorphicPointerImpl >
TInterfacePtr & istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator= ( std::nullptr_t  )
inlinenoexcept

◆ operator=() [3/3]

template<class InterfaceType , class PolymorphicPointerImpl >
TInterfacePtr & istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator= ( TInterfacePtr< InterfaceType, PolymorphicPointerImpl > &&  ptr)
inlineprotectednoexcept

◆ operator==()

template<class InterfaceType , class PolymorphicPointerImpl >
bool istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::operator== ( std::nullptr_t  ) const
inlinenoexcept

◆ Reset()

template<class InterfaceType , class PolymorphicPointerImpl >
void istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::Reset ( )
inlinenoexcept

◆ SetPtr() [1/3]

template<class InterfaceType , class PolymorphicPointerImpl >
void istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::SetPtr ( InterfaceType *  interfacePtr)
inline

◆ SetPtr() [2/3]

template<class InterfaceType , class PolymorphicPointerImpl >
void istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::SetPtr ( istd::IPolymorphic rootPtr,
const ExtractInterfaceFunc extractInterface 
)
inline

◆ SetPtr() [3/3]

template<class InterfaceType , class PolymorphicPointerImpl >
void istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::SetPtr ( istd::IPolymorphic rootPtr,
InterfaceType *  interfacePtr 
)
inlinenoexcept

Member Data Documentation

◆ m_interfacePtr

template<class InterfaceType , class PolymorphicPointerImpl >
InterfaceType* istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::m_interfacePtr = nullptr
protected

◆ m_rootPtr

template<class InterfaceType , class PolymorphicPointerImpl >
RootObjectPtr istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::m_rootPtr
protected

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