serial: convert b_serial_ctx to a b_object interface

This commit is contained in:
2025-10-28 15:20:57 +00:00
parent e63095c458
commit 2d29713f57
9 changed files with 225 additions and 145 deletions

View File

@@ -1,3 +1,46 @@
#include "serial.h"
#include <blue/serial/bitcode.h>
#include <blue/serial/ctx.h>
const struct b_serial_format_ops z__b_bitcode_format_ops = {};
/*** VIRTUAL FUNCTIONS ********************************************************/
static enum b_status bitcode_serialise(
b_serial_ctx *serial, b_object *src, b_stream *dest,
enum b_serial_flags flags)
{
return B_ERR_NOT_SUPPORTED;
}
static enum b_status bitcode_deserialise(
b_serial_ctx *serial, b_stream *src, b_object **dest,
enum b_serial_flags flags)
{
return B_ERR_NOT_SUPPORTED;
}
static void bitcode_serial_ctx_init(b_object *obj, void *priv)
{
}
static void bitcode_serial_ctx_fini(b_object *obj, void *priv)
{
}
/*** CLASS DEFINITION *********************************************************/
B_TYPE_CLASS_DEFINITION_BEGIN(b_bitcode_serial_ctx)
B_TYPE_CLASS_INTERFACE_BEGIN(b_object, B_TYPE_OBJECT)
B_INTERFACE_ENTRY(to_string) = NULL;
B_TYPE_CLASS_INTERFACE_END(b_object, B_TYPE_OBJECT)
B_TYPE_CLASS_INTERFACE_BEGIN(b_serial_ctx, B_TYPE_SERIAL_CTX)
B_INTERFACE_ENTRY(s_serialise) = bitcode_serialise;
B_INTERFACE_ENTRY(s_deserialise) = bitcode_deserialise;
B_TYPE_CLASS_INTERFACE_END(b_serial_ctx, B_TYPE_SERIAL_CTX)
B_TYPE_CLASS_DEFINITION_END(b_bitcode_serial_ctx)
B_TYPE_DEFINITION_BEGIN(b_bitcode_serial_ctx)
B_TYPE_ID(0xcdc8c462, 0xf2b3, 0x4193, 0x8cae, 0xc1e5ad9afcb8);
B_TYPE_CLASS(b_bitcode_serial_ctx_class);
B_TYPE_INSTANCE_INIT(bitcode_serial_ctx_init);
B_TYPE_INSTANCE_FINI(bitcode_serial_ctx_fini);
B_TYPE_DEFINITION_END(b_bitcode_serial_ctx)