Data

The classes representing the data which is passed to the Closures

class Hello : public zenohcxx::Owned<::z_owned_hello_t>

A zenoh-allocated hello message returned by a zenoh entity to a scout message sent with scout operation.

Operators

inline operator zenoh::HelloView() const

Get the content of the hello message.

Returns:

the content of the hello message as HelloView

struct HelloView : public zenohcxx::Copyable<::z_hello_t>

The non-owning read-only view to a Hello message returned by a zenoh entity as a reply to a “scout” message.

Methods

const zenoh::Id &get_id() const

Get Id of the entity.

Returns:

Id of the entity

inline zenoh::WhatAmI get_whatami() const

Get the zenoh::WhatAmI of the entity.

Returns:

zenoh::WhatAmI of the entity

inline const zenoh::StrArrayView &get_locators() const

Get the array of locators of the entity.

Returns:

the array of locators of the entity

struct Sample : public zenohcxx::Copyable<::z_sample_t>

A data sample.

A sample is the value associated to a given resource at a given point in time.

Methods

inline const zenoh::KeyExprView &get_keyexpr() const

The resource key of this data sample.

Returns:

KeyExprView object representing the resource key

inline const zenoh::BytesView &get_payload() const

The value of this data sample.

Returns:

BytesView object representing the value

inline const zenoh::Encoding &get_encoding() const

The encoding of the value of this data sample.

Returns:

Encoding object

inline SampleKind get_kind() const

The kind of this data sample (PUT or DELETE)

Returns:

zenoh::SampleKind value

inline const zenoh::Timestamp &get_timestamp() const

The timestamp of this data sample.

Returns:

Timestamp object

inline zenoh::Payload sample_payload_rcinc() const

The payload object of the sample. If it represents a buffer in shared memory it can be resent without actually copying the data.

Returns:

Payload object

Note

zenoh-c only

inline const zenoh::AttachmentView &get_attachment() const

The attachment of this data sample.

Returns:

AttachmentView object

class Query : public zenohcxx::Copyable<::z_query_t>

The query to be answered by a Queryable

Methods

inline zenoh::KeyExprView get_keyexpr() const

Get the key expression of the query.

Returns:

zenoh::KeyExprView value

inline zenoh::BytesView get_parameters() const

Get a query’s value selector

Returns:

zenoh::BytesView value

inline zenoh::Value get_value() const

Get the value of the query.

Returns:

zenoh::Value value

inline zenoh::AttachmentView get_attachment() const

Get the attachment of the query.

Returns:

zenoh::AttachmentView value

bool reply(zenoh::KeyExprView key, const zenoh::BytesView &payload, const zenoh::QueryReplyOptions &options, ErrNo &error) const

Send reply to the query.

Parameters:
  • key – the KeyExprView of the Queryable. NOT the key expression from the Query::get_keyexpr. E.g. queryable registered as “foo/bar” gets query with key expression “foo/*” and replies with key expression “foo/bar” This function can be called multiple times to send multiple replies to the same query. The reply will be considered complete when the Queryable callback returns.

  • payload – the BytesView with payload to be sent

  • options – the QueryReplyOptions to be used for the reply

  • error – the zenoh::ErrNo error code

Returns:

true if the reply was sent successfully

bool reply(zenoh::KeyExprView key, const zenoh::BytesView &payload, const zenoh::QueryReplyOptions &options) const

Send reply to the query.

Parameters:
Returns:

true if the reply was sent successfully

bool reply(zenoh::KeyExprView key, const zenoh::BytesView &payload, ErrNo &error) const

Send reply to the query.

Parameters:
Returns:

true if the reply was sent successfully

bool reply(zenoh::KeyExprView key, const zenoh::BytesView &payload) const

Send reply to the query.

Parameters:
Returns:

true if the reply was sent successfully

class Reply : public zenohcxx::Owned<::z_owned_reply_t>

An owned reply from queryable to Session::get operation.

Methods

inline bool is_ok() const

Check if the reply is OK.

Returns:

true if the reply is OK

inline std::variant<zenoh::Sample, ErrorMessage> get() const

Get the reply value.

Returns:

the Sample value of the reply if reply is OK, otherwise zenoh::ErrorMessage