.TH "ttypt/corm.h" 3 "corm" \" -*- nroff -*- .ad l .nh .SH NAME ttypt/corm.h \- Public header for the Corm library\&. .SH SYNOPSIS .br .PP \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include '\&./cormr\&.h'\fP .br .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBcorm_record_field_t\fP" .br .RI "Describes a single field in a record layout\&. " .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBCM_MISS\fP ((uint32_t)\-1)" .br .RI "Sentinel value for "not found" or error conditions\&. " .ti -1c .RI "#define \fBCM_RECORD_MASK\fP 0x0000FF00u" .br .RI "Macro and mask for record-aware maps\&. " .ti -1c .RI "#define \fBCM_REFERENCE\fP 6" .br .RI "Record field type constants\&. " .ti -1c .RI "#define \fBCM_MULTI_REFERENCE\fP 7" .br .ti -1c .RI "#define \fBCM_VSTR\fP 8" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef void \fBcorm_assoc_t\fP(const void **skey, const void *const pkey, const void *const value, void *userdata)" .br .RI "Association callback type\&. " .ti -1c .RI "typedef size_t \fBcorm_assoc_multi_t\fP(const void **skeys, size_t max_skeys, const void *pkey, const void *value, void *userdata)" .br .RI "Multi-key association callback type\&. " .ti -1c .RI "typedef size_t \fBcorm_measure_t\fP(const void *data)" .br .RI "Callback to measure variable-size keys\&. " .ti -1c .RI "typedef int \fBcorm_cmp_t\fP(const void *const a, const void *const b, size_t len)" .br .RI "Comparison callback type\&. " .ti -1c .RI "typedef \fBcorm_record_field_t\fP \fBcorm_field_t\fP" .br .RI "Concise aliases for record schema operations\&. " .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBcorm_flags\fP { \fBCM_AINDEX\fP = 1, \fBCM_MIRROR\fP = 2, \fBCM_PGET\fP = 4, \fBCM_SORTED\fP = 8, \fBCM_MULTIVALUE\fP = 16, \fBCM_NOGROW\fP = 32 }" .br .RI "Corm flags\&. " .ti -1c .RI "enum \fBcorm_tbi\fP { \fBCM_PTR\fP = 0, \fBCM_HNDL\fP = 1, \fBCM_STR\fP = 2, \fBCM_U32\fP = 3 }" .br .RI "Built-in type identifiers\&. " .ti -1c .RI "enum \fBcorm_if\fP { \fBCM_RANGE\fP = 1, \fBCM_RANGE_GE\fP = 2 }" .br .RI "Iterator flags\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "uint32_t \fBcorm_open\fP (const char *filename, const char *database, uint32_t ktype, uint32_t vtype, uint32_t mask, uint32_t flags)" .br .RI "Open a database\&. " .ti -1c .RI "uint32_t \fBcorm_get_vtype\fP (uint32_t hd)" .br .RI "Returns the value type (vtype) of a map\&. " .ti -1c .RI "uint32_t \fBcorm_get_ktype\fP (uint32_t hd)" .br .RI "Returns the key type (ktype) of a map\&. " .ti -1c .RI "size_t \fBcorm_type_len\fP (uint32_t type_id)" .br .RI "Returns the fixed length of a type, or 0 if variable\&. " .ti -1c .RI "void \fBcorm_save\fP (void)" .br .RI "Write all file-backed maps to disk\&. " .ti -1c .RI "void \fBcorm_close\fP (uint32_t hd)" .br .RI "Close a map and free its resources\&. " .ti -1c .RI "const void * \fBcorm_get\fP (uint32_t hd, const void *const key)" .br .RI "Retrieve a value by key\&. " .ti -1c .RI "void \fBcorm_get_copy\fP (uint32_t hd, const void *const key, void *dst)" .br .RI "Copy a value into a caller buffer\&. " .ti -1c .RI "int \fBcorm_read\fP (uint32_t hd, const void *const key, void *dst, size_t max_sz)" .br .RI "Non-aborting safe record retrieval with guaranteed zero-initialization\&. " .ti -1c .RI "uint32_t \fBcorm_put\fP (uint32_t hd, const void *const key, const void *const value)" .br .RI "Insert or update a pair\&. " .ti -1c .RI "void \fBcorm_del\fP (uint32_t hd, const void *const key)" .br .RI "Delete an entry by key\&. " .ti -1c .RI "void \fBcorm_del_all\fP (uint32_t hd, const void *const key)" .br .RI "Delete all entries with the specified key\&. " .ti -1c .RI "int \fBcorm_del_value\fP (uint32_t hd, const void *const key, const void *const value)" .br .RI "Delete the first entry with this key whose value matches\&. " .ti -1c .RI "void \fBcorm_drop\fP (uint32_t hd)" .br .RI "Remove all entries from a map\&. " .ti -1c .RI "void \fBcorm_assoc\fP (uint32_t hd, uint32_t link, \fBcorm_assoc_t\fP cb, void *userdata)" .br .RI "Make an association between tables\&. " .ti -1c .RI "void \fBcorm_assoc_multi\fP (uint32_t hd, uint32_t link, \fBcorm_assoc_multi_t\fP cb, void *userdata)" .br .RI "Make a multi-key association between tables\&. " .ti -1c .RI "uint32_t \fBcorm_iter\fP (uint32_t hd, const void *const key, uint32_t flags)" .br .RI "Start iteration\&. " .ti -1c .RI "int \fBcorm_next\fP (const void **key, const void **value, uint32_t cur_id)" .br .RI "Fetch next key/value\&. " .ti -1c .RI "int \fBcorm_next_copy\fP (void *key, void *value, uint32_t cur_id)" .br .RI "Fetch next key/value, copied into caller buffers\&. " .ti -1c .RI "void \fBcorm_fin\fP (uint32_t cur_id)" .br .RI "End iteration early\&. " .ti -1c .RI "uint32_t \fBcorm_get_multi\fP (uint32_t hd, const void *key)" .br .RI "Start iteration over all values for a key\&. " .ti -1c .RI "uint32_t \fBcorm_count\fP (uint32_t hd, const void *key)" .br .RI "Count entries matching a key\&. " .ti -1c .RI "uint32_t \fBcorm_reg\fP (size_t len)" .br .RI "Register a fixed-length type\&. " .ti -1c .RI "void \fBcorm_cmp_set\fP (uint32_t ref, \fBcorm_cmp_t\fP *cmp)" .br .RI "Assign comparison function to a type\&. " .ti -1c .RI "uint32_t \fBcorm_mreg\fP (\fBcorm_measure_t\fP *measure)" .br .RI "Register a variable-length type\&. " .ti -1c .RI "uint32_t \fBcorm_blob_type\fP (void)" .br .RI "Canonical measured type for length-prefixed binary blobs (uint32_t len + data)\&. " .ti -1c .RI "size_t \fBcorm_len\fP (uint32_t type_id, const void *data)" .br .RI "Get the byte length of an element\&. " .ti -1c .RI "uint32_t \fBcorm_record_register\fP (const char *name, size_t struct_size, const \fBcorm_record_field_t\fP *fields, size_t field_count)" .br .RI "Register a record layout describing a C struct\&. " .ti -1c .RI "uint32_t \fBcorm_record_type_id\fP (uint32_t record_id)" .br .RI "Get the struct type ID registered for a record\&. " .ti -1c .RI "const char * \fBcorm_get_key\fP (uint32_t hd, uint32_t pos)" .br .RI "Get the string key at a given position number\&. " .ti -1c .RI "uint32_t \fBcorm_pos\fP (uint32_t hd, const char *key)" .br .RI "Get the position number for a given key string\&. " .ti -1c .RI "size_t \fBcorm_inv_get\fP (uint32_t hd, const char *field_name, uint32_t target_pos, uint32_t *out, size_t max)" .br .RI "Query the inverse index for a reference field\&. " .ti -1c .RI "void \fBcorm_record_field_set_target_hd\fP (uint32_t record_id, const char *field_name, uint32_t target_hd)" .br .RI "Set the target head handle for reference resolution\&. " .ti -1c .RI "uint32_t \fBcorm_field_put\fP (uint32_t hd, const char *item_id, const char *field_name, const char *value)" .br .RI "Put a field value into a record-aware map, auto-resolving references when the field is CM_REFERENCE / CM_MULTI_REFERENCE and target_hd is set\&. " .ti -1c .RI "const char * \fBcorm_field_get\fP (uint32_t hd, const char *item_id, const char *field_name)" .br .RI "Get a field value from a record-aware map, auto-resolving references when the field is CM_REFERENCE\&. " .ti -1c .RI "void \fBcorm_htok_set_tok_decoder\fP (corm_htok_tok_decoder_fn fn)" .br .RI "Register an optional token decoder callback for HTOK token-packed fields\&. " .ti -1c .RI "int \fBcorm_htok_pack\fP (const char *json_str, size_t json_len, uint8_t **out_bytes, size_t *out_len)" .br .RI "Pack a JSON string representation of a memory envelope into HTOK v4 binary bytes\&. " .ti -1c .RI "int \fBcorm_htok_unpack\fP (const uint8_t *bytes, size_t len, char **out_json, size_t *out_json_len)" .br .RI "Unpack an HTOK v4 binary buffer into a clean JSON string representation\&. " .in -1c .SH "Detailed Description" .PP Public header for the Corm library\&. Declares the API for Corm — associative containers with optional persistence, mirror maps and sorted iteration\&. .SH "Macro Definition Documentation" .PP .SS "#define CM_MISS ((uint32_t)\-1)" .PP Sentinel value for "not found" or error conditions\&. Returned by \fBcorm_reg()\fP, \fBcorm_mreg()\fP when type limit is reached, and used internally to indicate missing entries\&. Equal to UINT32_MAX\&. .SH "Author" .PP Generated automatically by Doxygen for corm from the source code\&.