Class representing signals for ZMQ communication.
More...
#include <signal.h>
|
| type_t | type () const noexcept |
| | Get the type of the signal.
|
| |
| bool | is_success () const noexcept |
| | Check if this signal is a success signal.
|
| |
| bool | is_failure () const noexcept |
| | Check if this signal is a failure signal.
|
| |
| bool | is_stop () const noexcept |
| | Check if this signal is a stop signal.
|
| |
|
| static zmq::message_t | create_success () |
| | Create a success signal message.
|
| |
| static zmq::message_t | create_failure () |
| | Create a failure signal message.
|
| |
| static zmq::message_t | create_stop () |
| | Create a stop signal message.
|
| |
| static std::optional< signal_t > | check_signal (const zmq::message_t &msg) noexcept |
| | Check if a zmq::message_t contains a valid signal.
|
| |
Class representing signals for ZMQ communication.
The signal_t class encapsulates signal types. It provides factory methods to create a zmq::message_t representing different signal states and utilities to parse and validate incoming messages as signals.
- Note
- This class is immutable after construction and can be instantiated only by the check_signal(const zmq::message_t& msg) static factory method.
-
Static methods are provided to create zmq::message_t instances encoding a signal_t.
Definition at line 77 of file signal.h.
◆ type_t
Enumeration of possible signal types.
Defines the three fundamental signal states. Each signal type represents a distinct condition or request in the communication protocol.
| Enumerator |
|---|
| success | Operation completed successfully.
|
| failure | Operation failed.
|
| stop | Stop/terminate request.
|
Definition at line 86 of file signal.h.
◆ check_signal()
| std::optional< signal_t > zmqzext::signal_t::check_signal |
( |
const zmq::message_t & |
msg | ) |
|
|
staticnoexcept |
Check if a zmq::message_t contains a valid signal.
Validates whether a given zmq::message_t contains a properly formatted signal and, if valid, parses it into a signal_t object. This function is useful for receiving and interpreting signals from ZMQ sockets.
- Parameters
-
| msg | The zmq::message_t to validate and parse |
- Returns
- std::optional<signal_t> containing a signal_t object if the message is a valid signal, std::nullopt otherwise
- Note
- This function is thread-safe and does not modify the input message.
- See also
- create_success()
-
create_failure()
-
create_stop()
Definition at line 57 of file signal.cpp.
◆ create_failure()
| zmq::message_t zmqzext::signal_t::create_failure |
( |
| ) |
|
|
static |
Create a failure signal message.
Constructs a zmq::message_t representing a failure signal. The message contains the encoded failure signal type.
- Returns
- A zmq::message_t containing the failure signal
- See also
- create_success()
-
create_stop()
Definition at line 53 of file signal.cpp.
◆ create_stop()
| zmq::message_t zmqzext::signal_t::create_stop |
( |
| ) |
|
|
static |
Create a stop signal message.
Constructs a zmq::message_t representing a stop/terminate signal. The message contains the encoded stop signal type.
- Returns
- A zmq::message_t containing the stop signal
- See also
- create_success()
-
create_failure()
Definition at line 55 of file signal.cpp.
◆ create_success()
| zmq::message_t zmqzext::signal_t::create_success |
( |
| ) |
|
|
static |
Create a success signal message.
Constructs a zmq::message_t representing a success signal. The message contains the encoded success signal type.
- Returns
- A zmq::message_t containing the success signal
- See also
- create_failure()
-
create_stop()
Definition at line 51 of file signal.cpp.
◆ is_failure()
| bool zmqzext::signal_t::is_failure |
( |
| ) |
const |
|
inlinenoexcept |
Check if this signal is a failure signal.
- Returns
- true if the signal type is failure, false otherwise
- Note
- This function is thread-safe.
- See also
- is_success()
-
is_stop()
Definition at line 119 of file signal.h.
◆ is_stop()
| bool zmqzext::signal_t::is_stop |
( |
| ) |
const |
|
inlinenoexcept |
Check if this signal is a stop signal.
- Returns
- true if the signal type is stop, false otherwise
- Note
- This function is thread-safe.
- See also
- is_success()
-
is_failure()
Definition at line 129 of file signal.h.
◆ is_success()
| bool zmqzext::signal_t::is_success |
( |
| ) |
const |
|
inlinenoexcept |
Check if this signal is a success signal.
- Returns
- true if the signal type is success, false otherwise
- Note
- This function is thread-safe.
- See also
- is_failure()
-
is_stop()
Definition at line 109 of file signal.h.
◆ type()
| type_t zmqzext::signal_t::type |
( |
| ) |
const |
|
inlinenoexcept |
The documentation for this class was generated from the following files: