Soletta™ Framework
|
override operations to be used in this memory description. More...
#include <sol-memdesc.h>
Data Fields | |
union { | |
const struct sol_memdesc_ops_array * array | |
const struct sol_memdesc_ops_enumeration * enumeration | |
}; | |
uint16_t | api_version |
API version, must match SOL_MEMDESC_OPS_API_VERSION at runtime. More... | |
int(* | compare )(const struct sol_memdesc *desc, const void *a_memory, const void *b_memory) |
compare the content of two memories. More... | |
int(* | copy )(const struct sol_memdesc *desc, const void *src_memory, void *dst_memory) |
copy the content from another memory. More... | |
int(* | free_content )(const struct sol_memdesc *desc, void *memory) |
free the contents (internal memory) of a memory. More... | |
int(* | init_defaults )(const struct sol_memdesc *desc, void *memory) |
initialize the defaults of memory. More... | |
int(* | set_content )(const struct sol_memdesc *desc, void *memory, const void *ptr_content) |
sets the content of a memory. More... | |
override operations to be used in this memory description.
By default the operations will be done in a fixed way unless overriden by an ops
structure, this may be used to correlate members in a structure, such as struct sol_vector where length is a member and the contents is another, with element_size being specified in yet-another. Then things like "copy" will not be a simple copy of each member.
To map struct sol_vector, use SOL_MEMDESC_OPS_VECTOR. to map struct sol_ptr_vector use SOL_MEMDESC_OPS_PTR_VECTOR.
union { ... } |
uint16_t sol_memdesc_ops::api_version |
API version, must match SOL_MEMDESC_OPS_API_VERSION at runtime.
const struct sol_memdesc_ops_array* sol_memdesc_ops::array |
int(* sol_memdesc_ops::compare)(const struct sol_memdesc *desc, const void *a_memory, const void *b_memory) |
compare the content of two memories.
If provided, will be used to compare the memory contents instead of the traditional code that will, for example, call strcmp() on strings.
Should return 0 for equal, <0 if a_memory is smaller, >0 if b_memory is smaller. On error, return 0 and set errno.
int(* sol_memdesc_ops::copy)(const struct sol_memdesc *desc, const void *src_memory, void *dst_memory) |
copy the content from another memory.
If provided, will be used to set the memory instead of the traditional code that will, for example, strdup() and free() strings.
Should return 0 on success, negative errno on errors.
const struct sol_memdesc_ops_enumeration* sol_memdesc_ops::enumeration |
int(* sol_memdesc_ops::free_content)(const struct sol_memdesc *desc, void *memory) |
free the contents (internal memory) of a memory.
If provided, will be used to free the contents of a memory instead of the traditional code that will, for example, free() strings.
Should return 0 on success, negative errno on errors.
int(* sol_memdesc_ops::init_defaults)(const struct sol_memdesc *desc, void *memory) |
initialize the defaults of memory.
If provided, will be used to initialize the memory instead of the traditional use of struct sol_memdesc::defcontent.
Should return 0 on success, negative errno on errors.
int(* sol_memdesc_ops::set_content)(const struct sol_memdesc *desc, void *memory, const void *ptr_content) |
sets the content of a memory.
If provided, will be used to set the memory instead of the traditional code that will, for example, strdup() and free() strings.
The parameter ptr_content
is a pointer to the actual content, depends on the actual type. If a SOL_MEMDESC_TYPE_BOOL, for example, it must be a bool*
. For SOL_MEMDESC_TYPE_ENUMERATION, the pointer will be memcpy() using the given sol_memdesc_get_size().
Should return 0 on success, negative errno on errors.