Generic Values¶
A generic interface for reading and writing binary values.
-
EXESS_ALIGN¶
Attribute to align a buffer for any supported value.
-
EXESS_MAX_FIXED_SIZE¶
12U
The maximum size of a supported fixed-size value in bytes.
-
ExessOrder exess_compare_value(ExessDatatype lhs_datatype, size_t lhs_size, const void *lhs_value, ExessDatatype rhs_datatype, size_t rhs_size, const void *rhs_value)¶
Compare two values.
- Returns:
Less than, equal to, or greater than zero if the left-hand value is less than, equal to, or greater than the right-hand value, respectively. Comparable and incomparable cases may also be distinguished, see
ExessOrderfor details.
-
ExessVariableResult exess_read_value(ExessDatatype datatype, const char *str, size_t out_size, void *out)¶
Read any supported datatype from a string.
Note that
outmust be suitably aligned for the datatype being read, it will be dereferenced directly as a pointer to the value type. A 64-bit aligned buffer will be suitably aligned for any datatype.- Parameters:
str – String to read.
datatype – Datatype to read the string as.
out_size – Size of
outin bytes.out – Parsed value on success.
- Returns:
The
read_countfromstr,write_counttoout(both in bytes), and astatus.
-
ExessResult exess_write_value(ExessDatatype datatype, size_t value_size, const void *value, size_t buf_size, char *buf)¶
Write any supported datatype to a canonical string.
Note that
valuemust be suitably aligned for the datatype being written, it will be dereferenced directly as a pointer to the value type. A 64-bit aligned buffer will be suitably aligned for any datatype.- Parameters:
datatype – Datatype of
value.value_size – Size of
valuein bytes.value – Value to write.
buf_size – Size of
bufin bytes.buf – Output buffer, or null to only measure.
- Returns:
The
countof characters in the output, and astatus(ExessStatus.EXESS_SUCCESS, orExessStatus.EXESS_NO_SPACEif the buffer is too small).