Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
sol_memdesc_ops_array Struct Reference

Operations specific to SOL_MEMDESC_TYPE_ARRAY. More...

#include <sol-memdesc.h>

Data Fields

uint16_t api_version
 API version, must match SOL_MEMDESC_OPS_ARRAY_API_VERSION at runtime. More...
 
void *(* get_element )(const struct sol_memdesc *desc, const void *memory, size_t idx)
 get memory of the given array item. More...
 
ssize_t(* get_length )(const struct sol_memdesc *desc, const void *memory)
 calculate array length. More...
 
int(* resize )(const struct sol_memdesc *desc, void *memory, size_t length)
 resize array length. More...
 

Detailed Description

Operations specific to SOL_MEMDESC_TYPE_ARRAY.

This provides array-specific operations to use when dealing with a memory description.

See Also
struct sol_memdesc_ops
struct sol_memdesc

Field Documentation

uint16_t sol_memdesc_ops_array::api_version

API version, must match SOL_MEMDESC_OPS_ARRAY_API_VERSION at runtime.

void*(* sol_memdesc_ops_array::get_element)(const struct sol_memdesc *desc, const void *memory, size_t idx)

get memory of the given array item.

Will be used to get the array element by its index. Return should be the memory pointer or NULL on error (then set errno accordingly).

Note
must be provided if type is SOL_MEMDESC_TYPE_ARRAY.
See Also
sol_memdesc_get_array_element()
ssize_t(* sol_memdesc_ops_array::get_length)(const struct sol_memdesc *desc, const void *memory)

calculate array length.

Will be used to calculate the array length. Return should be number of items, each defined in struct sol_memdesc::array_item.

Note
must be provided if type is SOL_MEMDESC_TYPE_ARRAY.

On error, negative errno is returned.

See Also
sol_memdesc_get_array_length()
int(* sol_memdesc_ops_array::resize)(const struct sol_memdesc *desc, void *memory, size_t length)

resize array length.

Will be used to resize the array length. The given size should be number of items, each defined in struct sol_memdesc::array_item.

When implementing, always remember to free the items that are not needed anymore when the new length is smaller than the old. Failing to do so will lead to memory leaks.

Note
must be provided if type is SOL_MEMDESC_TYPE_ARRAY.

On error, negative errno is returned.

See Also
sol_memdesc_resize_array()

The documentation for this struct was generated from the following file: