rogue::interfaces::ZmqClient

Python binding

This C++ class is also exported into Python as rogue.interfaces.ZmqClient.

Python API page: - ZmqClient

For conceptual usage, see:

class ZmqClient
[header]

ZeroMQ client for Rogue control and update messaging.

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

  • Binary mode (doString == false): subscribes to update messages and uses request/reply for binary RPC payloads.

  • String mode (doString == true): uses a string request/reply endpoint for high-level display/value operations.

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

Subclassed by rogue::interfaces::ZmqClientWrap

Public Functions

ZmqClient(const std::string &addr, uint16_t port, bool doString)
[header] [impl]

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:
  • addr – Server bind address or host.

  • port – Base server port.

  • doStringtrue for string request mode, false for binary mode.

virtual ~ZmqClient()
[header] [impl]

Destroys client and stops background activity.

void setTimeout(uint32_t msecs, bool waitRetry)
[header] [impl]

Sets request timeout behavior.

Parameters:
  • msecs – Timeout in milliseconds.

  • waitRetrytrue to continue waiting/retrying after timeouts.

std::string sendString(const std::string &path, const std::string &attr, const std::string &arg)
[header] [impl]

Sends a string-mode request.

Parameters:
  • path – Rogue node path.

  • attr – Attribute or operation name.

  • arg – Optional argument string.

Returns:

Server response string.

std::string getDisp(const std::string &path)
[header] [impl]

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

Parameters:

path – Rogue node path.

Returns:

Display-formatted value.

void setDisp(const std::string &path, const std::string &value)
[header] [impl]

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

Parameters:
  • path – Rogue node path.

  • value – Value string to apply.

std::string exec(const std::string &path, const std::string &arg = "")
[header] [impl]

Executes callable node at path (string mode).

Parameters:
  • path – Rogue node path.

  • arg – Optional argument string.

Returns:

Callable result as string.

std::string valueDisp(const std::string &path)
[header] [impl]

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

Parameters:

path – Rogue node path.

Returns:

Value display string.

boost::python::object send(boost::python::object data)
[header] [impl]

Sends binary request payload and receives binary response.

Parameters:

data – Python object exposing a readable buffer.

Returns:

Response bytes as a Python bytes-like object.

virtual void doUpdate(boost::python::object data)
[header] [impl]

Handles async update payloads received on subscriber socket.

Parameters:

data – Update payload as Python object.

void stop()
[header] [impl]

Stops client sockets and background thread.

Public Static Functions

static std::shared_ptr<rogue::interfaces::ZmqClient> create(const std::string &addr, uint16_t port, bool doString)
[header] [impl]

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.

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.

Parameters:
  • addr – Server bind address or host.

  • port – Base server port.

  • doStringtrue for string request mode, false for binary mode.

Returns:

Shared pointer to the created client.

static void setup_python()
[header] [impl]

Registers Python bindings for this class.

Setup class in python.