The Sequence Toolkit
www.sequence-toolkit.com |
#include "stk_common.h"
Go to the source code of this file.
Functions | |
void * | stk_find_option (stk_options_t *options, char *name, stk_options_t **last) |
stk_options_t * | stk_copy_extend_options (stk_options_t *options, int number_to_extend) |
stk_ret | stk_append_option (stk_options_t *options, char *name, void *data) |
stk_ret | stk_update_option (stk_options_t *options, char *name, void *data, void **old_data) |
stk_ret | stk_free_options (stk_options_t *options) |
stk_options_t * | stk_build_options (char *str, int sz) |
stk_ret | stk_free_built_options (stk_options_t *options) |
The Option module in the Sequence Toolkit provides APIs to interrogate and manage various options throughout the STK system. Most modules comprise of the ability to be configured through this Option API.
stk_ret stk_append_option | ( | stk_options_t * | options, |
char * | name, | ||
void * | data | ||
) |
Append a key value pair to an options array. Note: This function does not extend/realloc the memory - use stk_copy_extend_options() to make space if not allocated large enough then call this.
options | NULL terminated array of options to be searched |
name | Name of key/value pair to be added |
data | Data of key/value pair to be added |
stk_options_t* stk_build_options | ( | char * | str, |
int | sz | ||
) |
API to build an options table from a string in the following format. <key>
<subscope> <key>
Whitespace indentation is significant
stk_options_t* stk_copy_extend_options | ( | stk_options_t * | options, |
int | number_to_extend | ||
) |
Copy an options array and extend it (alloc new) to make room for new options.
options | NULL terminated array of options to be searched. (Passing a NULL pointer allocs new) |
number_to_extend | Number of additional options to be added to the array |
void* stk_find_option | ( | stk_options_t * | options, |
char * | name, | ||
stk_options_t ** | last | ||
) |
Find a named option in an array of options
options | NULL terminated array of options to be searched |
name | Option name being searched for |
last | NULL for a new search, or a pointer address to store last iteration key |
stk_ret stk_free_built_options | ( | stk_options_t * | options | ) |
Free options created with stk_build_options(). This API does a shallow free of each name/value element Applications must still call stk_free_options(). It cannot recurse in to scopes/sub-options because there is no data indicating the type of value. Applications must call stk_find_options() and call this on every sub-option.
stk_ret stk_free_options | ( | stk_options_t * | options | ) |
Free a dynamically allocated options array.
options | The options array to be freed |
stk_ret stk_update_option | ( | stk_options_t * | options, |
char * | name, | ||
void * | data, | ||
void ** | old_data | ||
) |
Update an existing key value pair in an options array.
options | NULL terminated array of options to be searched |
name | Name of key/value pair to be updated |
data | New data of key/value pair |
old_data | Pointer to store old data value of key/value pair, maybe NULL |