VLink  2.0.0
A high-performance communication middleware
vlink::Status::Base Struct Referenceabstract

Polymorphic base for every concrete status event delivered to a callback. 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 event type discriminator. More...
 
virtual std::string get_string () const =0
 Returns the event name without numeric fields. More...
 
template<typename T >
std::shared_ptr< T > as () const
 Safely narrows this event to a concrete Status subclass. More...
 

Protected Member Functions

 Base ()
 
virtual ~Base ()
 

Friends

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

Detailed Description

Polymorphic base for every concrete status event delivered to a callback.

Concrete subclasses live in status_detail.h and carry the counter, handle, and reason fields specific to each event. Subscribers downcast through as<T>(), which throws Exception::RuntimeError for kUnknown events. std::enable_shared_from_this allows implementations to safely produce a shared_ptr to themselves from inside member calls.

Constructor & Destructor Documentation

◆ Base()

vlink::Status::Base::Base ( )
protected

◆ ~Base()

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

Member Function Documentation

◆ as()

template<typename T >
std::shared_ptr< T > vlink::Status::Base::as
inline

Safely narrows this event to a concrete Status subclass.

Details.

Template Parameters
TConcrete event struct derived from Base; must not be Status::Unknown.
Returns
shared_ptr<T> pointing at this event.
Exceptions
Exception::RuntimeErrorwhen get_type() is kUnknown.
Here is the call graph for this function:

◆ get_string()

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

◆ get_type()

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

Returns the concrete event type discriminator.

Returns
One of the Status::Type enumerators.

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

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

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

Writes the human-readable description of status to ostream.

Parameters
ostreamOutput stream.
statusEvent to print.
Returns
Reference to ostream.

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