dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
SharedEntity Struct Reference

A base abstract "shared entity" class. Has some helpers for dynamic polymorphism. More...

#include <SharedEntity.hpp>

Inheritance diagram for SharedEntity:

Public Types

using Ptr = std::shared_ptr<SharedEntity>
 The alias to a type of shared pointer to the SharedEntity object.

Public Member Functions

template<typename T>
bool is () const noexcept
 Checks that the object is of type T: its dynamic type is T or derived from T.
template<typename T>
std::shared_ptr< T > sharedAs () noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.
template<typename T>
std::shared_ptr< T > sharedAs () const noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.
virtual std::string toString () const
 Returns a string representation of the current object.
Public Member Functions inherited from Entity
virtual ~Entity () noexcept
 The default virtual d-tor.

Detailed Description

A base abstract "shared entity" class. Has some helpers for dynamic polymorphism.

Member Function Documentation

◆ is()

template<typename T>
bool SharedEntity::is ( ) const
inlinenoexcept

Checks that the object is of type T: its dynamic type is T or derived from T.

Template Parameters
TThe type to check
Returns
true if the object is of type T (the pointer to it can be converted to T*).

◆ sharedAs() [1/2]

template<typename T>
std::shared_ptr< T > SharedEntity::sharedAs ( ) const
inlinenoexcept

Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.

Template Parameters
TThe type to convert to a pointer to
Returns
a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.

◆ sharedAs() [2/2]

template<typename T>
std::shared_ptr< T > SharedEntity::sharedAs ( )
inlinenoexcept

Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.

Template Parameters
TThe type to convert to a pointer to
Returns
a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.

◆ toString()