VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtSpObject Class Referenceabstract

Detailed Description

This class provides a foundation for objects that need to be managed by shared pointers. It includes self-referencing mechanisms, type information, and naming functionality.

#include <baseClass.h>

Inheritance diagram for makVre::DtSpObject:
[legend]

Public Types

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

Public Member Functions

 DtSpObject ()
 
virtual ~DtSpObject ()
 
Sptr self ()
 
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)
 

Protected Attributes

std::string myName
 

Private Attributes

Wptr mySelf
 

Member Typedef Documentation

◆ Ptr

Raw pointer type alias.

◆ Sptr

using makVre::DtSpObject::Sptr = std::shared_ptr<DtSpObject>

Shared pointer type alias.

◆ Wptr

using makVre::DtSpObject::Wptr = std::weak_ptr<DtSpObject>

Weak pointer type alias.

Constructor & Destructor Documentation

◆ DtSpObject()

makVre::DtSpObject::DtSpObject ( )
inline

Default constructor.

◆ ~DtSpObject()

virtual makVre::DtSpObject::~DtSpObject ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ self()

Sptr makVre::DtSpObject::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::DtSpObject::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::DtSpObject::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

◆ type()

virtual std::string makVre::DtSpObject::type ( ) const
pure virtual

Gets the type of this object.

Returns
A string representing the type of this object

Implemented in makVre::DtSpSubClass< SELF_T, SUPER_T >, makVre::DtSpSubClass< DtCigiDataBase >, makVre::DtSpSubClass< DtCigiDataTemplate< CIGI_T, FRIEND_T >, DtCigiDataBase >, makVre::DtSpSubClass< DtCigiEntityPublisherBase, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiEntityUnpublisher, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiEntityUnpublisherV4, DtCigiEntityUnpublisher >, makVre::DtSpSubClass< DtCigiFxPositionPublisher, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiFxPositionPublisherV4, DtCigiFxPositionPublisher >, makVre::DtSpSubClass< DtCigiFxPublisher, DtCigiEntityPublisherBase >, makVre::DtSpSubClass< DtCigiFxPublisherV4, DtCigiFxPublisher >, makVre::DtSpSubClass< DtCigiFxVelocityPublisher, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiFxVelocityPublisherV4, DtCigiFxVelocityPublisher >, makVre::DtSpSubClass< DtCigiHost >, makVre::DtSpSubClass< DtCigiIgControlPublisher, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiIgControlPublisherV4, DtCigiIgControlPublisher >, makVre::DtSpSubClass< DtCigiListenerBase, DtCigiObjectBase >, makVre::DtSpSubClass< DtCigiObjectBase >, makVre::DtSpSubClass< DtCigiPublisherBase, DtCigiObjectBase >, makVre::DtSpSubClass< DtCigiPublisherBase, DtTreeClass< DtCigiPublisherBase, DtCigiObjectBase > >, makVre::DtSpSubClass< DtCigiPublisherGroup, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiSession >, makVre::DtSpSubClass< DtCigiSimEntityArtPartPublisher, DtCigiSimEntityComponentPublisherBase >, makVre::DtSpSubClass< DtCigiSimEntityArtPartPublisherV4, DtCigiSimEntityArtPartPublisher >, makVre::DtSpSubClass< DtCigiSimEntityComponentPublisherBase, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiSimEntityPositionPublisher, DtCigiSimEntityComponentPublisherBase >, makVre::DtSpSubClass< DtCigiSimEntityPositionPublisherV4, DtCigiSimEntityPositionPublisher >, makVre::DtSpSubClass< DtCigiSimEntityPublisher, DtCigiSimObjectPublisherBase >, makVre::DtSpSubClass< DtCigiSimEntityPublisherV4, DtCigiSimEntityPublisher >, makVre::DtSpSubClass< DtCigiSimEntityVelocityPublisher, DtCigiSimEntityComponentPublisherBase >, makVre::DtSpSubClass< DtCigiSimEntityVelocityPublisherV4, DtCigiSimEntityVelocityPublisher >, makVre::DtSpSubClass< DtCigiSimObjectPublisherBase, DtCigiEntityPublisherBase >, makVre::DtSpSubClass< DtCigiStartOfFrameListener, DtCigiListenerBase >, makVre::DtSpSubClass< DtCigiStartOfFrameListenerV4, DtCigiStartOfFrameListener >, makVre::DtSpSubClass< DtCigiTimePublisher, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiTimePublisherV4, DtCigiTimePublisher >, makVre::DtSpSubClass< DtCigiViewControlPublisher, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiViewControlPublisherV4, DtCigiViewControlPublisher >, makVre::DtSpSubClass< DtCigiViewDefinitionPublisher, DtCigiPublisherBase >, makVre::DtSpSubClass< DtCigiViewDefinitionPublisherV4, DtCigiViewDefinitionPublisher >, makVre::DtSpSubClass< SELF_T, DtCigiListenerBase >, makVre::DtSpSubClass< SELF_T, DtCigiPublisherBase >, and makVre::DtSpSubClass< SELF_T, DtSpObject >.

◆ setName()

virtual void makVre::DtSpObject::setName ( const std::string & name)
inlinevirtual

Sets the name of this object.

Parameters
nameThe new name for the object

References myName, and name().

◆ name()

virtual std::string makVre::DtSpObject::name ( ) const
inlinevirtual

Member Data Documentation

◆ myName

std::string makVre::DtSpObject::myName
protected

The name of this object.

Referenced by name(), and setName().

◆ mySelf

Wptr makVre::DtSpObject::mySelf
private

Weak pointer to self for shared_ptr management.

Referenced by self().


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