kw_add_binary_type()
#
Registers a new binary type for serialization and deserialization in the kw system. kw_add_binary_type()
associates a binary field with its serialized representation and provides functions for handling reference counting.
Prototype
int kw_add_binary_type(
const char *binary_field_name,
const char *serialized_field_name,
serialize_fn_t serialize_fn,
deserialize_fn_t deserialize_fn,
incref_fn_t incref_fn,
decref_fn_t decref_fn
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The name of the binary field to be registered. |
|
|
The name of the corresponding serialized field. |
|
|
Function pointer for serializing the binary field. |
|
|
Function pointer for deserializing the binary field. |
|
|
Function pointer for incrementing the reference count of the binary field. |
|
|
Function pointer for decrementing the reference count of the binary field. |
Return Value
Returns 0
on success, or -1
if the maximum number of serialized fields has been reached.
Notes
The function maintains an internal table of registered binary types. If the table is full, an error is logged, and the function returns -1
.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples