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

ZeroMQ client for Rogue control and update messaging. More...

#include <ZmqClient.h>

Inheritance diagram for rogue::interfaces::ZmqClient:
rogue::interfaces::ZmqClientWrap

Public Member Functions

 ZmqClient (const std::string &addr, uint16_t port, bool doString)
 Constructs a ZeroMQ client and connects sockets.
 
virtual ~ZmqClient ()
 Destroys client and stops background activity.
 
void setTimeout (uint32_t msecs, bool waitRetry)
 Sets request timeout behavior.
 
std::string sendString (const std::string &path, const std::string &attr, const std::string &arg)
 Sends a string-mode request.
 
std::string getDisp (const std::string &path)
 Reads display-formatted value at a path (string mode).
 
void setDisp (const std::string &path, const std::string &value)
 Writes display-formatted value at a path (string mode).
 
std::string exec (const std::string &path, const std::string &arg="")
 Executes callable node at path (string mode).
 
std::string valueDisp (const std::string &path)
 Reads compact value display at a path (string mode).
 
boost::python::object send (boost::python::object data)
 Sends binary request payload and receives binary response.
 
virtual void doUpdate (boost::python::object data)
 Handles async update payloads received on subscriber socket.
 
void stop ()
 Stops client sockets and background thread.
 

Static Public Member Functions

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

Detailed Description

ZeroMQ client for Rogue control and update messaging.

ZmqClient connects to a ZmqServer endpoint and supports two operating modes selected by doString:

In binary mode, a background thread receives publish updates and dispatches them to doUpdate().

Definition at line 48 of file ZmqClient.h.

Constructor & Destructor Documentation

◆ ZmqClient()

rogue::interfaces::ZmqClient::ZmqClient ( const std::string &  addr,
uint16_t  port,
bool  doString 
)

Constructs a ZeroMQ client and connects sockets.

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

Parameters
addrServer bind address or host.
portBase server port.
doStringtrue for string request mode, false for binary mode.

Definition at line 61 of file ZmqClient.cpp.

◆ ~ZmqClient()

rogue::interfaces::ZmqClient::~ZmqClient ( )
virtual

Destroys client and stops background activity.

Definition at line 138 of file ZmqClient.cpp.

Member Function Documentation

◆ create()

rogue::interfaces::ZmqClientPtr rogue::interfaces::ZmqClient::create ( const std::string &  addr,
uint16_t  port,
bool  doString 
)
static

Creates a ZeroMQ client.

Parameter semantics are identical to the constructor; see ZmqClient() for socket 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
addrServer bind address or host.
portBase server port.
doStringtrue for string request mode, false for binary mode.
Returns
Shared pointer to the created client.

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 38 of file ZmqClient.cpp.

◆ doUpdate()

void rogue::interfaces::ZmqClient::doUpdate ( boost::python::object  data)
virtual

Handles async update payloads received on subscriber socket.

Parameters
dataUpdate payload as Python object.

Reimplemented in rogue::interfaces::ZmqClientWrap.

Definition at line 283 of file ZmqClient.cpp.

◆ exec()

std::string rogue::interfaces::ZmqClient::exec ( const std::string &  path,
const std::string &  arg = "" 
)

Executes callable node at path (string mode).

Parameters
pathRogue node path.
argOptional argument string.
Returns
Callable result as string.

Definition at line 220 of file ZmqClient.cpp.

◆ getDisp()

std::string rogue::interfaces::ZmqClient::getDisp ( const std::string &  path)

Reads display-formatted value at a path (string mode).

Parameters
pathRogue node path.
Returns
Display-formatted value.

Definition at line 212 of file ZmqClient.cpp.

◆ send()

boost::python::object rogue::interfaces::ZmqClient::send ( boost::python::object  data)

Sends binary request payload and receives binary response.

Parameters
dataPython object exposing a readable buffer.
Returns
Response bytes as a Python bytes-like object.

Definition at line 230 of file ZmqClient.cpp.

◆ sendString()

std::string rogue::interfaces::ZmqClient::sendString ( const std::string &  path,
const std::string &  attr,
const std::string &  arg 
)

Sends a string-mode request.

Parameters
pathRogue node path.
attrAttribute or operation name.
argOptional argument string.
Returns
Server response string.

Definition at line 169 of file ZmqClient.cpp.

◆ setDisp()

void rogue::interfaces::ZmqClient::setDisp ( const std::string &  path,
const std::string &  value 
)

Writes display-formatted value at a path (string mode).

Parameters
pathRogue node path.
valueValue string to apply.

Definition at line 216 of file ZmqClient.cpp.

◆ setTimeout()

void rogue::interfaces::ZmqClient::setTimeout ( uint32_t  msecs,
bool  waitRetry 
)

Sets request timeout behavior.

Parameters
msecsTimeout in milliseconds.
waitRetrytrue to continue waiting/retrying after timeouts.

Definition at line 157 of file ZmqClient.cpp.

◆ setup_python()

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

Registers Python bindings for this class.

Setup class in python.

Definition at line 44 of file ZmqClient.cpp.

◆ stop()

void rogue::interfaces::ZmqClient::stop ( )

Stops client sockets and background thread.

Definition at line 142 of file ZmqClient.cpp.

◆ valueDisp()

std::string rogue::interfaces::ZmqClient::valueDisp ( const std::string &  path)

Reads compact value display at a path (string mode).

Parameters
pathRogue node path.
Returns
Value display string.

Definition at line 224 of file ZmqClient.cpp.


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