Hyperon C
Loading...
Searching...
No Matches
Serialization Interface

Interface to define behavior moving atoms between host languages and encoding atoms to stable representations. More...

Classes

struct  serial_result_t
 The result of a serialize operation reported by serializer. More...
struct  serializer_api_t
 A table of functions to receive values encoded as specific primitive types. More...

Functions

enum serial_result_t atom_gnd_serialize (const atom_ref_t *atom, const struct serializer_api_t *api, void *context)
 Serializes a grounded atom using the given serializer.

Detailed Description

Interface to define behavior moving atoms between host languages and encoding atoms to stable representations.

The serialization interface provides a mechanism to move and compare equivalent implementations of grounded atoms. For example, a Python int and a Rust i64 have some overlap in meaning. This interface provides the functionality to allows one to be transformed into the other.

In addition this interface lays the groundwork to support stable encodings needed to save grounded atoms to disk or send them over a network

Function Documentation

◆ atom_gnd_serialize()

enum serial_result_t atom_gnd_serialize ( const atom_ref_t * atom,
const struct serializer_api_t * api,
void * context )

Serializes a grounded atom using the given serializer.

Parameters
[in]atomA pointer to an atom_t or an atom_ref_t to serialize
[in]apiA table of functions the serialize implementation may call to encode the atom value
[in]contextA caller-defined object to pass to functions in the api, to receive the encoded value(s)
Returns
A serial_result_t indicating whether the serialize operation was successful