rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
rogue::interfaces::ZmqServer Class Reference

ZeroMQ server for Rogue control, request/reply, and publish updates. More...

#include <ZmqServer.h>

Inheritance diagram for rogue::interfaces::ZmqServer:
rogue::interfaces::ZmqServerWrap

Public Member Functions

 ZmqServer (const std::string &addr, uint16_t port)
 Constructs a ZeroMQ server.
 
virtual ~ZmqServer ()
 Destroys server and stops worker threads/sockets.
 
void publish (boost::python::object data)
 Publishes an update payload on the publish socket.
 
virtual boost::python::object doRequest (boost::python::object data)
 Handles one binary request payload.
 
virtual std::string doString (const std::string &data)
 Handles one string request payload.
 
uint16_t port ()
 Returns currently bound base port.
 
void stop ()
 Stops server threads and closes sockets.
 
void start ()
 Starts server, binds sockets, and launches worker threads.
 

Static Public Member Functions

static std::shared_ptr< rogue::interfaces::ZmqServercreate (const std::string &addr, uint16_t port)
 Creates a ZeroMQ server.
 
static void setup_python ()
 Registers Python bindings for this class.
 

Detailed Description

ZeroMQ server for Rogue control, request/reply, and publish updates.

ZmqServer exposes three sockets:

start() binds sockets and launches worker threads for binary and string request handling. If constructed with port == 0, the server scans for an available base port starting at 9099 in increments of 4.

Definition at line 47 of file ZmqServer.h.

Constructor & Destructor Documentation

◆ ZmqServer()

rogue::interfaces::ZmqServer::ZmqServer ( const std::string &  addr,
uint16_t  port 
)

Constructs a ZeroMQ server.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

Parameters
addrBind address/interface.
portBase port. Use 0 for auto-allocation.

Definition at line 58 of file ZmqServer.cpp.

◆ ~ZmqServer()

rogue::interfaces::ZmqServer::~ZmqServer ( )
virtual

Destroys server and stops worker threads/sockets.

Definition at line 67 of file ZmqServer.cpp.

Member Function Documentation

◆ create()

rogue::interfaces::ZmqServerPtr rogue::interfaces::ZmqServer::create ( const std::string &  addr,
uint16_t  port 
)
static

Creates a ZeroMQ server.

Parameter semantics are identical to the constructor; see ZmqServer() for bind/setup behavior details. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Parameters
addrBind address/interface.
portBase port. Use 0 for auto-allocation.
Returns
Shared pointer to the created server.

Company : SLAC National Accelerator Laboratory

Description:

Rogue ZMQ Control Interface

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms

contained in the LICENSE.txt file.

Definition at line 37 of file ZmqServer.cpp.

◆ doRequest()

boost::python::object rogue::interfaces::ZmqServer::doRequest ( boost::python::object  data)
virtual

Handles one binary request payload.

Parameters
dataRequest payload as Python object.
Returns
Response payload as Python object.

Reimplemented in rogue::interfaces::ZmqServerWrap.

Definition at line 234 of file ZmqServer.cpp.

◆ doString()

std::string rogue::interfaces::ZmqServer::doString ( const std::string &  data)
virtual

Handles one string request payload.

Parameters
dataRequest payload string.
Returns
Response payload string.

Reimplemented in rogue::interfaces::ZmqServerWrap.

Definition at line 211 of file ZmqServer.cpp.

◆ port()

uint16_t rogue::interfaces::ZmqServer::port ( )

Returns currently bound base port.

Returns
Base port number.

Definition at line 207 of file ZmqServer.cpp.

◆ publish()

void rogue::interfaces::ZmqServer::publish ( boost::python::object  data)

Publishes an update payload on the publish socket.

Parameters
dataPython object exposing a readable buffer.

Definition at line 217 of file ZmqServer.cpp.

◆ setup_python()

void rogue::interfaces::ZmqServer::setup_python ( )
static

Registers Python bindings for this class.

Setup class in python.

Definition at line 43 of file ZmqServer.cpp.

◆ start()

void rogue::interfaces::ZmqServer::start ( )

Starts server, binds sockets, and launches worker threads.

Definition at line 71 of file ZmqServer.cpp.

◆ stop()

void rogue::interfaces::ZmqServer::stop ( )

Stops server threads and closes sockets.

Definition at line 113 of file ZmqServer.cpp.


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