15#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
57#if __STDC_VERSION__ >= 202311L
68#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
86#if __STDC_VERSION__ >= 202311L
97#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
155#if __STDC_VERSION__ >= 202311L
166#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
188#if __STDC_VERSION__ >= 202311L
330 uintptr_t message_index,
332 uint8_t max_resets_per_frame,
333 bool has_max_resets_per_frame,
370 uintptr_t message_index,
391 uintptr_t value_count,
424 const uint8_t *frame,
436 uintptr_t *message_index,
475#ifndef PREDSYNC_GENERATED_MESSAGES_H
476#define PREDSYNC_GENERATED_MESSAGES_H
PredsyncStatus predsync_decoded_info(const struct PredsyncDecoded *decoded, uintptr_t *message_index, uint32_t *missed, uint8_t *resynced)
Read the message index, missed-frame count and resync flag from a decoded frame.
PredsyncStatus predsync_decoded_field_count(const struct PredsyncDecoded *decoded, uintptr_t *out)
Return the number of decoded fields.
struct PredsyncSet PredsyncSet
Opaque handle to a validated schema set.
Definition predsync.h:218
PredsyncStatus demo_telemetry_unpack(const PredsyncValue *values, size_t len, DemoTelemetry *out)
Fill a typed message from engine values.
PredsyncStatus predsync_encoder_new_with_registry(const struct PredsyncSet *set, const struct PredsyncRegistry *registry, uintptr_t message_index, uint64_t tick_ns, uint8_t max_resets_per_frame, bool has_max_resets_per_frame, struct PredsyncEncoder **out)
Construct an encoder using an explicit runtime registry.
PredsyncStatus demo_telemetry_pack(const DemoTelemetry *msg, PredsyncValue *out, size_t cap, size_t *out_len, uint64_t *scratch, size_t scratch_cap)
Convert a typed message into engine values.
PredsyncStatus predsync_decoder_free(struct PredsyncDecoder *decoder)
Free a decoder handle.
struct PredsyncRegistry * predsync_registry_new(void)
Create an empty explicit predictor registry.
PredsyncScalarKind
The schema scalar carried by a PredsyncValue.
Definition predsync.h:100
@ U64
Unsigned 64-bit integer.
Definition predsync.h:124
@ Enum
A schema enum variant index.
Definition predsync.h:152
@ U8
Unsigned 8-bit integer.
Definition predsync.h:112
@ Bool
Boolean.
Definition predsync.h:108
@ F64
64-bit float.
Definition predsync.h:148
@ U32
Unsigned 32-bit integer.
Definition predsync.h:120
@ I32
Signed 32-bit integer.
Definition predsync.h:136
@ I8
Signed 8-bit integer.
Definition predsync.h:128
@ I16
Signed 16-bit integer.
Definition predsync.h:132
@ F32
32-bit float.
Definition predsync.h:144
@ I64
Signed 64-bit integer.
Definition predsync.h:140
@ None
No scalar type (used when the value is not scalar).
Definition predsync.h:104
@ U16
Unsigned 16-bit integer.
Definition predsync.h:116
struct PredsyncRegistry PredsyncRegistry
Opaque handle to an explicit runtime predictor registry.
Definition predsync.h:213
PredsyncStatus predsync_decoder_new(const struct PredsyncSet *set, uint8_t resync_n, struct PredsyncDecoder **out)
Construct a decoder for one incoming stream.
PredsyncValueKind
Which representation a PredsyncValue carries.
Definition predsync.h:71
@ Str
UTF-8 bytes at ptr with length len.
Definition predsync.h:79
@ List
Slot bits at ptr with element count len.
Definition predsync.h:83
@ Scalar
An eight-byte scalar in scalar.
Definition predsync.h:75
void predsync_registry_free(struct PredsyncRegistry *registry)
Free a predictor registry.
PredsyncStatus predsync_decoded_field(const struct PredsyncDecoded *decoded, uintptr_t index, PredsyncValidity *validity, struct PredsyncValue *value)
Copy one decoded field into a caller-provided value buffer.
PredsyncStatus
Status returned by every C entry point.
Definition predsync.h:18
@ Ok
The operation succeeded.
Definition predsync.h:22
@ DecodeError
Decoding failed; see the error code output.
Definition predsync.h:50
@ InvalidHandle
A handle was not usable.
Definition predsync.h:34
@ NullPointer
A required pointer was null.
Definition predsync.h:26
@ Panic
A panic was caught at the C boundary.
Definition predsync.h:54
@ InvalidSchema
The supplied schema text was not valid.
Definition predsync.h:30
@ InvalidValue
A value did not match its schema type.
Definition predsync.h:42
@ BufferTooSmall
A caller-provided buffer was too small.
Definition predsync.h:38
@ EncodeError
Encoding failed; see the error code output.
Definition predsync.h:46
struct PredsyncEncoder PredsyncEncoder
Opaque handle to one message encoder.
Definition predsync.h:208
PredsyncStatus predsync_registry_register_model(struct PredsyncRegistry *registry, const char *name, void *ctx, PredsyncModelReset reset, PredsyncModelUpdate update, PredsyncModelPredict predict, PredsyncModelStateHash state_hash)
Register a C callback custom predictor model in an explicit registry.
PredsyncStatus predsync_set_from_yaml(const char *yaml, uintptr_t len, struct PredsyncSet **out)
Parse a schema set from UTF-8 YAML and return an owned opaque handle.
PredsyncValidity
The trust state of a decoded field.
Definition predsync.h:169
@ Predicted
Supplied by the receiver's predictor.
Definition predsync.h:177
@ ReSync
A refresh disagreed with the receiver's prediction.
Definition predsync.h:185
@ Unknown
No trustworthy value is available.
Definition predsync.h:181
@ Valid
Received or checked this frame.
Definition predsync.h:173
int32_t(*) PredsyncModelPredict(void *ctx, uint64_t t, double *out)
Definition predsync.h:231
PredsyncStatus predsync_decode_feed(struct PredsyncDecoder *decoder, const uint8_t *frame, uintptr_t frame_len, struct PredsyncDecoded **out, uint32_t *error)
Feed one frame to a decoder and return an owned decoded-frame handle.
uint64_t(*) PredsyncModelStateHash(void *ctx)
Definition predsync.h:233
PredsyncStatus predsync_encoder_new(const struct PredsyncSet *set, uintptr_t message_index, uint64_t tick_ns, uint16_t max_resets, struct PredsyncEncoder **out)
Construct an encoder for one message in a schema set.
int32_t(*) PredsyncModelUpdate(void *ctx, uint64_t t, double x)
Definition predsync.h:229
PredsyncStatus predsync_set_free(struct PredsyncSet *set)
Free a schema-set handle.
DemoTelemetryMode
Generated enum for schema enum Mode.
Definition predsync.h:485
@ DEMO_TELEMETRY_MODE_IDLE
Definition predsync.h:486
@ DEMO_TELEMETRY_MODE_FAULT
Definition predsync.h:488
@ DEMO_TELEMETRY_MODE_ACTIVE
Definition predsync.h:487
PredsyncStatus predsync_decoder_new_with_registry(const struct PredsyncSet *set, const struct PredsyncRegistry *registry, uint8_t resync_n, struct PredsyncDecoder **out)
Construct a decoder using an explicit runtime registry.
PredsyncStatus predsync_decoded_free(struct PredsyncDecoded *decoded)
Free a decoded-frame handle.
PredsyncStatus predsync_encode(struct PredsyncEncoder *encoder, const struct PredsyncValue *values, uintptr_t value_count, uint64_t now_ns, uint8_t *out, uintptr_t out_cap, uintptr_t *out_len, struct PredsyncEncodeInfo *info, uint32_t *error)
Encode one frame into a caller-provided buffer.
struct PredsyncDecoded PredsyncDecoded
Opaque handle to one fully decoded frame.
Definition predsync.h:198
void(*) PredsyncModelReset(void *ctx)
C callback signature for a runtime custom predictor model.
Definition predsync.h:227
struct PredsyncDecoder PredsyncDecoder
Opaque handle to one incoming stream decoder.
Definition predsync.h:203
PredsyncStatus predsync_encoder_free(struct PredsyncEncoder *encoder)
Free an encoder handle.
Fixed-capacity message struct for schema message telemetry.
Definition predsync.h:492
double field_x
Definition predsync.h:493
DemoTelemetryMode field_mode
Definition predsync.h:494
size_t field_samples_len
Definition predsync.h:498
size_t field_label_len
Definition predsync.h:496
uint16_t field_samples[4]
Definition predsync.h:497
char field_label[17]
Definition predsync.h:495
Counts from one successful encode.
Definition predsync.h:268
uintptr_t len
Number of bytes written.
Definition predsync.h:272
uint8_t n_included
Fields sent verbatim.
Definition predsync.h:280
uint8_t n_reset
Fields sent as resets.
Definition predsync.h:276
uint8_t n_refresh
Fields sent as refreshes.
Definition predsync.h:288
uint8_t n_predicted
Fields omitted because the receiver can predict them.
Definition predsync.h:284
One value crossing the C boundary.
Definition predsync.h:238
uint64_t scalar
Slot bits for a scalar value.
Definition predsync.h:250
PredsyncScalarKind element
The scalar or list-element type.
Definition predsync.h:246
const void * ptr
Borrowed bytes for strings, or slot bits for lists.
Definition predsync.h:254
uintptr_t cap
Caller-provided capacity in bytes.
Definition predsync.h:262
PredsyncValueKind kind
Which representation is present.
Definition predsync.h:242
uintptr_t len
Byte count for strings, element count for lists.
Definition predsync.h:258