|
ACF $AcfVersion:0$
|
Shared ownership smart pointer for interface types. More...
#include <TInterfacePtr.h>
Public Types | |
| typedef TInterfacePtr< InterfaceType, std::shared_ptr< RootIntefaceType > > | BaseClass |
| typedef BaseClass::ExtractInterfaceFunc | ExtractInterfaceFunc |
Public Types inherited from istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl > | |
| typedef PolymorphicPointerImpl | RootObjectPtr |
| typedef std::function< InterfaceType *()> | ExtractInterfaceFunc |
Public Member Functions | |
| TSharedInterfacePtr () noexcept | |
| TSharedInterfacePtr (InterfaceType *interfacePtr) noexcept | |
| TSharedInterfacePtr (RootIntefaceType *rootPtr, const ExtractInterfaceFunc &extractInterface) noexcept | |
| TSharedInterfacePtr (const TSharedInterfacePtr &ptr) noexcept | |
| Copy constructor. | |
| template<typename DerivedType > | |
| TSharedInterfacePtr (const TSharedInterfacePtr< DerivedType > &other) noexcept | |
| Copy constructor from derived type. | |
| template<typename DerivedType > | |
| TSharedInterfacePtr (const std::shared_ptr< DerivedType > &ptr) noexcept | |
| template<typename DerivedType > | |
| TSharedInterfacePtr (std::unique_ptr< DerivedType > &&ptr) noexcept | |
| TSharedInterfacePtr (TSharedInterfacePtr &&ptr) noexcept | |
| Move constructor. | |
| template<typename DerivedType > | |
| TSharedInterfacePtr (TUniqueInterfacePtr< DerivedType > &&ptr) noexcept | |
| Construct from unique by transferring ownership into shared. | |
| ~TSharedInterfacePtr () | |
| void | Reset () noexcept |
| TSharedInterfacePtr & | operator= (const TSharedInterfacePtr &ptr) noexcept |
| Copy assignment operator. | |
| template<typename DerivedType > | |
| TSharedInterfacePtr & | operator= (const TSharedInterfacePtr< DerivedType > &ptr) noexcept |
| Copy assignment operator from derived type. | |
| TSharedInterfacePtr & | operator= (TSharedInterfacePtr &&ptr) noexcept |
| template<typename DerivedType > | |
| TSharedInterfacePtr & | FromUnique (TUniqueInterfacePtr< DerivedType > &&uniquePtr) noexcept |
| Convert from unique to shared. | |
| TSharedInterfacePtr & | FromUnique (TUniqueInterfacePtr< InterfaceType > &uniquePtr) noexcept |
| template<class SourceInterfaceType > | |
| bool | MoveCastedPtr (TUniqueInterfacePtr< SourceInterfaceType > &&source) noexcept |
| Move-cast from unique: transfer ownership if dynamic_cast succeeds. | |
| template<class SourceInterfaceType > | |
| bool | MoveCastedPtr (TUniqueInterfacePtr< SourceInterfaceType > &source) noexcept |
| template<class SourceInterfaceType > | |
| bool | SetCastedPtr (TSharedInterfacePtr< SourceInterfaceType > &source) noexcept |
| Set from another shared pointer if dynamic_cast succeeds. | |
| template<class T > | |
| TSharedInterfacePtr< T > | dynamicCast () noexcept |
| template<class T > | |
| TSharedInterfacePtr< const T > | dynamicCast () const noexcept |
Public Member Functions inherited from istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl > | |
| 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 |
| RootObjectPtr & | GetBasePtr () noexcept |
| const RootObjectPtr & | GetBasePtr () 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 |
| TInterfacePtr & | operator= (std::nullptr_t) noexcept |
Static Public Member Functions | |
| template<typename OtherInterface > | |
| static TSharedInterfacePtr | CreateFromUnique (TUniqueInterfacePtr< OtherInterface > &uniquePtr) noexcept |
| Create a shared pointer from unique pointer of other type by transferring ownership if dynamic_cast succeeds. | |
| static TSharedInterfacePtr | CreateFromUnique (TUniqueInterfacePtr< InterfaceType > &&uniquePtr) noexcept |
| Create a shared pointer from unique of the same type by transferring ownership. | |
| static TSharedInterfacePtr | CreateFromUnique (TUniqueInterfacePtr< InterfaceType > &uniquePtr) noexcept |
Additional Inherited Members | |
Protected Member Functions inherited from istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl > | |
| TInterfacePtr (const TInterfacePtr &)=delete | |
| TInterfacePtr & | operator= (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 | |
| TInterfacePtr & | operator= (TInterfacePtr &&ptr) noexcept |
Protected Attributes inherited from istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl > | |
| RootObjectPtr | m_rootPtr |
| InterfaceType * | m_interfacePtr = nullptr |
Shared ownership smart pointer for interface types.
TSharedInterfacePtr provides shared ownership of an object with reference counting and automatic memory management. It is similar to std::shared_ptr but specialized for ACF's interface-based architecture where the root object and interface pointer may differ.
Key characteristics:
| InterfaceType | The interface type to expose. |
| RootIntefaceType | The root type that owns the object (default: istd::IPolymorphic). |
Example:
Definition at line 506 of file TInterfacePtr.h.
| typedef TInterfacePtr<InterfaceType, std::shared_ptr<RootIntefaceType> > istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::BaseClass |
Definition at line 509 of file TInterfacePtr.h.
| typedef BaseClass::ExtractInterfaceFunc istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::ExtractInterfaceFunc |
Definition at line 510 of file TInterfacePtr.h.
|
inlinenoexcept |
Definition at line 517 of file TInterfacePtr.h.
|
inlinenoexcept |
Definition at line 522 of file TInterfacePtr.h.
|
inlinenoexcept |
Definition at line 527 of file TInterfacePtr.h.
|
inlinenoexcept |
|
inlinenoexcept |
Copy constructor from derived type.
Shares ownership.
Definition at line 545 of file TInterfacePtr.h.
|
inlinenoexcept |
Definition at line 553 of file TInterfacePtr.h.
|
inlinenoexcept |
Definition at line 562 of file TInterfacePtr.h.
|
inlinenoexcept |
|
inlinenoexcept |
Construct from unique by transferring ownership into shared.
Definition at line 583 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::FromUnique().
|
inline |
Definition at line 588 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::Reset().
|
inlinestaticnoexcept |
Create a shared pointer from unique of the same type by transferring ownership.
Alternatively move assignment operator can be used.
Definition at line 687 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::FromUnique().
|
inlinestaticnoexcept |
Definition at line 694 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::CreateFromUnique().
|
inlinestaticnoexcept |
Create a shared pointer from unique pointer of other type by transferring ownership if dynamic_cast succeeds.
Definition at line 665 of file TInterfacePtr.h.
Referenced by istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::CreateFromUnique(), istd::TOptInterfacePtr< InterfaceType >::TakeOver(), and istd::TOptInterfacePtr< InterfaceType >::TakeOver().
|
inlinenoexcept |
Definition at line 762 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::SetCastedPtr().
|
inlinenoexcept |
Definition at line 754 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::SetCastedPtr().
|
inlinenoexcept |
Convert from unique to shared.
After this call, uniquePtr no longer owns the object.
Definition at line 632 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::Reset().
Referenced by istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::CreateFromUnique(), istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::FromUnique(), istd::TOptInterfacePtr< InterfaceType >::TOptInterfacePtr(), and istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::TSharedInterfacePtr().
|
inlinenoexcept |
Definition at line 656 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::FromUnique().
|
inlinenoexcept |
Move-cast from unique: transfer ownership if dynamic_cast succeeds.
Definition at line 703 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::Reset().
Referenced by istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::MoveCastedPtr().
|
inlinenoexcept |
Definition at line 723 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::MoveCastedPtr().
|
inlinenoexcept |
Copy assignment operator.
Shares ownership.
Definition at line 602 of file TInterfacePtr.h.
References istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::m_rootPtr.
|
inlinenoexcept |
Copy assignment operator from derived type.
Shares ownership.
Definition at line 613 of file TInterfacePtr.h.
References istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::GetBasePtr().
|
inlinenoexcept |
Definition at line 621 of file TInterfacePtr.h.
|
inlinenoexcept |
Definition at line 593 of file TInterfacePtr.h.
Referenced by istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::FromUnique(), istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::MoveCastedPtr(), istd::TOptInterfacePtr< InterfaceType >::Reset(), istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::SetCastedPtr(), istd::TOptInterfacePtr< InterfaceType >::SetUnmanagedPtr(), istd::TOptInterfacePtr< InterfaceType >::TakeOver(), and istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::~TSharedInterfacePtr().
|
inlinenoexcept |
Set from another shared pointer if dynamic_cast succeeds.
Definition at line 732 of file TInterfacePtr.h.
References istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::Reset().
Referenced by istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::dynamicCast(), istd::TSharedInterfacePtr< InterfaceType, RootIntefaceType >::dynamicCast(), and istd::TOptInterfacePtr< InterfaceType >::SetCastedPtr().