1 #ifndef B0__SERVICE_SERVER_H__INCLUDED 2 #define B0__SERVICE_SERVER_H__INCLUDED 6 #include <boost/function.hpp> 7 #include <boost/bind.hpp> 32 ServiceServer(
Node *node, std::string service_name, boost::function<
void(
const std::string&, std::string&)> callback = 0,
bool managed =
true,
bool notify_graph =
true);
38 ServiceServer(TNode *node, std::string service_name,
void (TNode::*callbackMethod)(
const std::string&, std::string&),
bool managed =
true,
bool notify_graph =
true)
39 :
ServiceServer(node, service_name, boost::
bind(callbackMethod, node, _1, _2), managed, notify_graph)
48 ServiceServer(
Node *node, std::string service_name,
void (T::*callbackMethod)(
const std::string&, std::string&), T *callbackObject,
bool managed =
true,
bool notify_graph =
true)
49 :
ServiceServer(node, service_name, boost::
bind(callbackMethod, callbackObject, _1, _2), managed, notify_graph)
62 void log(
LogLevel level, std::string message)
const override;
67 virtual void init()
override;
72 virtual void cleanup()
override;
87 virtual void bind(std::string address);
114 boost::function<void(const std::string&, std::string&)>
callback_;
119 #endif // B0__SERVICE_SERVER_H__INCLUDED LogLevel
Definition: interface.h:23
std::string getServiceName()
Return the name of this server's service.
virtual void bind()
Bind socket to the address.
ServiceServer(TNode *node, std::string service_name, void(TNode::*callbackMethod)(const std::string &, std::string &), bool managed=true, bool notify_graph=true)
Construct a ServiceServer child of a specific Node, using a method (of the Node subclass) as callback...
Definition: service_server.h:38
virtual void unbind()
Unbind socket from the address.
virtual void spinOnce() override
Poll and read incoming messages, and dispatch them (called by b0::Node::spinOnce()) ...
ServiceServer(Node *node, std::string service_name, boost::function< void(const std::string &, std::string &)> callback=0, bool managed=true, bool notify_graph=true)
Construct an ServiceServer child of the specified Node, optionally using a boost::function as a callb...
void log(LogLevel level, std::string message) const override
Log a message using node's logger, prepending this service server informations.
boost::function< void(const std::string &, std::string &)> callback_
Callback which will be called when a new message is read from the socket.
Definition: service_server.h:114
virtual void cleanup() override
Perform cleanup and optionally send graph notify.
The abstraction for a node in the network.
Definition: node.h:40
The service server class.
Definition: service_server.h:24
The Socket class.
Definition: socket.h:31
std::string bind_addr_
The ZeroMQ address to bind the service socket on.
Definition: service_server.h:106
virtual void log(LogLevel level, std::string message) const =0
Log a message to the remote logger, with a specified level.
virtual ~ServiceServer()
ServiceServer destructor.
virtual void init() override
Perform initialization and optionally send graph notify.
ServiceServer(Node *node, std::string service_name, void(T::*callbackMethod)(const std::string &, std::string &), T *callbackObject, bool managed=true, bool notify_graph=true)
Construct a ServiceServer child of a specific Node, using a method as callback.
Definition: service_server.h:48
const bool notify_graph_
If false this socket will not send announcement to resolv (i.e. it will be "invisible") ...
Definition: service_server.h:109
virtual void announce()
Announce service to resolver.