24#ifndef GOBY_MIDDLEWARE_TRANSPORT_INTERVEHICLE_DRIVER_THREAD_H
25#define GOBY_MIDDLEWARE_TRANSPORT_INTERVEHICLE_DRIVER_THREAD_H
35#include <boost/units/quantity.hpp>
61class ModemTransmission;
67template <
typename Data>
class Publisher;
103 return a.SerializeAsString() == b.SerializeAsString();
108template <
typename Data>
109std::shared_ptr<goby::middleware::protobuf::SerializerTransporterMessage>
113 auto* sbytes =
new std::string(bytes.begin(), bytes.end());
114 auto msg = std::make_shared<goby::middleware::protobuf::SerializerTransporterMessage>();
116 auto* key =
msg->mutable_key();
119 key->set_group(std::string(
group));
120 key->set_group_numeric(
group.numeric());
121 auto now = goby::time::SystemClock::now<goby::time::MicroTime>();
122 key->set_serialize_time_with_units(now);
123 *key->mutable_cfg() = publisher.
cfg();
124 msg->set_allocated_data(sbytes);
131template <
typename ImplementationTag>
134 InterProcessForwarder<InterThreadTransporter,
148 void _buffer_message(
149 const std::shared_ptr<const goby::middleware::protobuf::SerializerTransporterMessage>&
msg);
163 key.group_numeric());
168 return _create_buffer_id(subscription.
dccl_id(), subscription.
group());
183 bool dest_in_subnet =
187 <<
"Dest: " << dest_id
188 <<
" is not in subnet (our id: " << this->
cfg().
modem_id()
191 return dest_in_subnet;
194 void _publish_subscription_report(
const intervehicle::protobuf::Subscription& changed);
197 std::unique_ptr<InterThreadTransporter> interthread_;
198 std::unique_ptr<InterProcessForwarder<InterThreadTransporter, ImplementationTag>> interprocess_;
200 std::multimap<subbuffer_id_type, goby::middleware::protobuf::SerializerTransporterKey>
201 publisher_buffer_cfg_;
203 std::map<modem_id_type, std::multimap<subbuffer_id_type, intervehicle::protobuf::Subscription>>
204 subscriber_buffer_cfg_;
206 std::map<subbuffer_id_type, std::set<modem_id_type>> subbuffers_created_;
209 std::set<modem_id_type> subscription_subbuffers_;
213 using frame_type = int;
214 std::map<frame_type, std::vector<goby::acomms::DynamicBuffer<buffer_data_type>::Value>>
217 std::unique_ptr<goby::acomms::ModemDriverBase> driver_;
220 std::string glog_group_;
Represents a time-dependent priority queue for several groups of messages (multiple DynamicSubBuffers...
std::string subbuffer_id_type
provides an API to the goby-acomms MAC library. MACManager is essentially a std::list<protobuf::Modem...
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
Class that holds additional metadata and callback functions related to a publication (and is optional...
const goby::middleware::protobuf::TransporterConfig & cfg() const
Returns the metadata configuration.
Represents a thread of execution within the Goby middleware, interleaving periodic events (loop()) wi...
const intervehicle::protobuf::PortalConfig::LinkConfig & cfg() const
Provides the modem driver thread used by InterVehiclePortal, templated on ImplementationTag so it use...
ModemDriverThread(const intervehicle::protobuf::PortalConfig::LinkConfig &cfg)
goby::acomms::DynamicBuffer< buffer_data_type >::modem_id_type modem_id_type
goby::acomms::DynamicBuffer< buffer_data_type >::subbuffer_id_type subbuffer_id_type
uint32_t modem_id() const
uint32_t subnet_mask() const
uint64_t serialize_time() const
const std::string & type() const
int32_t marshalling_scheme() const
const std::string & group() const
const ::goby::middleware::protobuf::SerializerTransporterKey & key() const
const std::string & data() const
goby::util::logger::GroupSetter group(std::string n)
bool operator==(const TransporterConfig &a, const TransporterConfig &b)
std::shared_ptr< goby::middleware::protobuf::SerializerTransporterMessage > serialize_publication(const Data &d, const Group &group, const Publisher< Data > &publisher)
bool operator<(const TCPEndPoint &ep_a, const TCPEndPoint &ep_b)
size_t data_size(const SerializerTransporterMessage &msg)
bool operator==(const TCPEndPoint &ep_a, const TCPEndPoint &ep_b)
The global namespace for the Goby project.
extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::PROTOBUF_NAMESPACE_ID::MessageOptions, ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg
util::FlexOstream glog
Access the Goby logger through this object.
Class for parsing and serializing a given marshalling scheme. Must be specialized for a particular sc...
static unsigned id(CharIterator begin, CharIterator end)
std::chrono::time_point< SteadyClock > time_point
std::chrono::microseconds duration
Duration type.