VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtVreSharedObject Class Reference

Detailed Description

Provides self-referencing mechanisms via self(), safe and unsafe shared pointer casts, and inherits type identification and naming from DtVreBase. Use DtVreSharedBase to derive classes that participate in the per-class creator factory.

#include <baseClass.h>

Inheritance diagram for makVre::DtVreSharedObject:
[legend]

Public Types

using Ptr = DtVreSharedObject*
 
using Sptr = std::shared_ptr<DtVreSharedObject>
 
using Wptr = std::weak_ptr<DtVreSharedObject>
 

Public Member Functions

 DtVreSharedObject ()
 
virtual ~DtVreSharedObject ()
 
Sptr self ()
 
- Public Member Functions inherited from makVre::DtVreBase
 DtVreBase ()
 
virtual ~DtVreBase ()=default
 
virtual std::string type () const =0
 
virtual void setName (const std::string &name)
 
virtual std::string name () const
 

Static Public Member Functions

template<class AS_T>
static std::shared_ptr< AS_T > cast (Sptr p)
 
template<class AS_T>
static std::shared_ptr< AS_T > unsafe_cast (Sptr p)
 

Private Attributes

Wptr mySelf
 

Additional Inherited Members

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

Member Typedef Documentation

◆ Ptr

Raw pointer type alias.

◆ Sptr

Shared pointer type alias.

◆ Wptr

Weak pointer type alias.

Constructor & Destructor Documentation

◆ DtVreSharedObject()

makVre::DtVreSharedObject::DtVreSharedObject ( )
inline

Default constructor.

◆ ~DtVreSharedObject()

virtual makVre::DtVreSharedObject::~DtVreSharedObject ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ self()

Sptr makVre::DtVreSharedObject::self ( )
inline

Gets a shared pointer to this object.

If the weak reference to self is expired, creates a new shared pointer; otherwise returns the existing shared pointer.

Returns
A shared pointer to this object

References mySelf.

◆ cast()

template<class AS_T>
static std::shared_ptr< AS_T > makVre::DtVreSharedObject::cast ( Sptr p)
inlinestatic

Safely casts a base shared pointer to a derived type.

Parameters
pThe base shared pointer to cast
Returns
A shared pointer to the derived type, or null if the cast fails

Referenced by makVre::DtCigiPublisherTemplate< CIGI_T, SELF_T, SUPER_T, DATA_CREATOR_T >::verifySharedType().

◆ unsafe_cast()

template<class AS_T>
static std::shared_ptr< AS_T > makVre::DtVreSharedObject::unsafe_cast ( Sptr p)
inlinestatic

Performs an unsafe static cast of a shared pointer.

Use only when you are certain the object is of the target type.

Parameters
pThe base shared pointer to cast
Returns
A shared pointer to the target type

Member Data Documentation

◆ mySelf

Wptr makVre::DtVreSharedObject::mySelf
private

Weak pointer to self for shared_ptr management.

Referenced by self().


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