use super::{
instance::{HANDLE_NIL, InstanceHandle},
qos_policy::{INVALID_QOS_POLICY_ID, QosPolicyId},
};
use alloc::vec::Vec;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum StatusKind {
InconsistentTopic,
OfferedDeadlineMissed,
RequestedDeadlineMissed,
OfferedIncompatibleQos,
RequestedIncompatibleQos,
SampleLost,
SampleRejected,
DataOnReaders,
DataAvailable,
LivelinessLost,
LivelinessChanged,
PublicationMatched,
SubscriptionMatched,
}
pub const NO_STATUS: &[StatusKind] = &[];
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct InconsistentTopicStatus {
pub total_count: i32,
pub total_count_change: i32,
}
impl InconsistentTopicStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
}
}
}
impl Default for InconsistentTopicStatus {
fn default() -> Self {
Self::const_default()
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct SampleLostStatus {
pub total_count: i32,
pub total_count_change: i32,
}
impl SampleLostStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
}
}
}
impl Default for SampleLostStatus {
fn default() -> Self {
Self::const_default()
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum SampleRejectedStatusKind {
NotRejected,
RejectedByInstancesLimit,
RejectedBySamplesLimit,
RejectedBySamplesPerInstanceLimit,
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct SampleRejectedStatus {
pub total_count: i32,
pub total_count_change: i32,
pub last_reason: SampleRejectedStatusKind,
pub last_instance_handle: InstanceHandle,
}
impl SampleRejectedStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
last_reason: SampleRejectedStatusKind::NotRejected,
last_instance_handle: HANDLE_NIL,
}
}
}
impl Default for SampleRejectedStatus {
fn default() -> Self {
Self::const_default()
}
}
#[derive(Clone, PartialEq, Eq, Debug, Default)]
pub struct LivelinessLostStatus {
pub total_count: i32,
pub total_count_change: i32,
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct LivelinessChangedStatus {
pub alive_count: i32,
pub not_alive_count: i32,
pub alive_count_change: i32,
pub not_alive_count_change: i32,
pub last_publication_handle: InstanceHandle,
}
impl LivelinessChangedStatus {
pub const fn const_default() -> Self {
Self {
alive_count: 0,
not_alive_count: 0,
alive_count_change: 0,
not_alive_count_change: 0,
last_publication_handle: HANDLE_NIL,
}
}
}
impl Default for LivelinessChangedStatus {
fn default() -> Self {
Self::const_default()
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct OfferedDeadlineMissedStatus {
pub total_count: i32,
pub total_count_change: i32,
pub last_instance_handle: InstanceHandle,
}
impl OfferedDeadlineMissedStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
last_instance_handle: HANDLE_NIL,
}
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct RequestedDeadlineMissedStatus {
pub total_count: i32,
pub total_count_change: i32,
pub last_instance_handle: InstanceHandle,
}
impl RequestedDeadlineMissedStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
last_instance_handle: HANDLE_NIL,
}
}
}
impl Default for RequestedDeadlineMissedStatus {
fn default() -> Self {
Self::const_default()
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct QosPolicyCount {
pub policy_id: QosPolicyId,
pub count: i32,
}
#[derive(Clone, PartialEq, Eq, Debug, Default)]
pub struct OfferedIncompatibleQosStatus {
pub total_count: i32,
pub total_count_change: i32,
pub last_policy_id: QosPolicyId,
pub policies: Vec<QosPolicyCount>,
}
impl OfferedIncompatibleQosStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
last_policy_id: INVALID_QOS_POLICY_ID,
policies: Vec::new(),
}
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct RequestedIncompatibleQosStatus {
pub total_count: i32,
pub total_count_change: i32,
pub last_policy_id: QosPolicyId,
pub policies: Vec<QosPolicyCount>,
}
impl RequestedIncompatibleQosStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
last_policy_id: INVALID_QOS_POLICY_ID,
policies: Vec::new(),
}
}
}
impl Default for RequestedIncompatibleQosStatus {
fn default() -> Self {
Self::const_default()
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct PublicationMatchedStatus {
pub total_count: i32,
pub total_count_change: i32,
pub last_subscription_handle: InstanceHandle,
pub current_count: i32,
pub current_count_change: i32,
}
impl PublicationMatchedStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
last_subscription_handle: HANDLE_NIL,
current_count: 0,
current_count_change: 0,
}
}
}
impl Default for PublicationMatchedStatus {
fn default() -> Self {
Self::const_default()
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct SubscriptionMatchedStatus {
pub total_count: i32,
pub total_count_change: i32,
pub last_publication_handle: InstanceHandle,
pub current_count: i32,
pub current_count_change: i32,
}
impl SubscriptionMatchedStatus {
pub const fn const_default() -> Self {
Self {
total_count: 0,
total_count_change: 0,
last_publication_handle: HANDLE_NIL,
current_count: 0,
current_count_change: 0,
}
}
}
impl Default for SubscriptionMatchedStatus {
fn default() -> Self {
Self::const_default()
}
}