Defines the common interface for publishing and subscribing data using static (constexpr) groups on Goby transporters.
More...
|
| template<const Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>()> |
| void | publish (const Data &data, const Publisher< Data > &publisher=Publisher< Data >()) |
| | Publish a message (const reference variant)
|
| |
| template<const Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>()> |
| void | publish (std::shared_ptr< const Data > data, const Publisher< Data > &publisher=Publisher< Data >()) |
| | Publish a message (shared pointer to const data variant)
|
| |
| template<const Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>()> |
| void | publish (std::shared_ptr< Data > data, const Publisher< Data > &publisher=Publisher< Data >()) |
| | Publish a message (shared pointer to mutable data variant)
|
| |
| template<const Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>(), Necessity necessity = Necessity::OPTIONAL> |
| void | subscribe (std::function< void(const Data &)> f, const Subscriber< Data > &subscriber=Subscriber< Data >()) |
| | Subscribe to a specific group and data type (const reference variant)
|
| |
| template<const Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>(), Necessity necessity = Necessity::OPTIONAL> |
| void | subscribe (std::function< void(std::shared_ptr< const Data >)> f, const Subscriber< Data > &subscriber=Subscriber< Data >()) |
| | Subscribe to a specific group and data type (shared pointer variant)
|
| |
| template<const Group & group, Necessity necessity = Necessity::OPTIONAL, typename Func > |
| void | subscribe (Func f) |
| | Simplified version of subscribe() that can deduce Data from the first argument of the function (lambda, function pointer, etc.) passed to it.
|
| |
| template<const Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>()> |
| void | unsubscribe (const Subscriber< Data > &subscriber=Subscriber< Data >()) |
| | Unsubscribe to a specific group and data type.
|
| |
| void | unsubscribe_all () |
| | Unsubscribe to all messages that this transporter has subscribed to.
|
| |
| InnerTransporter & | inner () |
| |
| auto | innermost () |
| |
template<typename Transporter, typename InnerTransporter>
class goby::middleware::StaticTransporterInterface< Transporter, InnerTransporter >
Defines the common interface for publishing and subscribing data using static (constexpr) groups on Goby transporters.
- Template Parameters
-
| Transporter | The transporter for which this interface applies (derived class) |
| InnerTransporter | The inner layer transporter type (or NullTransporter if this is the innermost layer) |
Definition at line 203 of file interface.h.
template<typename Transporter , typename InnerTransporter >
template<const
Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>()>
Publish a message (shared pointer to const data variant)
- Template Parameters
-
| group | group to publish this message to (reference to constexpr Group) |
| Data | data type to publish. Can usually be inferred from the data parameter. |
| scheme | Marshalling scheme id (typically MarshallingScheme::MarshallingSchemeEnum). Can usually be inferred from the Data type. |
- Parameters
-
| data | Shared pointer to message to publish |
| publisher | Optional metadata that controls the publication or sets callbacks to monitor the result. Typically unnecessary for interprocess and inner layers. |
The shared pointer variants will likely be more efficient than the const reference variant when using interthread comms as no copy of the data is necessary. Note: need both const and non-const shared_ptr overload to ensure that the const& overload isn't preferred to these.
Definition at line 234 of file interface.h.
template<typename Transporter , typename InnerTransporter >
template<const
Group & group, typename Data , int scheme = transporter_scheme<Data, Transporter>()>
Publish a message (shared pointer to mutable data variant)
- Template Parameters
-
| group | group to publish this message to (reference to constexpr Group) |
| Data | data type to publish. Can usually be inferred from the data parameter. |
| scheme | Marshalling scheme id (typically MarshallingScheme::MarshallingSchemeEnum). Can usually be inferred from the Data type. |
- Parameters
-
| data | Shared pointer to message to publish |
| publisher | Optional metadata that controls the publication or sets callbacks to monitor the result. Typically unnecessary for interprocess and inner layers. |
The shared pointer variants will likely be more efficient than the const reference variant when using interthread comms as no copy of the data is necessary. Note: need both const and non-const shared_ptr overload to ensure that the const& overload isn't preferred to these.
Definition at line 254 of file interface.h.
template<typename Transporter , typename InnerTransporter >
template<const
Group & group,
Necessity necessity = Necessity::OPTIONAL, typename Func >
Simplified version of subscribe() that can deduce Data from the first argument of the function (lambda, function pointer, etc.) passed to it.
- Template Parameters
-
| group | group to subscribe to (reference to constexpr Group) |
| necessity | How important is this subscription (is it required?) |
| Func | Function of a form accepted by other overloads of subscribe() |
- Parameters
-
| f | Callback function or lambda that is called upon receipt of the subscribed data |
This removes the need to explicitly specify Data for simple calls to subscribe() that do not need to manually specify the 'scheme' or provide a Subscriber.
Definition at line 307 of file interface.h.