11 const std::string& identifier,
13 : identifier(utils::validateIdentifier(identifier)),
value(
value)
19 std::ostringstream oss;
20 oss <<
"BinaryDataAttribute{"
21 <<
"identifier: '" <<
identifier <<
"', value: ";
23 oss <<
"<int> " << std::get<int>(
value);
25 oss <<
"<double> " << std::get<double>(
value);
27 oss <<
"<string> \"" << std::get<std::string>(
value) <<
"\"";
30 throw std::runtime_error(
"Invalid binary data attribute value type");
39 return std::holds_alternative<int>(
value);
45 return std::holds_alternative<double>(
value);
51 return std::holds_alternative<std::string>(
value);
Assertion macros and utilities based on the PPK_ASSERT library.
Protocol binary data types and attributes definitions.
#define IRSOL_ASSERT_ERROR
Error-level assertion macro.
std::variant< int, double, std::string > protocol_value_t
Variant type representing protocol values that can be one of several types.
Utility functions for protocol string handling and validation in the irsol library.
std::string identifier
Identifier of the binary data attribute.
std::string toString() const
Returns a string representation of the binary data attribute.
irsol::types::protocol_value_t value
Value associated with the attribute.
BinaryDataAttribute(const std::string &identifier, irsol::types::protocol_value_t value)
Constructs a BinaryDataAttribute.