All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
ignition::transport::NodeShared Class Reference

Private data for the Node class. More...

#include <ignition/transport/NodeShared.hh>

Public Member Functions

void OnNewConnection (const MessagePublisher &_pub)
 Callback executed when the discovery detects new topics. More...
 
void OnNewDisconnection (const MessagePublisher &_pub)
 Callback executed when the discovery detects disconnections. More...
 
void OnNewSrvConnection (const ServicePublisher &_pub)
 Callback executed when the discovery detects a new service call. More...
 
void OnNewSrvDisconnection (const ServicePublisher &_pub)
 Callback executed when a service call is no longer available. More...
 
bool Publish (const std::string &_topic, const std::string &_data, const std::string &_msgType)
 Publish data. More...
 
void RecvControlUpdate ()
 Method in charge of receiving the control updates (when a new remote subscriber notifies its presence for example). More...
 
void RecvMsgUpdate ()
 Method in charge of receiving the topic updates. More...
 
void RecvSrvRequest ()
 Method in charge of receiving the service call requests. More...
 
void RecvSrvResponse ()
 Method in charge of receiving the service call responses. More...
 
void RunReceptionTask ()
 Receive data and control messages. More...
 
void SendPendingRemoteReqs (const std::string &_topic, const std::string &_reqType, const std::string &_repType)
 Try to send all the requests for a given service call and a pair of request/response types. More...
 

Static Public Member Functions

static NodeSharedInstance ()
 NodeShared is a singleton. More...
 

Public Attributes

std::unique_ptr< zmq::context_t > context
 0MQ context. More...
 
std::unique_ptr< zmq::socket_t > control
 ZMQ socket to receive control updates (new connections, ...). More...
 
bool exit
 When true, the reception thread will finish. More...
 
std::string hostAddr
 IP address of this host. More...
 
HandlerStorage
< ISubscriptionHandler
localSubscriptions
 Subscriptions. More...
 
std::unique_ptr< MsgDiscoverymsgDiscovery
 Discovery service (messages). More...
 
std::recursive_mutex mutex
 Mutex to guarantee exclusive access between all threads. More...
 
std::string myAddress
 My pub/sub address. More...
 
std::string myControlAddress
 My pub/sub control address. More...
 
std::string myReplierAddress
 My replier service call address. More...
 
std::string myRequesterAddress
 My requester service call address. More...
 
std::unique_ptr< zmq::socket_t > publisher
 ZMQ socket to send topic updates. More...
 
std::string pUuid
 Process UUID. More...
 
TopicStorage< MessagePublisherremoteSubscribers
 Remote subscribers. More...
 
std::unique_ptr< zmq::socket_t > replier
 ZMQ socket to receive service call requests. More...
 
Uuid replierId
 Replier socket identity. More...
 
HandlerStorage< IRepHandlerrepliers
 Service call repliers. More...
 
std::unique_ptr< zmq::socket_t > requester
 ZMQ socket for sending service call requests. More...
 
HandlerStorage< IReqHandlerrequests
 Pending service call requests. More...
 
std::unique_ptr< zmq::socket_t > responseReceiver
 ZMQ socket for receiving service call responses. More...
 
Uuid responseReceiverId
 Response receiver socket identity. More...
 
std::unique_ptr< SrvDiscoverysrvDiscovery
 Discovery service (services). More...
 
std::unique_ptr< zmq::socket_t > subscriber
 ZMQ socket to receive topic updates. More...
 
std::thread threadReception
 thread in charge of receiving and handling incoming messages. More...
 
int timeout
 Timeout used for receiving requests. More...
 
int verbose
 Print activity to stdout. More...
 

Static Public Attributes

static const int Timeout = 250
 Timeout used for receiving messages (ms.). More...
 

Protected Member Functions

 NodeShared ()
 Constructor. More...
 
virtual ~NodeShared ()
 Destructor. More...
 

Detailed Description

Private data for the Node class.

This class should not be directly used. You should use the Node class.

Constructor & Destructor Documentation

ignition::transport::NodeShared::NodeShared ( )
protected

Constructor.

virtual ignition::transport::NodeShared::~NodeShared ( )
protectedvirtual

Destructor.

Member Function Documentation

static NodeShared* ignition::transport::NodeShared::Instance ( )
static

NodeShared is a singleton.

This method gets the NodeShared instance shared between all the nodes.

Returns
Pointer to the current NodeShared instance.
void ignition::transport::NodeShared::OnNewConnection ( const MessagePublisher _pub)

Callback executed when the discovery detects new topics.

Parameters
[in]_pubInformation of the publisher in charge of the topic.
void ignition::transport::NodeShared::OnNewDisconnection ( const MessagePublisher _pub)

Callback executed when the discovery detects disconnections.

Parameters
[in]_pubInformation of the publisher in charge of the topic.
void ignition::transport::NodeShared::OnNewSrvConnection ( const ServicePublisher _pub)

Callback executed when the discovery detects a new service call.

Parameters
[in]_pubInformation of the publisher in charge of the service.
void ignition::transport::NodeShared::OnNewSrvDisconnection ( const ServicePublisher _pub)

Callback executed when a service call is no longer available.

Parameters
[in]_pubInformation of the publisher in charge of the service.
bool ignition::transport::NodeShared::Publish ( const std::string &  _topic,
const std::string &  _data,
const std::string &  _msgType 
)

Publish data.

Parameters
[in]_topicTopic to be published.
[in]_dataData to publish.
[in]_msgTypeMessage type in string format.
Returns
true when success or false otherwise.
void ignition::transport::NodeShared::RecvControlUpdate ( )

Method in charge of receiving the control updates (when a new remote subscriber notifies its presence for example).

void ignition::transport::NodeShared::RecvMsgUpdate ( )

Method in charge of receiving the topic updates.

void ignition::transport::NodeShared::RecvSrvRequest ( )

Method in charge of receiving the service call requests.

void ignition::transport::NodeShared::RecvSrvResponse ( )

Method in charge of receiving the service call responses.

void ignition::transport::NodeShared::RunReceptionTask ( )

Receive data and control messages.

void ignition::transport::NodeShared::SendPendingRemoteReqs ( const std::string &  _topic,
const std::string &  _reqType,
const std::string &  _repType 
)

Try to send all the requests for a given service call and a pair of request/response types.

Parameters
[in]_topicTopic name.
[in]_reqTypeType of the request in string format.
[in]_repTypeType of the response in string format.

Member Data Documentation

std::unique_ptr<zmq::context_t> ignition::transport::NodeShared::context

0MQ context.

Always declare this object before any ZMQ socket to make sure that the context is destroyed after all sockets.

std::unique_ptr<zmq::socket_t> ignition::transport::NodeShared::control

ZMQ socket to receive control updates (new connections, ...).

bool ignition::transport::NodeShared::exit

When true, the reception thread will finish.

std::string ignition::transport::NodeShared::hostAddr

IP address of this host.

HandlerStorage<ISubscriptionHandler> ignition::transport::NodeShared::localSubscriptions

Subscriptions.

std::unique_ptr<MsgDiscovery> ignition::transport::NodeShared::msgDiscovery

Discovery service (messages).

std::recursive_mutex ignition::transport::NodeShared::mutex

Mutex to guarantee exclusive access between all threads.

std::string ignition::transport::NodeShared::myAddress

My pub/sub address.

std::string ignition::transport::NodeShared::myControlAddress

My pub/sub control address.

std::string ignition::transport::NodeShared::myReplierAddress

My replier service call address.

std::string ignition::transport::NodeShared::myRequesterAddress

My requester service call address.

std::unique_ptr<zmq::socket_t> ignition::transport::NodeShared::publisher

ZMQ socket to send topic updates.

std::string ignition::transport::NodeShared::pUuid

Process UUID.

TopicStorage<MessagePublisher> ignition::transport::NodeShared::remoteSubscribers

Remote subscribers.

std::unique_ptr<zmq::socket_t> ignition::transport::NodeShared::replier

ZMQ socket to receive service call requests.

Uuid ignition::transport::NodeShared::replierId

Replier socket identity.

HandlerStorage<IRepHandler> ignition::transport::NodeShared::repliers

Service call repliers.

std::unique_ptr<zmq::socket_t> ignition::transport::NodeShared::requester

ZMQ socket for sending service call requests.

HandlerStorage<IReqHandler> ignition::transport::NodeShared::requests

Pending service call requests.

std::unique_ptr<zmq::socket_t> ignition::transport::NodeShared::responseReceiver

ZMQ socket for receiving service call responses.

Uuid ignition::transport::NodeShared::responseReceiverId

Response receiver socket identity.

std::unique_ptr<SrvDiscovery> ignition::transport::NodeShared::srvDiscovery

Discovery service (services).

std::unique_ptr<zmq::socket_t> ignition::transport::NodeShared::subscriber

ZMQ socket to receive topic updates.

std::thread ignition::transport::NodeShared::threadReception

thread in charge of receiving and handling incoming messages.

const int ignition::transport::NodeShared::Timeout = 250
static

Timeout used for receiving messages (ms.).

int ignition::transport::NodeShared::timeout

Timeout used for receiving requests.

int ignition::transport::NodeShared::verbose

Print activity to stdout.


The documentation for this class was generated from the following file: