18 #ifndef IGN_TRANSPORT_NODESHARED_HH_
19 #define IGN_TRANSPORT_NODESHARED_HH_
22 #pragma warning(push, 0)
24 #include <google/protobuf/message.h>
37 #include "ignition/transport/config.hh"
38 #include "ignition/transport/Export.hh"
54 inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
61 class NodeSharedPrivate;
89 const size_t _dataSize,
172 public:
void IGN_DEPRECATED(8.0) TriggerSubscriberCallbacks(
173 const
std::
string &_topic,
174 const
std::
string &_msgData,
175 const
std::
string &_msgType,
184 public:
void TriggerCallbacks(
186 const
std::
string &_msgData,
192 public:
void RecvControlUpdate();
195 public:
void RecvSrvRequest();
198 public:
void RecvSrvResponse();
205 public:
void SendPendingRemoteReqs(const
std::
string &_topic,
206 const
std::
string &_reqType,
207 const
std::
string &_repType);
241 public:
bool TopicPublishers(const
std::
string &_topic,
250 public:
bool DiscoverService(const
std::
string &_topic) const;
269 public:
int RcvHwm();
281 public:
int SndHwm();
289 public:
void EnableStats(const
std::
string &_topic,
bool _enable,
299 const
std::
string &_topic) const;
310 private:
bool InitializeSockets();
317 public:
Uuid responseReceiverId;
325 #pragma warning(push)
326 #pragma warning(disable: 4251)
338 public:
static const int kMsgDiscPort = 10317;
341 public:
static const int kSrvDiscPort = 10318;
415 #pragma warning(push)
416 #pragma warning(disable: 4251)
447 private:
friend Node;
448 private:
friend NodePrivate;
Class to store and manage service call handlers.
Definition: HandlerStorage.hh:40
A class that provides information about the message received.
Definition: MessageInfo.hh:38
This class stores all the information about a message publisher.
Definition: Publisher.hh:223
Private data for the Node class. This class should not be directly used. You should use the Node clas...
Definition: NodeShared.hh:67
std::string myControlAddress
My pub/sub control address.
Definition: NodeShared.hh:431
HandlerWrapper localSubscribers
Definition: NodeShared.hh:410
int verbose
Print activity to stdout.
Definition: NodeShared.hh:425
void RecvMsgUpdate()
Method in charge of receiving the topic updates.
std::string hostAddr
IP address of this host.
Definition: NodeShared.hh:440
SubscriberInfo CheckSubscriberInfo(const std::string &_topic, const std::string &_msgType) const
Get information about the nodes that are subscribed to the publishers of this NodeShared.
std::string pUuid
Process UUID.
Definition: NodeShared.hh:329
std::string myRequesterAddress
My requester service call address.
Definition: NodeShared.hh:434
std::string myAddress
My pub/sub address.
Definition: NodeShared.hh:428
TopicStorage< MessagePublisher > remoteSubscribers
Remote subscribers.
Definition: NodeShared.hh:350
static NodeShared * Instance()
NodeShared is a singleton. This method gets the NodeShared instance shared between all the nodes.
std::recursive_mutex mutex
Mutex to guarantee exclusive access between all threads.
Definition: NodeShared.hh:335
HandlerStorage< IRepHandler > repliers
Service call repliers.
Definition: NodeShared.hh:419
HandlerStorage< IReqHandler > requests
Pending service call requests.
Definition: NodeShared.hh:422
std::string myReplierAddress
My replier service call address.
Definition: NodeShared.hh:437
bool Publish(const std::string &_topic, char *_data, const size_t _dataSize, DeallocFunc *_ffn, const std::string &_msgType)
Publish data.
HandlerInfo CheckHandlerInfo(const std::string &_topic) const
Get information about the local and raw subscribers that are attached to this NodeShared.
void RunReceptionTask()
Receive data and control messages.
std::thread threadReception
thread in charge of receiving and handling incoming messages.
Definition: NodeShared.hh:332
A class that allows a client to communicate with other peers. There are two main communication modes:...
Definition: Node.hh:96
This class stores all the information about a service publisher.
Definition: Publisher.hh:356
Encapsulates statistics for a single topic. The set of statistics include:
Definition: TopicStatistics.hh:102
Store address information about topics and provide convenient methods for adding new topics,...
Definition: TopicStorage.hh:42
A portable class for representing a Universally Unique Identifier.
Definition: Uuid.hh:46
void(void *_data, void *_hint) DeallocFunc
Definition: TransportTypes.hh:171
Definition: AdvertiseOptions.hh:29
HandlerInfo contains information about callback handlers which is useful for local publishers and mes...
Definition: NodeShared.hh:101
std::map< std::string, ISubscriptionHandler_M > localHandlers
This is a map of the standard local callback handlers. The key is the topic name, and the value is an...
Definition: NodeShared.hh:105
bool haveRaw
True iff there are any raw local subscribers.
Definition: NodeShared.hh:116
bool haveLocal
True iff there are any standard local subscribers.
Definition: NodeShared.hh:113
std::map< std::string, RawSubscriptionHandler_M > rawHandlers
This is a map of the raw local callback handlers. The key is the topic name, and the value is another...
Definition: NodeShared.hh:110
This struct wraps up the two different types of subscription handlers: normal (deserialized) and raw ...
Definition: NodeShared.hh:360
bool HasSubscriber(const std::string &_fullyQualifiedTopic) const
Returns true if this wrapper contains any subscriber that matches the given fully-qualified topic nam...
HandlerStorage< ISubscriptionHandler > normal
Normal local subscriptions.
Definition: NodeShared.hh:402
bool HasSubscriber(const std::string &_fullyQualifiedTopic, const std::string &_msgType) const
Returns true if this wrapper contains any subscriber that matches the given topic name and message ty...
std::vector< std::string > NodeUuids(const std::string &_fullyQualifiedTopic, const std::string &_msgTypeName) const
Get a set of node UUIDs for subscribers in this wrapper that match the topic and message type criteri...
bool RemoveHandlersForNode(const std::string &_fullyQualifiedTopic, const std::string &_nUuid)
Remove the handlers for the given topic name that belong to a specific node.
HandlerStorage< RawSubscriptionHandler > raw
Raw local subscriptions. Keeping these separate from localSubscriptions allows us to avoid an unneces...
Definition: NodeShared.hh:407
This struct provides information about the Subscribers of a Publisher. It should only be retrieved us...
Definition: NodeShared.hh:142
bool haveRemote
True if this Publisher has any remote subscribers.
Definition: NodeShared.hh:145