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< ISubscriptionHandlerlocalSubscriptions
 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

§ NodeShared()

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

Constructor.

§ ~NodeShared()

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

Destructor.

Member Function Documentation

§ Instance()

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.

§ OnNewConnection()

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.

§ OnNewDisconnection()

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.

§ OnNewSrvConnection()

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.

§ OnNewSrvDisconnection()

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.

§ Publish()

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.

§ RecvControlUpdate()

void ignition::transport::NodeShared::RecvControlUpdate ( )

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

§ RecvMsgUpdate()

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

Method in charge of receiving the topic updates.

§ RecvSrvRequest()

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

Method in charge of receiving the service call requests.

§ RecvSrvResponse()

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

Method in charge of receiving the service call responses.

§ RunReceptionTask()

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

Receive data and control messages.

§ SendPendingRemoteReqs()

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

§ context

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.

§ control

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

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

§ exit

bool ignition::transport::NodeShared::exit

When true, the reception thread will finish.

§ hostAddr

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

IP address of this host.

§ localSubscriptions

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

Subscriptions.

§ msgDiscovery

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

Discovery service (messages).

§ mutex

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

Mutex to guarantee exclusive access between all threads.

§ myAddress

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

My pub/sub address.

§ myControlAddress

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

My pub/sub control address.

§ myReplierAddress

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

My replier service call address.

§ myRequesterAddress

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

My requester service call address.

§ publisher

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

ZMQ socket to send topic updates.

§ pUuid

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

Process UUID.

§ remoteSubscribers

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

Remote subscribers.

§ replier

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

ZMQ socket to receive service call requests.

§ replierId

Uuid ignition::transport::NodeShared::replierId

Replier socket identity.

§ repliers

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

Service call repliers.

§ requester

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

ZMQ socket for sending service call requests.

§ requests

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

Pending service call requests.

§ responseReceiver

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

ZMQ socket for receiving service call responses.

§ responseReceiverId

Uuid ignition::transport::NodeShared::responseReceiverId

Response receiver socket identity.

§ srvDiscovery

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

Discovery service (services).

§ subscriber

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

ZMQ socket to receive topic updates.

§ threadReception

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

thread in charge of receiving and handling incoming messages.

§ Timeout

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

Timeout used for receiving messages (ms.).

§ timeout

int ignition::transport::NodeShared::timeout

Timeout used for receiving requests.

§ verbose

int ignition::transport::NodeShared::verbose

Print activity to stdout.


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