APIs for writing (i.e. packing) data into a dynamic buffer. More...
|gos_result_t||gos_msgpack_buffered_writer_init (gos_msgpack_context_t **context_ptr, uint32_t initial_length)|
|gos_result_t||gos_msgpack_buffered_writer_deinit (gos_msgpack_context_t *context, bool free_buffer)|
|gos_result_t||gos_msgpack_buffered_writer_get_buffer (const gos_msgpack_context_t *context, gos_buffer_t *buffer)|
APIs for writing (i.e. packing) data into a dynamic buffer.
|gos_result_t gos_msgpack_buffered_writer_deinit||(||gos_msgpack_context_t *||
De-allocate buffered msgpack writer context
This de-allocates the memory allocated by gos_msgpack_buffered_writer_init()
This will also optionally de-allocated the internal buffer. If the internal buffer is NOT de-allocated (e.g.
free_buffer = false), then gos_msgpack_buffered_writer_get_buffer() should FIRST be used to retrieve a reference to the internal buffer.
Then at a later point, gos_free() should be used to de-allocate the returned
Buffered msgpack writer context to de-allocated [in]
If true also de-allocate internal buffer, if false internal buffer is NOT de-allocated.
|gos_result_t gos_msgpack_buffered_writer_get_buffer||(||const gos_msgpack_context_t *||
Retrieve internal buffer of buffered msgpack writer context
This retrieves the internal buffer used by a buffered msgpack writer. The
buffer.data points to the allocated buffer. The
buffer.size is the total amount of data written to the buffer.
Buffered msgpack writer context [out]
gos_buffer_t to populate with internal buffer
|gos_result_t gos_msgpack_buffered_writer_init||(||gos_msgpack_context_t **||
Initialize buffered msgpack writer context
This initializes a buffered msgpack writer context. Once initialized, the Write APIs may be used to populate msgpack data into the returned gos_msgpack_context_t While writing data, the internal buffer will automatically be increased as necessary.
Once all the data is populated, use gos_msgpack_buffered_writer_get_buffer() to retrieve the populated buffer.
Pointer to hold allocated gos_msgpack_context_t [in]
Initial length of internal buffer, this will increase as needed
- gos_result_t, result of API