VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtVreUniqueBase< SELF_T, SUPER_T > Class Template Reference

Detailed Description

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
class makVre::DtVreUniqueBase< SELF_T, SUPER_T >

Provides Ptr (raw non-owning observer) and Uptr (std::unique_ptr) aliases, type function overrides, and a per-class creator factory interface. Mirrors DtVreSharedBase but produces std::unique_ptr<SELF_T> from create(). Use registerCreator<CUSTOM_T>() to replace the default creator at runtime.

Per the MAK coding standard, Ptr is the non-owning observer handle and Uptr is the owning handle.

Template Parameters
SELF_TThe derived class type (CRTP parameter)
SUPER_TThe base class type, defaults to DtVreUniqueObject

#include <baseClass.h>

Inheritance diagram for makVre::DtVreUniqueBase< SELF_T, SUPER_T >:
[legend]

Public Types

using Super = SUPER_T
 
using Ptr = SELF_T*
 
using Uptr = std::unique_ptr<SELF_T>
 

Public Member Functions

 DtVreUniqueBase ()
 
virtual ~DtVreUniqueBase ()
 
std::string type () const override
 
- Public Member Functions inherited from makVre::DtVreUniqueObject
 DtVreUniqueObject ()
 
virtual ~DtVreUniqueObject ()
 
- Public Member Functions inherited from makVre::DtVreBase
 DtVreBase ()
 
virtual ~DtVreBase ()=default
 
virtual void setName (const std::string &name)
 
virtual std::string name () const
 

Static Public Member Functions

static std::string Type ()
 
static Uptr create ()
 
template<class CUSTOM_T>
static void registerCreator ()
 

Static Protected Member Functions

static std::shared_ptr< DtBaseCreator< SELF_T > > & creator ()
 

Additional Inherited Members

- Protected Attributes inherited from makVre::DtVreBase
std::string myName
 

Member Typedef Documentation

◆ Super

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
using makVre::DtVreUniqueBase< SELF_T, SUPER_T >::Super = SUPER_T

Super class type alias.

◆ Ptr

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
using makVre::DtVreUniqueBase< SELF_T, SUPER_T >::Ptr = SELF_T*

Raw non-owning pointer type alias.

◆ Uptr

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
using makVre::DtVreUniqueBase< SELF_T, SUPER_T >::Uptr = std::unique_ptr<SELF_T>

Owning unique pointer type alias.

Constructor & Destructor Documentation

◆ DtVreUniqueBase()

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
makVre::DtVreUniqueBase< SELF_T, SUPER_T >::DtVreUniqueBase ( )
inline

Default constructor.

◆ ~DtVreUniqueBase()

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
virtual makVre::DtVreUniqueBase< SELF_T, SUPER_T >::~DtVreUniqueBase ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ Type()

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
static std::string makVre::DtVreUniqueBase< SELF_T, SUPER_T >::Type ( )
inlinestatic

Gets the static type name of this class.

Returns
A string representing the type name

References makVre::DtVreBase::name().

◆ type()

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
std::string makVre::DtVreUniqueBase< SELF_T, SUPER_T >::type ( ) const
inlineoverridevirtual

Gets the runtime type of this object.

Returns
A string representing the type of this object

Implements makVre::DtVreBase.

References makVre::DtVreBase::name().

◆ create()

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
static Uptr makVre::DtVreUniqueBase< SELF_T, SUPER_T >::create ( )
inlinestatic

Creates an instance of this class or its registered extension.

Use CLASS::create() instead of new when you want to allow custom extensions to replace the concrete type produced at runtime. By default, CLASS::create() constructs a new instance of CLASS. Call CLASS::registerCreator<CUSTOM_T>() to substitute a derived class.

Returns
A std::unique_ptr to the newly created instance

References create(), creator(), DtASSERT, and LOG_FATAL.

Referenced by create().

◆ registerCreator()

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
template<class CUSTOM_T>
static void makVre::DtVreUniqueBase< SELF_T, SUPER_T >::registerCreator ( )
inlinestatic

Registers a custom extended class to be created instead of this type.

Template Parameters
CUSTOM_TThe custom class type to register as the creator

References creator().

◆ creator()

template<class SELF_T, class SUPER_T = DtVreUniqueObject>
static std::shared_ptr< DtBaseCreator< SELF_T > > & makVre::DtVreUniqueBase< SELF_T, SUPER_T >::creator ( )
inlinestaticprotected

Gets the reference to the creator object.

Returns
A reference to the shared pointer containing the creator

Referenced by create(), and registerCreator().


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