|
Veritable Lasagna
An Allocator & Data Structure Library for C.
|
Include dependency graph for vl_msgpack.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | vl_msgpack |
| MessagePack Document Object Model. More... | |
Macros | |
| #define | VL_MSGPACK_ITER_INVALID VL_HASHTABLE_ITER_INVALID |
| #define | VL_MSGPACK_EXT_NONE -127 |
| #define | VL_MSGPACK_FOREACH_CHILD(packPtr, parentIter, childIterSymbol) |
| #define | vlMsgPackRoot(packPtr) ((packPtr)->root) |
| Macro to retrieve the root of the MessagePack DOM. | |
Typedefs | |
| typedef vl_hash_iter | vl_msgpack_iter |
Enumerations | |
| enum | vl_msgpack_type { VL_MSGPACK_NIL , VL_MSGPACK_BOOL , VL_MSGPACK_INT , VL_MSGPACK_UINT , VL_MSGPACK_FLOAT32 , VL_MSGPACK_FLOAT64 , VL_MSGPACK_STRING , VL_MSGPACK_BINARY , VL_MSGPACK_ARRAY , VL_MSGPACK_MAP , VL_MSGPACK_EXT } |
| All MessagePack Types. More... | |
Functions | |
| VL_API void | vlMsgPackInit (vl_msgpack *pack) |
| Initializes the specified MessagePack DOM. | |
| VL_API void | vlMsgPackFree (vl_msgpack *pack) |
| Frees the specified MessagePack DOM. | |
| VL_API vl_msgpack * | vlMsgPackNew (void) |
| Allocates and initializes a MessagePack DOM. | |
| VL_API void | vlMsgPackDelete (vl_msgpack *pack) |
| Deletes the specified MessagePack DOM. | |
| VL_API void | vlMsgPackClear (vl_msgpack *pack) |
| Clears the MessagePack DOM, resetting it for reuse. | |
| VL_API vl_msgpack * | vlMsgPackClone (vl_msgpack *src, vl_msgpack *dest) |
| Clones the specified MessagePack DOM to another. | |
| VL_API vl_msgpack_iter | vlMsgPackParent (vl_msgpack *pack, vl_msgpack_iter iter) |
| Retrieves the parent node of a given node in the MessagePack DOM. | |
| VL_API vl_dsidx_t | vlMsgPackTotalChildren (vl_msgpack *pack, vl_msgpack_iter iter) |
| Retrieves the total number of children of a given node. | |
| VL_API vl_msgpack_iter | vlMsgPackFirstChild (vl_msgpack *pack, vl_msgpack_iter iter) |
| Retrieves the first child of a given node. | |
| VL_API vl_msgpack_iter | vlMsgPackNextSibling (vl_msgpack *pack, vl_msgpack_iter iter) |
| Retrieves the next sibling of a given node. | |
| VL_API vl_msgpack_iter | vlMsgPackPrevSibling (vl_msgpack *pack, vl_msgpack_iter iter) |
| Retrieves the previous sibling of a given node. | |
| VL_API vl_msgpack_type | vlMsgPackType (vl_msgpack *pack, vl_msgpack_iter iter) |
| Retrieves the type of a given node in the MessagePack DOM. | |
| VL_API vl_int8_t | vlMsgPackExtType (vl_msgpack *pack, vl_msgpack_iter iter) |
| Retrieves the extension type of a MessagePack EXT node. | |
| VL_API vl_msgpack_iter | vlMsgPackInsertExt (vl_msgpack *pack, vl_msgpack_type type, vl_int8_t subType, vl_msgpack_iter parent, const void *keyPtr, vl_memsize_t keyLen, const void *dataPtr, vl_memsize_t dataLen) |
| Inserts a new element into the MessagePack DOM with an extended type. | |
| VL_API void | vlMsgPackRemove (vl_msgpack *pack, vl_msgpack_iter iter) |
| Removes an element from the MessagePack DOM. | |
| VL_API vl_msgpack_iter | vlMsgPackFindChild (vl_msgpack *pack, vl_msgpack_iter parent, const void *key, vl_memsize_t keyLen) |
| Finds a child element by key. | |
| VL_API vl_msgpack_iter | vlMsgPackFindChildIndexed (vl_msgpack *pack, vl_msgpack_iter iter, vl_dsidx_t idx) |
| Finds a child element by index. | |
| VL_API const vl_transient * | vlMsgPackSampleKey (vl_msgpack *pack, vl_msgpack_iter iter, vl_memsize_t *size) |
| Retrieves the key associated with an element. | |
| VL_API vl_transient * | vlMsgPackSampleValue (vl_msgpack *pack, vl_msgpack_iter iter, vl_memsize_t *size) |
| Retrieves the value associated with an element. | |
| struct vl_msgpack |
MessagePack Document Object Model.
An in-memory, hierarchical representation of a complete MessagePack.
This structure represents an N-Tree with parent-child relationships that accurately represents a MessagePack structure. It is implemented using a hierarchical hash table for nodes and parent-child relationships, using a separate arena allocator for node values. Nodes in this structure are dynamically typed.
The design of this structure is NOT completely compliant with the MessagePack spec. It requires the two following rules to be enforced:
All strings in and out of this structure, keys or values, are assumed to be UTF-8 encoded.
Collaboration diagram for vl_msgpack:| Data Fields | ||
|---|---|---|
| vl_hashtable | nodes | |
| vl_msgpack_iter | root | |
| vl_arena | values | |
| #define VL_MSGPACK_EXT_NONE -127 |
| #define VL_MSGPACK_FOREACH_CHILD | ( | packPtr, | |
| parentIter, | |||
| childIterSymbol | |||
| ) |
| #define VL_MSGPACK_ITER_INVALID VL_HASHTABLE_ITER_INVALID |
██ ██ ██ █████ ███████ █████ ██████ ███ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ███████ ███████ ███████ ██ ███ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ███████ ██ ██ ███████ ██ ██ ██████ ██ ████ ██ ██ ====—: A Data Structure and Algorithms library for C11. :—====
Copyright 2026 Jesse Walker, released under the MIT license. Git Repository: https://github.com/walkerje/veritable_lasagna
| #define vlMsgPackRoot | ( | packPtr | ) | ((packPtr)->root) |
Macro to retrieve the root of the MessagePack DOM.
This macro provides access to the root node of the DOM. The root node is always a map.
| packPtr | A pointer to the MessagePack DOM instance. |
| typedef vl_hash_iter vl_msgpack_iter |
| enum vl_msgpack_type |
All MessagePack Types.
| VL_API void vlMsgPackClear | ( | vl_msgpack * | pack | ) |
Clears the MessagePack DOM, resetting it for reuse.
This function resets the MessagePack DOM instance without deallocating memory. Previously allocated memory remains available for reuse, improving performance when repeatedly decoding into the same structure.
| pack | The MessagePack DOM instance to clear. |
Here is the call graph for this function:| VL_API vl_msgpack * vlMsgPackClone | ( | vl_msgpack * | src, |
| vl_msgpack * | dest | ||
| ) |
Clones the specified MessagePack DOM to another.
Clones the entirety of the src MessagePack to the dest MessagePack.
The 'src' DOM must be non-null and initialized. The 'dest' DOM may be null, but if it is not null it must be initialized.
If the 'dest' table pointer is null, a new DOM is created via vlMsgPackNew.
| src | source DOM pointer |
| dest | destination DOM pointer |
Here is the call graph for this function:| VL_API void vlMsgPackDelete | ( | vl_msgpack * | pack | ) |
Deletes the specified MessagePack DOM.
The specified MessagePack must have been initialized via vlMsgPackNew before calling this function.
pack pointer becomes invalid.NULL (due to internal free safety).| pack | pointer to DOM |
Here is the call graph for this function:| VL_API vl_int8_t vlMsgPackExtType | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Retrieves the extension type of a MessagePack EXT node.
| pack | The MessagePack DOM instance. |
| iter | The iterator pointing to the current node. |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API vl_msgpack_iter vlMsgPackFindChild | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | parent, | ||
| const void * | key, | ||
| vl_memsize_t | keyLen | ||
| ) |
Finds a child element by key.
This function searches for a child under the given parent node with a matching key.
| pack | The MessagePack DOM instance. |
| parent | The parent node to search in. |
| key | Pointer to the key data. |
| keyLen | Length of the key. |
Here is the call graph for this function:| VL_API vl_msgpack_iter vlMsgPackFindChildIndexed | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter, | ||
| vl_dsidx_t | idx | ||
| ) |
Finds a child element by index.
This function retrieves the indexed child from a parent container. The parent must be an array.
| pack | The MessagePack DOM instance. |
| iter | The parent node. |
| idx | The zero-based index of the child. |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API vl_msgpack_iter vlMsgPackFirstChild | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Retrieves the first child of a given node.
| pack | The MessagePack DOM instance. |
| iter | The iterator pointing to the current node. |
Here is the call graph for this function:| VL_API void vlMsgPackFree | ( | vl_msgpack * | pack | ) |
Frees the specified MessagePack DOM.
The specified MessagePack must have been initialized via vlMsgPackInit before calling this function.
pack structure remains but its internal data is invalid.pack must not be NULL.NULL. Calling on a pack that was not initialized.| pack | pointer to DOM |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API void vlMsgPackInit | ( | vl_msgpack * | pack | ) |
Initializes the specified MessagePack DOM.
pack memory.pack remains valid until vlMsgPackFree.pack instance.pack must not be NULL.NULL. Initializing an already initialized pack without freeing it.| pack | pointer to DOM |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API vl_msgpack_iter vlMsgPackInsertExt | ( | vl_msgpack * | pack, |
| vl_msgpack_type | type, | ||
| vl_int8_t | subType, | ||
| vl_msgpack_iter | parent, | ||
| const void * | keyPtr, | ||
| vl_memsize_t | keyLen, | ||
| const void * | dataPtr, | ||
| vl_memsize_t | dataLen | ||
| ) |
Inserts a new element into the MessagePack DOM with an extended type.
This function inserts an element of the specified MessagePack type and optional extended type under a given parent node. The key and value are copied into the internal storage, allowing external memory to be safely freed after insertion.
| pack | The MessagePack DOM instance. |
| type | The type of the inserted element. |
| subType | The extended type (used for MessagePack ext types). |
| parent | The parent node where the element is inserted. |
| keyPtr | Pointer to the key data. |
| keyLen | Length of the key. |
| dataPtr | Pointer to the value data. |
| dataLen | Length of the value. |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API vl_msgpack * vlMsgPackNew | ( | void | ) |
Allocates and initializes a MessagePack DOM.
The returned pointer is to be deleted via vlMsgPackDelete.
vl_msgpack pointer and is responsible for calling vlMsgPackDelete.vlMsgPackDelete.NULL if allocation fails.NULL on heap allocation failure.vl_msgpack structure and its internal data on the heap.NULL on failure.
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API vl_msgpack_iter vlMsgPackNextSibling | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Retrieves the next sibling of a given node.
| pack | The MessagePack DOM instance. |
| iter | The iterator pointing to the current node. |
Here is the call graph for this function:| VL_API vl_msgpack_iter vlMsgPackParent | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Retrieves the parent node of a given node in the MessagePack DOM.
| pack | The MessagePack DOM instance. |
| iter | The iterator pointing to the current node. |
Here is the call graph for this function:| VL_API vl_msgpack_iter vlMsgPackPrevSibling | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Retrieves the previous sibling of a given node.
| pack | The MessagePack DOM instance. |
| iter | The iterator pointing to the current node. |
Here is the call graph for this function:| VL_API void vlMsgPackRemove | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Removes an element from the MessagePack DOM.
This function removes the specified element and all its children from the DOM. Memory may be reused depending on the allocator's behavior.
| pack | The MessagePack DOM instance. |
| iter | Iterator pointing to the element to be removed. |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API const vl_transient * vlMsgPackSampleKey | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter, | ||
| vl_memsize_t * | size | ||
| ) |
Retrieves the key associated with an element.
This function returns a pointer to the key data of the given element. The key may move if modifications occur in the DOM, so users should not store this pointer for long-term access.
| pack | The MessagePack DOM instance. |
| iter | The element iterator. |
| size | Pointer to receive the key size (optional, can be NULL). |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API vl_transient * vlMsgPackSampleValue | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter, | ||
| vl_memsize_t * | size | ||
| ) |
Retrieves the value associated with an element.
This function returns a pointer to the value data of the given element. The value may move if modifications occur in the DOM, so users should not store this pointer for long-term access.
| pack | The MessagePack DOM instance. |
| iter | The element iterator. |
| size | Pointer to receive the value size (optional, can be NULL). |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API vl_dsidx_t vlMsgPackTotalChildren | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Retrieves the total number of children of a given node.
| pack | The MessagePack DOM instance. |
| iter | The iterator pointing to the current node. |
Here is the call graph for this function:| VL_API vl_msgpack_type vlMsgPackType | ( | vl_msgpack * | pack, |
| vl_msgpack_iter | iter | ||
| ) |
Retrieves the type of a given node in the MessagePack DOM.
| pack | The MessagePack DOM instance. |
| iter | The iterator pointing to the current node. |
Here is the call graph for this function:
Here is the caller graph for this function: