BlueZero (BØ)
Middleware for distributed applications
server_node_object.cpp

This is an example of creating a node with a service server by subclassing b0::Node

#include <b0/node.h>
#include <b0/service_server.h>
#include <iostream>
class TestServerNode : public b0::Node
{
public:
TestServerNode()
: Node("server"),
srv_(this, "control", &TestServerNode::on)
{
}
void on(const std::string &req, std::string &rep)
{
std::cout << "Received: " << req << std::endl;
rep = "hi";
std::cout << "Sending: " << rep << std::endl;
}
protected:
};
int main(int argc, char **argv)
{
TestServerNode node;
node.init();
node.spin();
node.cleanup();
return 0;
}