Node.hh
Go to the documentation of this file.
158 };
598 }
752 }
T bind(T... args)
A class for customizing the publication options for a topic advertised. E.g.: Set the rate of message...
Definition: AdvertiseOptions.hh:138
A class for customizing the publication options for a service advertised.
Definition: AdvertiseOptions.hh:226
A class that provides information about the message received.
Definition: MessageInfo.hh:34
This class stores all the information about a message publisher.
Definition: Publisher.hh:199
A class for customizing the behavior of the Node. E.g.: Set a custom namespace or a partition name.
Definition: NodeOptions.hh:36
A class that is used to store information about an advertised publisher. An instance of this class is...
Definition: Node.hh:85
bool Valid() const
Return true if valid information, such as a non-empty topic name, is present.
Publisher(const MessagePublisher &_publisher)
Constructor.
bool PublishRaw(const std::string &_msgData, const std::string &_msgType)
Publish a raw pre-serialized message.
bool HasConnections() const
Return true if this publisher has subscribers.
bool Publish(const ProtoMsg &_msg)
Publish a message. This function will copy the message when publishing to interprocess subscribers....
A class that allows a client to communicate with other peers. There are two main communication modes:...
Definition: Node.hh:65
Node::Publisher Advertise(const std::string &_topic, const std::string &_msgTypeName, const AdvertiseMessageOptions &_options=AdvertiseMessageOptions())
Advertise a new topic. If a topic is currently advertised, you cannot advertise it a second time (reg...
Node::Publisher Advertise(const std::string &_topic, const AdvertiseMessageOptions &_options=AdvertiseMessageOptions())
Advertise a new topic. If a topic is currently advertised, you cannot advertise it a second time (reg...
Definition: Node.hh:176
bool Subscribe(const std::string &_topic, void(ClassT::*_cb)(const MessageT &_msg), ClassT *_obj, const SubscribeOptions &_opts=SubscribeOptions())
Subscribe to a topic registering a callback. Note that this callback does not include any message inf...
Definition: Node.hh:263
class ignition::transport::Node::Publisher Advertise[in]
std::vector< std::string > AdvertisedTopics() const
Get the list of topics advertised by this node.
bool Subscribe(const std::string &_topic, std::function< void(const MessageT &_msg)> &_cb, const SubscribeOptions &_opts=SubscribeOptions())
Subscribe to a topic registering a callback. Note that this callback does not include any message inf...
Definition: Node.hh:237
bool Subscribe(const std::string &_topic, void(ClassT::*_cb)(const MessageT &_msg, const MessageInfo &_info), ClassT *_obj, const SubscribeOptions &_opts=SubscribeOptions())
Subscribe to a topic registering a callback. Note that this callback includes message information....
Definition: Node.hh:361
std::vector< std::string > SubscribedTopics() const
Get the list of topics subscribed by this node. Note that we might be interested in one topic but we ...
bool Subscribe(const std::string &_topic, void(*_cb)(const MessageT &_msg, const MessageInfo &_info), const SubscribeOptions &_opts=SubscribeOptions())
Subscribe to a topic registering a callback. Note that this callback includes message information....
Definition: Node.hh:291
bool Unsubscribe(const std::string &_topic)
Unsubscribe from a topic.
bool Subscribe(const std::string &_topic, void(*_cb)(const MessageT &_msg), const SubscribeOptions &_opts=SubscribeOptions())
Subscribe to a topic registering a callback. Note that this callback does not include any message inf...
Definition: Node.hh:213
bool Subscribe(const std::string &_topic, std::function< void(const MessageT &_msg, const MessageInfo &_info)> &_cb, const SubscribeOptions &_opts=SubscribeOptions())
Subscribe to a topic registering a callback. Note that this callback includes message information....
Definition: Node.hh:316
It creates a reply handler for the specific protobuf messages used. 'Req' is a protobuf message type ...
Definition: ReqHandler.hh:177
A class to provide different options for a subscription.
Definition: SubscribeOptions.hh:36
It creates a subscription handler for a specific protobuf message. 'T' is the Protobuf message type t...
Definition: SubscriptionHandler.hh:146
static bool FullyQualifiedName(const std::string &_partition, const std::string &_ns, const std::string &_topic, std::string &_name)
Get the full topic path given a namespace and a topic name. A fully qualified topic name's length mus...
T endl(T... args)
std::shared_ptr< ReqHandler< RequestT, ReplyT > > reqHandlerPtr(new ReqHandler< RequestT, ReplyT >(this->NodeUuid()))
std::unique_lock< std::recursive_mutex > lk(this->Shared() ->mutex)
*brief Advertise a new service without any output parameter *In this version the callback is a free function *param[in] _topic Topic name associated to the service *param[in] _cb Callback to handle the service request with the *following void(* _cb)(const RequestT &_req)
Definition: Node.hh:527
bool TopicInfo(const std::string &_topic, std::vector< MessagePublisher > &_publishers) const
*brief Old method for advertising a service This signature is *considered deprecated Please migrate to the callback signature std::function< void(ReplyT &_rep, bool &_result)> const AdvertiseServiceOptions RequestT
Definition: Node.hh:735
return this Request< RequestT, ReplyT >(_topic, _req, f)
void waitForShutdown()
Block the current thread until a SIGINT or SIGTERM is received. Note that this function registers a s...
void ServiceList(std::vector< std::string > &_services) const
bool UnadvertiseSrv(const std::string &_topic)
return this Request(_topic, req, _cb)
[_cb](const ReplyT &_internalRep, const bool _internalResult) {(*_cb)(_internalRep, _internalResult) f
Definition: Node.hh:897
this Shared() -> requests.AddHandler(fullyQualifiedTopic, this->NodeUuid(), reqHandlerPtr)
*brief Advertise a new service without any output parameter *In this version the callback is a free function *param[in] _topic Topic name associated to the service *param[in] _cb Callback to handle the service request with the *following void(*) const AdvertiseServiceOptions _options)
Definition: Node.hh:528
*brief Advertise a new service without any output parameter *In this version the callback is a free function *param[in] _topic Topic name associated to the service *param[in] _cb Callback to handle the service request with the *following void(*) const AdvertiseServiceOptions ReplyT const std::string std::function< void(const RequestT &_req, ReplyT &_rep, bool &_result)> const AdvertiseServiceOptions ReplyT boo Advertise)(const std::string &_topic, std::function< bool(const RequestT &_req, ReplyT &_rep)> &_cb, const AdvertiseServiceOptions &_options=AdvertiseServiceOptions())
Definition: Node.hh:587
*brief Old method for advertising a service This signature is *considered deprecated Please migrate to the callback signature std::function< void(ReplyT &_rep, bool &_result)> const AdvertiseServiceOptions ReplyT const std::string void(ClassT::*) ClassT _obj)
Definition: Node.hh:739
bool ServiceInfo(const std::string &_service, std::vector< ServicePublisher > &_publishers) const
*brief Advertise a new service without any output parameter *In this version the callback is a free function *param[in] _topic Topic name associated to the service *param[in] _cb Callback to handle the service request with the *following void(*) const AdvertiseServiceOptions ReplyT const std::string _topic)
Definition: Node.hh:558
const std::string kGenericMessageType
The string type used for generic messages.
Definition: TransportTypes.hh:170
Addresses_M< ServicePublisher > SrvAddresses_M
Definition: TransportTypes.hh:62
std::vector< std::string > AdvertisedServices() const
cb(_internalRep, _internalResult)
void TopicList(std::vector< std::string > &_topics) const
Definition: AdvertiseOptions.hh:28
STL namespace.