runMACS
 All Data Structures Files Functions Variables Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | Protected Attributes
RocServer Class Reference

#include <RocServer.h>

Inheritance diagram for RocServer:
_DummyGrabberImpl CamManager InfoServer

Public Member Functions

 RocServer (zmq::context_t &_ctx, const std::string &_brokerEndpoint, const std::string &_serviceName)
 
virtual ~RocServer ()
 

Protected Member Functions

virtual void startup ()
 called in handler thread on startup More...
 
virtual void teardown ()
 called in handler thread on shutdown More...
 
virtual void onRequest (std::list< zmq::message_t * > *envelope, std::list< zmq::message_t * > *data)
 The (not anymore) "to-be-overloaded" request handler. More...
 
virtual Json::Value call (const std::string &name, const Json::Value &arguments)
 The "to-be-overloaded" call handler. More...
 
virtual Json::Value getattr (const std::string &name)
 The "to-be-overloaded" getattr handler. More...
 
virtual void setattr (const std::string &name, const Json::Value &value)
 The "to-be-overloaded" setattr handler. More...
 
void reply (std::list< zmq::message_t * > *envelope, std::list< zmq::message_t * > *data=nullptr)
 
void replyValue (std::list< zmq::message_t * > *envelope, const Json::Value &value, const std::string &id="")
 
void replyError (std::list< zmq::message_t * > *envelope, int errorNo, const std::string &id="")
 

Protected Attributes

zmq::context_t & ctx
 

Detailed Description

Definition at line 24 of file RocServer.h.

Constructor & Destructor Documentation

RocServer::RocServer ( zmq::context_t &  _ctx,
const std::string &  _brokerEndpoint,
const std::string &  _serviceName 
)

Definition at line 20 of file RocServer.cpp.

RocServer::~RocServer ( )
virtual

Definition at line 32 of file RocServer.cpp.

Member Function Documentation

Json::Value RocServer::call ( const std::string &  name,
const Json::Value &  arguments 
)
protectedvirtual

The "to-be-overloaded" call handler.

This function is called by incoming request. Arguments must be passed as JSON. If the function is not implemented, RocNotImplementedError must be thrown.

Parameters
namefunction name
argumentsJSON encoded call arguments
Returns
JSON encoded return value

Definition at line 49 of file RocServer.cpp.

Json::Value RocServer::getattr ( const std::string &  name)
protectedvirtual

The "to-be-overloaded" getattr handler.

This function is called by incoming request. If the attribute is not implemented, RocNotImplementedError must be thrown. If it is callable, RocIsCallable must be thrown.

Parameters
nameattribute name
Returns
JSON encoded return value

Definition at line 55 of file RocServer.cpp.

void RocServer::onRequest ( std::list< zmq::message_t * > *  envelope,
std::list< zmq::message_t * > *  data 
)
protectedvirtual

The (not anymore) "to-be-overloaded" request handler.

Note
This function must delete data and all contained messages.
This function must call reply(...) with the passed envelope.

Definition at line 87 of file RocServer.cpp.

void RocServer::reply ( std::list< zmq::message_t * > *  envelope,
std::list< zmq::message_t * > *  data = nullptr 
)
protected

Definition at line 253 of file RocServer.cpp.

void RocServer::replyError ( std::list< zmq::message_t * > *  envelope,
int  errorNo,
const std::string &  id = "" 
)
protected

Definition at line 302 of file RocServer.cpp.

void RocServer::replyValue ( std::list< zmq::message_t * > *  envelope,
const Json::Value &  value,
const std::string &  id = "" 
)
protected

Definition at line 288 of file RocServer.cpp.

void RocServer::setattr ( const std::string &  name,
const Json::Value &  value 
)
protectedvirtual

The "to-be-overloaded" setattr handler.

This function is called by incoming request. If the attribute is not implemented, RocNotImplementedError must be thrown. If it is callable, RocIsCallable must be thrown.

Parameters
nameattribute name
valueJSON encoded value

Definition at line 60 of file RocServer.cpp.

void RocServer::startup ( )
protectedvirtual

called in handler thread on startup

Definition at line 41 of file RocServer.cpp.

void RocServer::teardown ( )
protectedvirtual

called in handler thread on shutdown

Definition at line 45 of file RocServer.cpp.

Field Documentation

zmq::context_t& RocServer::ctx
protected

Definition at line 77 of file RocServer.h.


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