24#ifndef GOBY_MIDDLEWARE_TRANSPORT_SUBSCRIBER_H
25#define GOBY_MIDDLEWARE_TRANSPORT_SUBSCRIBER_H
60 group_func_(group_func),
63 set_link_data_func_(set_link_data_func)
117 return group_func_(data);
135 if (set_link_data_func_)
136 set_link_data_func_(data, header);
145 bool group_in_message_{
true};
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
static constexpr std::uint32_t broadcast_group
Special group number representing the broadcast group (used when no grouping is required for a given ...
std::function< void(const Data &, const intervehicle::protobuf::AckData &)> acked_func_type
std::function< void(const Data &, const intervehicle::protobuf::ExpireData &)> expired_func_type
Class that holds additional metadata and callback functions related to a subscription (and is optiona...
bool group_in_message() const
False if the group isn't stored in the message (see Options::group_in_message)
typename Publisher< intervehicle::protobuf::Subscription >::expired_func_type subscribe_expired_func_type
subscribed_func_type subscribed_func() const
Group group(const Data &data) const
bool has_group_func() const
Subscriber(const goby::middleware::protobuf::TransporterConfig &cfg=goby::middleware::protobuf::TransporterConfig(), group_func_type group_func=group_func_type(), subscribed_func_type subscribed_func=subscribed_func_type(), subscribe_expired_func_type subscribe_expired_func=subscribe_expired_func_type(), set_link_data_func_type set_link_data_func=set_link_data_func_type())
Construct a Subscriber with all available metadata and callbacks.
Subscriber(Options options)
Construct a Subscriber from Options.
Subscriber(const goby::middleware::protobuf::TransporterConfig &cfg, subscribed_func_type subscribed_func, subscribe_expired_func_type subscribe_expired_func=subscribe_expired_func_type(), set_link_data_func_type set_link_data_func=set_link_data_func_type())
Construct a Subscriber but without the group_func callback.
const goby::middleware::protobuf::TransporterConfig & cfg() const
subscribe_expired_func_type subscribe_expired_func() const
void set_link_data(Data &data, const intervehicle::protobuf::Header &header) const
Sets the link data in the message using the set_link_data_func. Only intended to be called by the var...
typename Publisher< intervehicle::protobuf::Subscription >::acked_func_type subscribed_func_type
std::function< void(Data &, const intervehicle::protobuf::Header &)> set_link_data_func_type
std::function< Group(const Data &)> group_func_type
The global namespace for the Goby project.
Everything a Subscriber can be given, named, so that it can be initialized with C++20 designated init...
subscribe_expired_func_type subscribe_expired_func
Called when a subscription request expires without reaching any publishers.
set_link_data_func_type set_link_data_func
Sets link data (e.g. the sender) in received messages.
group_func_type group_func
Returns the group from the message (see the full constructor)
subscribed_func_type subscribed_func
Called when a subscription request reaches a publisher.
goby::middleware::protobuf::TransporterConfig cfg
Additional metadata for this subscribe.