56 static_assert(std::numeric_limits<float>::is_iec559,
"Your machine doesn't use IEEE 754 compliant single-precision floating point numbers.");
57 static_assert(
sizeof(
float)==4,
"sizeof(float)!=4 on your machine.");
58 static_assert(
sizeof(
double)==8,
"sizeof(double)!=8 on your machine.");
93 Value(uint16_t value);
96 Value(uint32_t value);
99 Value(uint64_t value);
105 Value(int16_t value);
108 Value(int32_t value);
111 Value(int64_t value);
123 Value(
const std::string& value);
126 Value(
const char* value);
129 Value(
const std::vector<uint8_t>& value);
133 Value(Type type_,
const std::vector<uint8_t>& data);
141 operator uint8_t()
const;
145 operator uint16_t()
const;
149 operator uint32_t()
const;
153 operator uint64_t()
const;
157 operator int8_t()
const;
161 operator int16_t()
const;
165 operator int32_t()
const;
169 operator int64_t()
const;
173 operator float()
const;
177 operator double()
const;
181 operator bool()
const;
185 operator std::string()
const;
189 operator std::vector<uint8_t>()
const;
204 static const bool debug =
false;
208 namespace value_printer {
210 std::ostream &operator<<(std::ostream &os, Value val);
218 using namespace kaco::value_printer;
bool operator!=(const Value &other) const
Compares not equal.
std::vector< uint8_t > get_bytes() const
Returns the byte representation (little-endian) as a vector.
std::string to_string() const
Returns the value as a printable string.
Value()
Constructs an invalid value.
Type type
Tyoe of the value.
bool operator==(const Value &other) const
Compares equal.
std::string string
The value if type==Type::string It's seperate because std::string is non-trivial and should not be pa...
This class contains a value to be stored in the object dictionary. The value can have one of the type...
std::vector< uint8_t > octet_string
The value if type==Type::octet_string It's seperate because std::vector is non-trivial and should not...