Skip to content

Commit

Permalink
Merge pull request #99 from DenisBiryukov91/feature/priority-in-sample
Browse files Browse the repository at this point in the history
Add support for qos settings in sample
  • Loading branch information
milyin authored Feb 23, 2024
2 parents 5d7aa42 + f882dca commit 235745d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions include/zenohcxx/api.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ typedef ::z_congestion_control_t CongestionControl;
/// - **Z_PRIORITY_BACKGROUND**: Priority for "background traffic" messages.
typedef ::z_priority_t Priority;

/// QoS settings of zenoh message.
///
struct QoS : public Copyable<::z_qos_t> {
using Copyable::Copyable;
/// @brief Returns message priority.
Priority get_priority() const { return ::z_qos_get_priority(*this); }
/// @brief Returns message congestion control.
CongestionControl get_congestion_control() const { return ::z_qos_get_congestion_control(*this); }
/// @brief Returns message express flag. If set to true, the message is not batched to reduce the latency.
bool get_express() const { return ::z_qos_get_express(*this); }
/// @brief Crates default QoS settings.
QoS() : Copyable(z_qos_default()) {};
};

/// Query target values.
///
/// see also: ``zenoh::query_target_default``
Expand Down Expand Up @@ -875,6 +889,10 @@ struct Sample : public Copyable<::z_sample_t> {
/// @return ``zenoh::SampleKind`` value
SampleKind get_kind() const { return kind; }

/// @brief QoS settings this sample was sent with
/// @return ``zenoh::QoS`` struct
QoS get_qos() const { return qos; }

/// @brief The timestamp of this data sample
/// @return ``Timestamp`` object
const z::Timestamp& get_timestamp() const { return static_cast<const z::Timestamp&>(timestamp); }
Expand Down

0 comments on commit 235745d

Please sign in to comment.