VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::Status::Base Struct Referenceabstract

Abstract base class for all VLink status event objects. More...

#include <status.h>

Inheritance diagram for vlink::Status::Base:
Collaboration diagram for vlink::Status::Base:

Public Member Functions

virtual Type get_type () const =0
 Returns the concrete status type discriminator.
virtual std::string get_string () const =0
 Returns a human-readable description of this status event.
template<typename T>
std::shared_ptr< T > as () const
 Safely downcasts this status to a concrete type T.

Protected Member Functions

 Base ()
virtual ~Base ()

Friends

VLINK_EXPORT friend std::ostream & operator<< (std::ostream &ostream, const Base &status) noexcept
 Writes the human-readable status description to ostream.

Detailed Description

Abstract base class for all VLink status event objects.

All concrete status types (PublicationMatched, SampleRejected, etc.) derive from Base and are delivered as std::shared_ptr<Status::Base> via status callbacks. Use as<T>() to safely downcast to a specific concrete type.

Inherits std::enable_shared_from_this to support safe shared_ptr construction from within member functions.

Constructor & Destructor Documentation

◆ Base()

vlink::Status::Base::Base ( )
protected
Here is the caller graph for this function:

◆ ~Base()

virtual vlink::Status::Base::~Base ( )
protectedvirtual

Member Function Documentation

◆ as()

template<typename T>
std::shared_ptr< T > vlink::Status::Base::as ( ) const
inlinenodiscard

Safely downcasts this status to a concrete type T.

Details.

Performs a dynamic_pointer_cast. If the status type is kUnknown, throws Exception::RuntimeError.

Template Parameters
TConcrete status struct type (e.g., Status::SubscriptionMatched). Must be derived from Base and not be Status::Unknown.
Returns
shared_ptr<T> to the concrete status.
Exceptions
Exception::RuntimeErrorif the status type is kUnknown.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_string()

virtual std::string vlink::Status::Base::get_string ( ) const
nodiscardpure virtual

Returns a human-readable description of this status event.

Returns
String representation of the status and its field values.

Implemented in vlink::Status::LivelinessChanged, vlink::Status::LivelinessLost, vlink::Status::OfferedDeadlineMissed, vlink::Status::OfferedIncompatibleQos, vlink::Status::PublicationMatched, vlink::Status::RequestedDeadlineMissed, vlink::Status::RequestedIncompatibleQos, vlink::Status::SampleLost, vlink::Status::SampleRejected, vlink::Status::SubscriptionMatched, and vlink::Status::Unknown.

Here is the call graph for this function:

◆ get_type()

virtual Type vlink::Status::Base::get_type ( ) const
nodiscardpure virtual

Returns the concrete status type discriminator.

Returns
One of the Status::Type enum values.

Implemented in vlink::Status::LivelinessChanged, vlink::Status::LivelinessLost, vlink::Status::OfferedDeadlineMissed, vlink::Status::OfferedIncompatibleQos, vlink::Status::PublicationMatched, vlink::Status::RequestedDeadlineMissed, vlink::Status::RequestedIncompatibleQos, vlink::Status::SampleLost, vlink::Status::SampleRejected, vlink::Status::SubscriptionMatched, and vlink::Status::Unknown.

Here is the caller graph for this function:

◆ operator<<

VLINK_EXPORT friend std::ostream & operator<< ( std::ostream & ostream,
const Base & status )
friend

Writes the human-readable status description to ostream.

Parameters
ostreamOutput stream.
statusStatus object to print.
Returns
Reference to ostream.

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