|
rogue
|
ZeroMQ client for Rogue control and update messaging. More...
#include <ZmqClient.h>
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 warnTime, uint32_t failTime=0) |
| Sets request timeout behavior. | |
| void | setTimeout (uint32_t warnTime, bool failTime)=delete |
| void | setTimeout (uint32_t warnTime, bool waitRetry, uint32_t maxRetries)=delete |
| 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::ZmqClient > | create (const std::string &addr, uint16_t port, bool doString) |
| Creates a ZeroMQ client. | |
| static void | setup_python () |
| Registers Python bindings for this class. | |
ZeroMQ client for Rogue control and update messaging.
ZmqClient connects to a ZmqServer endpoint and supports two operating modes selected by doString:
doString == false): subscribes to update messages and uses request/reply for binary RPC payloads.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().
Definition at line 50 of file ZmqClient.h.
| 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.
| addr | Server bind address or host. |
| port | Base server port. |
| doString | true for string request mode, false for binary mode. |
Definition at line 113 of file ZmqClient.cpp.
|
virtual |
Destroys client and stops background activity.
Definition at line 212 of file ZmqClient.cpp.
|
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.
| addr | Server bind address or host. |
| port | Base server port. |
| doString | true for string request mode, false for binary mode. |
Definition at line 90 of file ZmqClient.cpp.
|
virtual |
Handles async update payloads received on subscriber socket.
| data | Update payload as Python object. |
Reimplemented in rogue::interfaces::ZmqClientWrap.
Definition at line 428 of file ZmqClient.cpp.
| std::string rogue::interfaces::ZmqClient::exec | ( | const std::string & | path, |
| const std::string & | arg = "" |
||
| ) |
Executes callable node at path (string mode).
| path | Rogue node path. |
| arg | Optional argument string. |
Definition at line 324 of file ZmqClient.cpp.
| std::string rogue::interfaces::ZmqClient::getDisp | ( | const std::string & | path | ) |
Reads display-formatted value at a path (string mode).
| path | Rogue node path. |
Definition at line 316 of file ZmqClient.cpp.
| boost::python::object rogue::interfaces::ZmqClient::send | ( | boost::python::object | data | ) |
Sends binary request payload and receives binary response.
| data | Python object exposing a readable buffer. |
Definition at line 334 of file ZmqClient.cpp.
| std::string rogue::interfaces::ZmqClient::sendString | ( | const std::string & | path, |
| const std::string & | attr, | ||
| const std::string & | arg | ||
| ) |
Sends a string-mode request.
| path | Rogue node path. |
| attr | Attribute or operation name. |
| arg | Optional argument string. |
Definition at line 266 of file ZmqClient.cpp.
| void rogue::interfaces::ZmqClient::setDisp | ( | const std::string & | path, |
| const std::string & | value | ||
| ) |
Writes display-formatted value at a path (string mode).
| path | Rogue node path. |
| value | Value string to apply. |
Definition at line 320 of file ZmqClient.cpp.
|
delete |
|
delete |
| void rogue::interfaces::ZmqClient::setTimeout | ( | uint32_t | warnTime, |
| uint32_t | failTime = 0 |
||
| ) |
Sets request timeout behavior.
The recv loop in send() / sendString() wakes every warnTime milliseconds; on each wake it logs a "still waiting" warning and keeps waiting until the accumulated wait reaches failTime, at which point it throws rogue::GeneralError. failTime == 0 (default) installs no deadline and retries forever, preserving the historic contract that downstream callers (notably pysmurf) rely on. Use failTime == warnTime to fail on the first timeout.
| warnTime | Warn/poll period in milliseconds (ZMQ_RCVTIMEO). Must be greater than 0; a value of 0 throws rogue::GeneralError. |
| failTime | Absolute wait deadline in milliseconds. 0 (default) means no deadline (retry forever). |
Definition at line 244 of file ZmqClient.cpp.
|
static |
Registers Python bindings for this class.
Setup class in python.
Definition at line 96 of file ZmqClient.cpp.
| void rogue::interfaces::ZmqClient::stop | ( | ) |
Stops client sockets and background thread.
Definition at line 216 of file ZmqClient.cpp.
| std::string rogue::interfaces::ZmqClient::valueDisp | ( | const std::string & | path | ) |
Reads compact value display at a path (string mode).
| path | Rogue node path. |
Definition at line 328 of file ZmqClient.cpp.