|
Soletta™ Framework
|
Soletta vector is an array that grows dynamically. More...
Data Structures | |
| struct | sol_vector |
| Soletta vector is an array that grows dynamically. More... | |
Macros | |
| #define | SOL_VECTOR_FOREACH_IDX(vector, itrvar, idx) |
| Macro to iterate over the vector easily. More... | |
| #define | SOL_VECTOR_FOREACH_IDX_UNTIL(vector, itrvar, idx, until) |
| Macro to iterate over the vector until a index. More... | |
| #define | SOL_VECTOR_FOREACH_REVERSE_IDX(vector, itrvar, idx) |
| Macro to iterate over the vector easily in the reverse order. More... | |
| #define | SOL_VECTOR_INIT(TYPE) { NULL, 0, sizeof(TYPE) } |
Helper macro to initialize a sol_vector structure to hold elements of type TYPE. More... | |
Typedefs | |
| typedef struct sol_vector | sol_vector |
| Soletta vector is an array that grows dynamically. More... | |
Functions | |
| void * | sol_vector_append (struct sol_vector *v) |
| Append an element to the end of the vector. More... | |
| void * | sol_vector_append_n (struct sol_vector *v, uint16_t n) |
Append n elements to the end of the vector. More... | |
| void | sol_vector_clear (struct sol_vector *v) |
| Delete all elements from the vector. More... | |
| int | sol_vector_del (struct sol_vector *v, uint16_t i) |
| Remove an element from the vector. More... | |
| int | sol_vector_del_element (struct sol_vector *v, const void *elem) |
| Remove an element from the vector. More... | |
| static int | sol_vector_del_last (struct sol_vector *v) |
| Remove the last element from the vector. More... | |
| int | sol_vector_del_range (struct sol_vector *v, uint16_t start, uint16_t len) |
| Remove an range of element from the vector. More... | |
| static void * | sol_vector_get (const struct sol_vector *v, uint16_t i) |
| Return the element of the vector at the given index. More... | |
| static void * | sol_vector_get_no_check (const struct sol_vector *v, uint16_t i) |
| Return the element of the vector at the given index (no safety checks). More... | |
| void | sol_vector_init (struct sol_vector *v, uint16_t elem_size) |
Initializes a sol_vector structure. More... | |
| static void * | sol_vector_steal_data (struct sol_vector *v) |
| Steal the memory holding the elements of the vector. More... | |
Soletta vector is an array that grows dynamically.
It's suited for storing a small set of contiguous data.
| #define SOL_VECTOR_FOREACH_IDX | ( | vector, | |
| itrvar, | |||
| idx | |||
| ) |
Macro to iterate over the vector easily.
| vector | The vector to iterate over |
| itrvar | Variable pointing to the current element's data on each iteration |
| idx | Index integer variable that is increased while iterating |
Referenced by _on_network_event(), create_access_control_obj(), create_location_obj(), create_post_data_params(), create_security_obj(), create_server_obj(), found_resource(), found_resource_print(), location_changed_cb(), read_access_control_obj(), shutdown_server(), write_access_control_tlv(), write_security_tlv(), and write_server_tlv().
| #define SOL_VECTOR_FOREACH_IDX_UNTIL | ( | vector, | |
| itrvar, | |||
| idx, | |||
| until | |||
| ) |
Macro to iterate over the vector until a index.
| vector | The vector to iterate over |
| itrvar | Variable pointing to the current element's data on each iteration |
| idx | Index integer variable that is increased while iterating |
| until | The index that the iteration should stop |
| #define SOL_VECTOR_FOREACH_REVERSE_IDX | ( | vector, | |
| itrvar, | |||
| idx | |||
| ) |
Macro to iterate over the vector easily in the reverse order.
| vector | The vector to iterate over |
| itrvar | Variable pointing to the current element's data on each iteration |
| idx | Index integer variable that is decreased while iterating |
| #define SOL_VECTOR_INIT | ( | TYPE | ) | { NULL, 0, sizeof(TYPE) } |
Helper macro to initialize a sol_vector structure to hold elements of type TYPE.
| typedef struct sol_vector sol_vector |
Soletta vector is an array that grows dynamically.
For storing pointers, see sol_ptr_vector.
| void* sol_vector_append | ( | struct sol_vector * | v | ) |
Append an element to the end of the vector.
Creates a new element in end of the vector and returns a pointer to it.
| v | Vector pointer |
Referenced by on_can_read(), read_access_control_obj(), write_access_control_res(), and write_or_create_acl().
| void* sol_vector_append_n | ( | struct sol_vector * | v, |
| uint16_t | n | ||
| ) |
Append n elements to the end of the vector.
Creates n new elements in end of the vector and returns a pointer to the first of the n elements.
| v | Vector pointer |
| n | Number of elements to be appended |
n elements appended| void sol_vector_clear | ( | struct sol_vector * | v | ) |
Delete all elements from the vector.
And frees the memory allocated for them. The vector returns to the initial state (empty).
| v | Vector pointer |
Referenced by create_access_control_obj(), create_post_data_params(), del_access_control_obj(), read_access_control_obj(), shutdown_server(), sol_ptr_vector_clear(), write_access_control_res(), and write_access_control_tlv().
| int sol_vector_del | ( | struct sol_vector * | v, |
| uint16_t | i | ||
| ) |
Remove an element from the vector.
Removes the element of index i from the vector.
| v | Vector pointer |
| i | Index of the element to remove |
0 on success, error code (always negative) otherwiseReferenced by on_can_write(), sol_ptr_vector_del(), and sol_vector_del_last().
| int sol_vector_del_element | ( | struct sol_vector * | v, |
| const void * | elem | ||
| ) |
Remove an element from the vector.
Removes the element pointed by elem from the vector.
| v | Vector pointer |
| elem | Pointer of the element to remove |
0 on success, error code (always negative) otherwise
|
inlinestatic |
Remove the last element from the vector.
| v | Vector pointer |
0 on success, error code (always negative) otherwiseReferences sol_vector::len, and sol_vector_del().
| int sol_vector_del_range | ( | struct sol_vector * | v, |
| uint16_t | start, | ||
| uint16_t | len | ||
| ) |
Remove an range of element from the vector.
Removes the range starting at index start from the vector and goes until start + len.
| v | Vector pointer |
| start | Index of the first element to remove |
| len | the number of elements to remover |
0 on success, error code (always negative) otherwise Referenced by sol_ptr_vector_del_range().
|
inlinestatic |
Return the element of the vector at the given index.
| v | Vector pointer |
| i | Index of the element to return |
i or NULL on errors.References sol_vector::len, and sol_vector_get_no_check().
Referenced by on_can_write(), and write_or_create_acl().
|
inlinestatic |
Return the element of the vector at the given index (no safety checks).
This is similar to sol_vector_get(), but does no safety checks such as array boundaries. Only use this whenever you're sure the index i exists.
| v | Vector pointer |
| i | Index of the element to return |
i References sol_vector::data, and sol_vector::elem_size.
Referenced by sol_ptr_vector_get_no_check(), and sol_vector_get().
| void sol_vector_init | ( | struct sol_vector * | v, |
| uint16_t | elem_size | ||
| ) |
Initializes a sol_vector structure.
| v | Pointer to the sol_vector structure to be initialized |
| elem_size | The size of each element in bytes |
Referenced by create_access_control_obj(), read_access_control_obj(), sol_http_params_init(), sol_ptr_vector_init(), and startup_server().
|
inlinestatic |
Steal the memory holding the elements of the vector.
And returns the vector to the initial state.
| v | Vector pointer |
References sol_vector::data, and sol_vector::len.
Referenced by sol_ptr_vector_steal_data().
1.8.6