![]() |
IRSOL
C++ code implementing socket server for interacting with Baumer camera.
|
Represents a success response message from the server. More...
#include <success.hpp>
Public Member Functions | |
std::string | toString () const |
Converts the success message to a human-readable string. | |
bool | hasBody () const |
bool | hasInt () const |
bool | hasDouble () const |
bool | hasString () const |
Static Public Member Functions | |
static Success | from (const Assignment &msg, std::optional< irsol::types::protocol_value_t > overrideValue=std::nullopt) |
Creates a success message from an Assignment. | |
static Success | from (const Command &msg) |
Creates a success message from a Command. | |
static Success | from (const Inquiry &msg, irsol::types::protocol_value_t result) |
Creates a success message from an Inquiry. | |
static Success | asStatus (const std::string &identifier, irsol::types::protocol_value_t value) |
Creates a standalone status message with a value. | |
Public Attributes | |
std::string | identifier |
The identifier associated with the success response. | |
InMessageKind | source |
The kind of the incoming message that triggered this response. | |
std::optional< irsol::types::protocol_value_t > | body {} |
Optional result or data associated with the response. | |
Private Member Functions | |
Success (const std::string &identifier, InMessageKind source, std::optional< irsol::types::protocol_value_t > body=std::nullopt) | |
Represents a success response message from the server.
A Success
message acknowledges the successful processing of an incoming message (such as an irsol::protocol::Assignment, irsol::protocol::Command, or irsol::protocol::Inquiry). It contains the originating identifier, the kind of message that triggered the response, and optionally a result value (e.g., for assignments and inquiries).
Can be stored in a irsol::protocol::OutMessage variant.
Definition at line 38 of file success.hpp.
|
private |
Definition at line 10 of file success.cpp.
|
inlinestatic |
Creates a standalone status message with a value.
Useful in cases where the server responds without having access to the original incoming message (e.g., asynchronous events).
identifier | The identifier associated with the result. |
value | The value to return. |
Definition at line 116 of file success.hpp.
|
inlinestatic |
Creates a success message from an Assignment.
msg | The original assignment message. |
overrideValue | Optional value to return instead of the original. This is sometimes set by the server, when the original value of the Assignment message was not suitable for storage (e.g. due to precision limitations or min/max constraints). |
Definition at line 75 of file success.hpp.
Creates a success message from a Command.
msg | The original command message. |
Definition at line 90 of file success.hpp.
|
inlinestatic |
Creates a success message from an Inquiry.
msg | The original inquiry message. |
result | The result of the inquiry. |
Definition at line 101 of file success.hpp.
bool irsol::protocol::Success::hasBody | ( | ) | const |
Definition at line 38 of file success.cpp.
bool irsol::protocol::Success::hasDouble | ( | ) | const |
Definition at line 48 of file success.cpp.
bool irsol::protocol::Success::hasInt | ( | ) | const |
Definition at line 43 of file success.cpp.
bool irsol::protocol::Success::hasString | ( | ) | const |
Definition at line 53 of file success.cpp.
std::string irsol::protocol::Success::toString | ( | ) | const |
Converts the success message to a human-readable string.
Definition at line 18 of file success.cpp.
std::optional<irsol::types::protocol_value_t> irsol::protocol::Success::body {} |
Optional result or data associated with the response.
Definition at line 47 of file success.hpp.
std::string irsol::protocol::Success::identifier |
The identifier associated with the success response.
Definition at line 41 of file success.hpp.
InMessageKind irsol::protocol::Success::source |
The kind of the incoming message that triggered this response.
Definition at line 44 of file success.hpp.