|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
ZeroMQ helpers (context, message, socket), NIC address lookup, and CollectionApp, the base of processes that take part in the DAQ collection protocol. More...
#include <string>#include <zmq.h>#include <nlohmann/json.hpp>Classes | |
| class | ZmqContext |
| Owns a ZeroMQ context. More... | |
| class | ZmqMessage |
| Owns one zmq_msg_t frame; movable but not copyable. More... | |
| class | ZmqSocket |
| Wraps one ZeroMQ socket created from a ZmqContext. More... | |
| class | CollectionApp |
| Base of processes that join a DAQ collection: checks resource limits, connects a PUSH socket to tcp://manager:(zmq_base_port + platform) and a SUB socket (topic all) to port zmq_base_port + 10 + platform, binds inproc://drp, and dispatches incoming messages by key to the handle* methods. More... | |
Functions | |
| std::string | getNicIp (const std::string &forceIface) |
| Return the IPv4 address of the interface named forceIface; aborts (after logging) if it has none. | |
| std::string | getNicIp (bool forceEnet) |
| Return the IPv4 address of the first Infiniband interface, or of the first running Ethernet interface if there is no Infiniband interface or forceEnet is true; aborts if no suitable interface is found. | |
| nlohmann::json | createMsg (const std::string &key, const std::string &msg_id, size_t sender_id, nlohmann::json &body) |
| Return a JSON message with header key, msg_id and sender_id and the given body. | |
| nlohmann::json | createAsyncErrMsg (const std::string &alias, const std::string &errMsg) |
| Return an error message (key error, msg_id 0, sender 0) whose body err_info is alias: errMsg. | |
| nlohmann::json | createAsyncWarnMsg (const std::string &alias, const std::string &warnMsg) |
| Return a warning message (key warning, msg_id 0, sender 0) whose body err_info is alias: warnMsg. | |
| bool | checkResourceLimits () |
| Check that the hard MEMLOCK limit is unlimited and the hard RTPRIO limit is 99, and raise the soft limits to the hard ones. | |
| void | initShutdownSignals (const std::string &alias, void(*shutdownAction)()) |
| Install a handler for SIGINT, SIGQUIT and SIGTERM that calls shutdownAction on the first signal and exits on the second, and for SIGSEGV and SIGBUS that writes a gdb stack trace to a file named after alias and exits. | |
ZeroMQ helpers (context, message, socket), NIC address lookup, and CollectionApp, the base of processes that take part in the DAQ collection protocol.
| bool checkResourceLimits | ( | ) |
Check that the hard MEMLOCK limit is unlimited and the hard RTPRIO limit is 99, and raise the soft limits to the hard ones.
Returns true on a fatal problem (MEMLOCK inadequate or not settable, or a getrlimit() failure), else false.
| nlohmann::json createAsyncErrMsg | ( | const std::string & | alias, |
| const std::string & | errMsg | ||
| ) |
Return an error message (key error, msg_id 0, sender 0) whose body err_info is alias: errMsg.
| nlohmann::json createAsyncWarnMsg | ( | const std::string & | alias, |
| const std::string & | warnMsg | ||
| ) |
Return a warning message (key warning, msg_id 0, sender 0) whose body err_info is alias: warnMsg.
| nlohmann::json createMsg | ( | const std::string & | key, |
| const std::string & | msg_id, | ||
| size_t | sender_id, | ||
| nlohmann::json & | body | ||
| ) |
Return a JSON message with header key, msg_id and sender_id and the given body.
| std::string getNicIp | ( | bool | forceEnet | ) |
Return the IPv4 address of the first Infiniband interface, or of the first running Ethernet interface if there is no Infiniband interface or forceEnet is true; aborts if no suitable interface is found.
| std::string getNicIp | ( | const std::string & | forceIface | ) |
Return the IPv4 address of the interface named forceIface; aborts (after logging) if it has none.
| void initShutdownSignals | ( | const std::string & | alias, |
| void(*)() | shutdownAction | ||
| ) |
Install a handler for SIGINT, SIGQUIT and SIGTERM that calls shutdownAction on the first signal and exits on the second, and for SIGSEGV and SIGBUS that writes a gdb stack trace to a file named after alias and exits.