|
Goby3 3.3.0
2025.07.10
|
Base class for implementing transporters (both portal and forwarder) for the interprocess layer. More...
#include <goby/middleware/transport/interprocess.h>
Public Member Functions | |
| InterProcessTransporterBase (InnerTransporter &inner) | |
| InterProcessTransporterBase () | |
| virtual | ~InterProcessTransporterBase () |
| template<typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| void | publish_dynamic (const Data &data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >()) |
| Publish a message using a run-time defined DynamicGroup (const reference variant). Where possible, prefer the static variant in StaticTransporterInterface::publish() | |
| template<typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| void | publish_dynamic (std::shared_ptr< const Data > data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >()) |
| Publish a message using a run-time defined DynamicGroup (shared pointer to const data variant). Where possible, prefer the static variant in StaticTransporterInterface::publish() | |
| template<typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| void | publish_dynamic (std::shared_ptr< Data > data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >()) |
| Publish a message using a run-time defined DynamicGroup (shared pointer to mutable data variant). Where possible, prefer the static variant in StaticTransporterInterface::publish() | |
| void | publish_serialized (std::string type_name, int scheme, const std::vector< char > &bytes, const goby::middleware::Group &group) |
| Publish a message that has already been serialized for the given scheme. | |
| template<typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| void | subscribe_dynamic (std::function< void(const Data &)> f, const Group &group, const Subscriber< Data > &subscriber=Subscriber< Data >()) |
| Subscribe to a specific run-time defined group and data type (const reference variant). Where possible, prefer the static variant in StaticTransporterInterface::subscribe() | |
| template<typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| void | subscribe_dynamic (std::function< void(std::shared_ptr< const Data >)> f, const Group &group, const Subscriber< Data > &subscriber=Subscriber< Data >()) |
| Subscribe to a specific run-time defined group and data type (shared pointer variant). Where possible, prefer the static variant in StaticTransporterInterface::subscribe() | |
| template<typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| void | unsubscribe_dynamic (const Group &group, const Subscriber< Data > &subscriber=Subscriber< Data >()) |
| Unsubscribe to a specific run-time defined group and data type. Where possible, prefer the static variant in StaticTransporterInterface::unsubscribe() | |
| void | unsubscribe_all () |
| Unsubscribe from all current subscriptions. | |
| std::shared_ptr< SerializationSubscriptionRegex > | subscribe_regex (std::function< void(const std::vector< unsigned char > &, int scheme, const std::string &type, const Group &group)> f, const std::set< int > &schemes, const std::string &type_regex=".*", const std::string &group_regex=".*") |
| Subscribe to multiple groups and/or types at once using regular expressions. | |
| template<typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| std::shared_ptr< SerializationSubscriptionRegex > | subscribe_type_regex (std::function< void(std::shared_ptr< const Data >, const std::string &type)> f, const Group &group, const std::string &type_regex=".*") |
| Subscribe to a number of types within a given group and scheme using a regular expression. | |
| template<const Group & group, typename Data , int scheme = InterProcessTransporterBase::scheme<Data>()> | |
| void | subscribe_type_regex (std::function< void(std::shared_ptr< const Data >, const std::string &type)> f, const std::string &type_regex=".*") |
| Subscribe to a number of types within a given group and scheme using a regular expression. | |
| template<const Group & group> | |
| void | check_validity () |
| Check validity of the Group for interthread use (at compile time) | |
| void | check_validity_runtime (const Group &group) |
| Check validity of the Group for interthread use (for DynamicGroup at run time) | |
Public Member Functions inherited from goby::middleware::StaticTransporterInterface< InterProcessTransporterBase< Derived, InnerTransporter >, InnerTransporter > | |
| void | publish (const Data &data, const Publisher< Data > &publisher=Publisher< Data >()) |
| Publish a message (const reference variant) | |
| void | publish (std::shared_ptr< const Data > data, const Publisher< Data > &publisher=Publisher< Data >()) |
| Publish a message (shared pointer to const data variant) | |
| void | publish (std::shared_ptr< Data > data, const Publisher< Data > &publisher=Publisher< Data >()) |
| Publish a message (shared pointer to mutable data variant) | |
| 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) | |
| 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) | |
| 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. | |
| 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. | |
Public Member Functions inherited from goby::middleware::InnerTransporterInterface< Transporter, InnerTransporter, Enable > | |
| InnerTransporter & | inner () |
| auto | innermost () |
Public Member Functions inherited from goby::middleware::PollerInterface | |
| template<class Clock = std::chrono::system_clock, class Duration = typename Clock::duration> | |
| int | poll (const std::chrono::time_point< Clock, Duration > &timeout=std::chrono::time_point< Clock, Duration >::max()) |
| poll for data. Blocks until a data event occurs or a timeout when a particular time has been reached | |
| template<class Clock = std::chrono::system_clock, class Duration = typename Clock::duration> | |
| int | poll (Duration wait_for) |
| poll for data. Blocks until a data event occurs or a certain duration of time elapses (timeout) | |
| std::shared_ptr< std::timed_mutex > | poll_mutex () |
| access the mutex used for poll synchronization | |
| std::shared_ptr< std::condition_variable_any > | cv () |
| access the condition variable used for poll synchronization | |
Static Public Member Functions | |
| template<typename Data > | |
| static constexpr int | scheme () |
| returns the marshalling scheme id for a given data type on this layer | |
Static Protected Attributes | |
| static constexpr Group | to_portal_group_ {"goby::middleware::interprocess::to_portal"} |
| static constexpr Group | regex_group_ {"goby::middleware::interprocess::regex"} |
| static constexpr Group | from_portal_group_ {"goby::middleware::interprocess::from_portal"} |
Additional Inherited Members | |
Public Types inherited from goby::middleware::InnerTransporterInterface< Transporter, InnerTransporter, Enable > | |
| using | InnerTransporterType = InnerTransporter |
| the InnerTransporter type (accessible for other uses) | |
Protected Member Functions inherited from goby::middleware::StaticTransporterInterface< InterProcessTransporterBase< Derived, InnerTransporter >, InnerTransporter > | |
| StaticTransporterInterface (InnerTransporter &inner) | |
| StaticTransporterInterface () | |
Protected Member Functions inherited from goby::middleware::Poller< InterProcessTransporterBase< Derived, InnerTransporter > > | |
| Poller (PollerInterface *inner_poller=nullptr) | |
| Construct this Poller with a pointer to the inner Poller (unless this is the innermost Poller) | |
| PollerInterface * | inner_poller () |
Protected Member Functions inherited from goby::middleware::PollerInterface | |
| PollerInterface (std::shared_ptr< std::timed_mutex > poll_mutex, std::shared_ptr< std::condition_variable_any > cv) | |
Base class for implementing transporters (both portal and forwarder) for the interprocess layer.
| Derived | derived class (curiously recurring template pattern) |
| InnerTransporter | inner layer transporter type |
Definition at line 51 of file interprocess.h.
|
inline |
Definition at line 63 of file interprocess.h.
|
inline |
Definition at line 67 of file interprocess.h.
|
inlinevirtual |
Definition at line 69 of file interprocess.h.
|
inline |
Check validity of the Group for interthread use (at compile time)
This layer requires a valid string group
Definition at line 255 of file interprocess.h.
|
inline |
Check validity of the Group for interthread use (for DynamicGroup at run time)
Definition at line 263 of file interprocess.h.
|
inline |
Publish a message using a run-time defined DynamicGroup (const reference variant). Where possible, prefer the static variant in StaticTransporterInterface::publish()
| 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. |
| data | Message to publish |
| group | group to publish this message to (typically a DynamicGroup) |
| publisher | Optional metadata that controls the publication or sets callbacks to monitor the result. Typically unnecessary for interprocess and inner layers. |
Definition at line 92 of file interprocess.h.
|
inline |
Publish a message using a run-time defined DynamicGroup (shared pointer to const data variant). Where possible, prefer the static variant in StaticTransporterInterface::publish()
| 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. |
| data | Message to publish |
| group | group to publish this message to (typically a DynamicGroup) |
| publisher | Optional metadata that controls the publication or sets callbacks to monitor the result. Typically unnecessary for interprocess and inner layers. |
Definition at line 108 of file interprocess.h.
|
inline |
Publish a message using a run-time defined DynamicGroup (shared pointer to mutable data variant). Where possible, prefer the static variant in StaticTransporterInterface::publish()
| 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. |
| data | Message to publish |
| group | group to publish this message to (typically a DynamicGroup) |
| publisher | Optional metadata that controls the publication or sets callbacks to monitor the result. Typically unnecessary for interprocess and inner layers. |
Definition at line 127 of file interprocess.h.
|
inline |
Publish a message that has already been serialized for the given scheme.
Definition at line 134 of file interprocess.h.
|
inlinestaticconstexpr |
returns the marshalling scheme id for a given data type on this layer
| Data | data type |
Definition at line 75 of file interprocess.h.
|
inline |
Subscribe to a specific run-time defined group and data type (const reference variant). Where possible, prefer the static variant in StaticTransporterInterface::subscribe()
| Data | data type to subscribe to. |
| scheme | Marshalling scheme id (typically MarshallingScheme::MarshallingSchemeEnum). Can usually be inferred from the Data type. |
| f | Callback function or lambda that is called upon receipt of the subscribed data |
| group | group to subscribe to (typically a DynamicGroup) |
| subscriber | Optional metadata that controls the subscription or sets callbacks to monitor the subscription result. Typically unnecessary for interprocess and inner layers. |
Definition at line 149 of file interprocess.h.
|
inline |
Subscribe to a specific run-time defined group and data type (shared pointer variant). Where possible, prefer the static variant in StaticTransporterInterface::subscribe()
| Data | data type to subscribe to. |
| scheme | Marshalling scheme id (typically MarshallingScheme::MarshallingSchemeEnum). Can usually be inferred from the Data type. |
| f | Callback function or lambda that is called upon receipt of the subscribed data |
| group | group to subscribe to (typically a DynamicGroup) |
| subscriber | Optional metadata that controls the subscription or sets callbacks to monitor the subscription result. Typically unnecessary for interprocess and inner layers. |
Definition at line 165 of file interprocess.h.
|
inline |
Subscribe to multiple groups and/or types at once using regular expressions.
| f | Callback function or lambda that is called upon receipt of any messages matching the group regex and type regex |
| schemes | Set of marshalling schemes to match |
| type_regex | C++ regex to match type names (within one or more of the given schemes) |
| group_regex | C++ regex to match group names |
Definition at line 196 of file interprocess.h.
|
inline |
Subscribe to a number of types within a given group and scheme using a regular expression.
The marshalling scheme must implement SerializerParserHelper::parse() to use this method.
| 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. |
| group | group to subscribe to (typically a DynamicGroup) |
| f | Callback function or lambda that is called upon receipt of any messages matching the given group and type regex |
| type_regex | C++ regex to match type names (within the given scheme) |
Definition at line 215 of file interprocess.h.
|
inline |
Subscribe to a number of types within a given group and scheme using a regular expression.
The marshalling scheme must implement SerializerParserHelper::parse() to use this method.
| 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. |
| f | Callback function or lambda that is called upon receipt of any messages matching the given group and type regex |
| type_regex | C++ regex to match type names (within the given scheme) |
Definition at line 245 of file interprocess.h.
|
inline |
Unsubscribe from all current subscriptions.
Definition at line 186 of file interprocess.h.
|
inline |
Unsubscribe to a specific run-time defined group and data type. Where possible, prefer the static variant in StaticTransporterInterface::unsubscribe()
| Data | data type to unsubscribe from. |
| scheme | Marshalling scheme id (typically MarshallingScheme::MarshallingSchemeEnum). Can usually be inferred from the Data type. |
| group | group to unsubscribe from (typically a DynamicGroup) |
Definition at line 178 of file interprocess.h.
|
staticconstexprprotected |
Definition at line 272 of file interprocess.h.
|
staticconstexprprotected |
Definition at line 271 of file interprocess.h.
|
staticconstexprprotected |
Definition at line 270 of file interprocess.h.