VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
status.h File Reference

DDS-compatible status type hierarchy for VLink publisher and subscriber callbacks. More...

#include <cstdint>
#include <iostream>
#include <memory>
#include <string>
#include <type_traits>
#include "../base/exception.h"
#include "../base/macros.h"
Include dependency graph for status.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

 Abstract base class for all VLink status event objects. More...
 Placeholder status returned when the transport reports an unrecognised event type. More...

Namespaces

Typedefs

using vlink::Status::InstanceHandle = const void*
 Opaque handle type for DDS instance identifiers.
using vlink::Status::BasePtr = std::shared_ptr<Status::Base>
 Type alias for a shared pointer to a base status event.

Enumerations

enum  vlink::Status::Type : uint8_t {
  vlink::Status::kUnknown = 0 , vlink::Status::kPublicationMatched = 1 , vlink::Status::kOfferedDeadlineMissed = 2 , vlink::Status::kOfferedIncompatibleQos = 3 ,
  vlink::Status::kLivelinessLost = 4 , vlink::Status::kSubscriptionMatched = 5 , vlink::Status::kRequestedDeadlineMissed = 6 , vlink::Status::kLivelinessChanged = 7 ,
  vlink::Status::kSampleRejected = 8 , vlink::Status::kRequestedIncompatibleQos = 9 , vlink::Status::kSampleLost = 10
}
 Discriminator for concrete status event types. More...

Functions

VLINK_EXPORT std::ostream & vlink::Status::operator<< (std::ostream &ostream, const BasePtr &status) noexcept
 Writes the human-readable description of status to ostream.

Detailed Description

DDS-compatible status type hierarchy for VLink publisher and subscriber callbacks.

The Status namespace defines an event-driven status reporting model that mirrors the DDS status change notification system. When a transport-level event occurs (e.g., a new subscriber appears, a deadline is missed), the middleware creates a concrete Status::Base subclass and delivers it to the registered status callback.

Status types are divided into two groups:

Writer-side (DataWriter / Publisher / Server / Setter):

Type Triggered when
kPublicationMatched A matching subscriber appeared or disappeared
kOfferedDeadlineMissed Writer failed to publish within its declared deadline
kOfferedIncompatibleQos A subscriber with incompatible QoS was discovered
kLivelinessLost Writer failed to assert liveliness within its duration

Reader-side (DataReader / Subscriber / Client / Getter):

Type Triggered when
kSubscriptionMatched A matching publisher appeared or disappeared
kRequestedDeadlineMissed Reader did not receive data within its declared deadline
kLivelinessChanged A writer's liveliness status changed
kSampleRejected An incoming sample was rejected (resource limit hit)
kRequestedIncompatibleQos A publisher with incompatible QoS was discovered
kSampleLost A sample was lost before it could be delivered

Concrete status structs (counters, handles, etc.) are defined in status_detail.h.

Usage
auto sub = vlink::Subscriber<MyMsg>::create("dds://my_topic");
sub->register_status_callback([](vlink::Status::BasePtr status) {
if (status->get_type() == vlink::Status::kSubscriptionMatched) {
auto matched = status->as<vlink::Status::SubscriptionMatched>();
VLOG_I("Matched publishers: ", matched->current_count);
}
});
#define VLOG_I(...)
Definition logger.h:850