a key-value store for loading configuration information More...
Go to the source code of this file.
Classes | |
struct | co_cbptr_t |
struct | co_profile_t |
Macros | |
#define | SCHEMA(N) static int schema_##N(co_obj_t *self, co_obj_t **output, co_obj_t *params) |
#define | SCHEMA_ADD(K, V) |
#define | SCHEMA_REGISTER(N) co_schema_register(schema_##N) |
#define | SCHEMA_GLOBAL(N) co_schema_register_global(schema_##N) |
Typedefs | |
typedef struct co_cbptr_t | co_cbptr_t |
typedef struct co_profile_t | co_profile_t |
Functions | |
struct co_cbptr_t | __attribute__ ((packed)) |
int | co_schema_register (co_cb_t cb) |
register a callback for populating a profile schema More... | |
int | co_schema_register_global (co_cb_t cb) |
register a callback for populating global profile More... | |
int | co_schemas_load (co_obj_t *profile) |
load schemas for specified profile More... | |
int | co_profiles_create (const size_t index_size) |
create global profiles list More... | |
int | co_profiles_init (const size_t index_size) |
creates a list of available profiles | |
void | co_profiles_shutdown (void) |
removes the list of available profiles | |
int | co_profile_import_files (const char *path) |
imports available profiles from profiles directory More... | |
int | co_profile_import_global (const char *path) |
imports global profile More... | |
co_obj_t * | co_profile_find (co_obj_t *name) |
searches the profile list for a specified profile More... | |
co_obj_t * | co_profile_global (void) |
returns the global profile | |
void | co_profile_delete_global (void) |
deletes the global profile | |
int | co_profile_add (const char *name, const size_t nlen) |
adds a new profile More... | |
int | co_profile_remove (const char *name, const size_t nlen) |
removes profile with given name More... | |
void | co_profile_dump (co_obj_t *profile) |
dumps profile data More... | |
co_obj_t * | co_profile_get (co_obj_t *profile, const co_obj_t *key) |
returns the key value (if an int) from the profile. If no value set, returns the default value More... | |
int | co_profile_set_str (co_obj_t *profile, const char *key, const size_t klen, const char *value, const size_t vlen) |
sets a specified profile value (if a string) More... | |
size_t | co_profile_get_str (co_obj_t *profile, char **output, const char *key, const size_t klen) |
returns the key value (if a string) from the profile. If no value set, returns the default value More... | |
int | co_profile_set_int (co_obj_t *profile, const char *key, const size_t klen, const signed long value) |
sets a specified profile value (if an int) More... | |
signed long | co_profile_get_int (co_obj_t *profile, const char *key, const size_t klen) |
returns the key value (if an int) from the profile. If no value set, returns the default value More... | |
int | co_profile_set_uint (co_obj_t *profile, const char *key, const size_t klen, const unsigned long value) |
sets a specified profile value (if an unsigned int) More... | |
unsigned long | co_profile_get_uint (co_obj_t *profile, const char *key, const size_t klen) |
returns the key value (if an unsigned int) from the profile. If no value set, returns the default value More... | |
int | co_profile_set_float (co_obj_t *profile, const char *key, const size_t klen, const double value) |
sets a specified profile value (if a float) More... | |
double | co_profile_get_float (co_obj_t *profile, const char *key, const size_t klen) |
returns the key value (if a float) from the profile. If no value set, returns the default value More... | |
int | co_profile_export_file (co_obj_t *profile, const char *path) |
exports a profile in memory to a file More... | |
co_obj_t * | co_profiles_process (co_iter_t iter, void *context) |
processes all loaded profiles with specified iterator function More... | |
Variables | |
co_obj_t | _header |
uint8_t | _exttype |
uint8_t | _len |
co_cb_t | cb |
co_obj_t * | name |
co_obj_t * | data |
Detailed Description
a key-value store for loading configuration information
Macro Definition Documentation
#define SCHEMA_ADD | ( | K, | |
V | |||
) |
Function Documentation
int co_profile_add | ( | const char * | name, |
const size_t | nlen | ||
) |
adds a new profile
- Parameters
-
name profile name nlen length of profile name
References co_list_append().
void co_profile_dump | ( | co_obj_t * | profile | ) |
dumps profile data
- Parameters
-
profile profile struct
int co_profile_export_file | ( | co_obj_t * | profile, |
const char * | path | ||
) |
exports a profile in memory to a file
- Parameters
-
profile profile struct path export path
References co_tree_root().
searches the profile list for a specified profile
- Parameters
-
name profile name (search key)
References co_list_parse().
Referenced by co_profile_remove().
returns the key value (if an int) from the profile. If no value set, returns the default value
- Parameters
-
profile profile struct key key in profile klen key length
References co_tree_find().
double co_profile_get_float | ( | co_obj_t * | profile, |
const char * | key, | ||
const size_t | klen | ||
) |
returns the key value (if a float) from the profile. If no value set, returns the default value
- Parameters
-
profile profile struct key key in profile klen key length
References co_tree_find().
signed long co_profile_get_int | ( | co_obj_t * | profile, |
const char * | key, | ||
const size_t | klen | ||
) |
returns the key value (if an int) from the profile. If no value set, returns the default value
- Parameters
-
profile profile struct key key in profile klen key length
References co_tree_find().
size_t co_profile_get_str | ( | co_obj_t * | profile, |
char ** | output, | ||
const char * | key, | ||
const size_t | klen | ||
) |
returns the key value (if a string) from the profile. If no value set, returns the default value
- Parameters
-
profile profile struct output output buffer key key in profile klen key length
References co_tree_find().
Referenced by main().
unsigned long co_profile_get_uint | ( | co_obj_t * | profile, |
const char * | key, | ||
const size_t | klen | ||
) |
returns the key value (if an unsigned int) from the profile. If no value set, returns the default value
- Parameters
-
profile profile struct key key in profile klen key length
References co_tree_find().
int co_profile_import_files | ( | const char * | path | ) |
imports available profiles from profiles directory
- Parameters
-
path file path to the profiles directory
References process_files().
Referenced by main().
int co_profile_import_global | ( | const char * | path | ) |
imports global profile
- Parameters
-
path file path to the global profile
References co_profile_set_str().
Referenced by main().
int co_profile_remove | ( | const char * | name, |
const size_t | nlen | ||
) |
removes profile with given name
- Parameters
-
name profile name nlen length of profile name
References co_list_delete(), and co_profile_find().
int co_profile_set_float | ( | co_obj_t * | profile, |
const char * | key, | ||
const size_t | klen, | ||
const double | value | ||
) |
sets a specified profile value (if a float)
- Parameters
-
profile profile struct key key in profile klen key length value key's value
References co_tree_set_float().
int co_profile_set_int | ( | co_obj_t * | profile, |
const char * | key, | ||
const size_t | klen, | ||
const signed long | value | ||
) |
sets a specified profile value (if an int)
- Parameters
-
profile profile struct key key in profile klen key length value key's value
References co_tree_set_int().
int co_profile_set_str | ( | co_obj_t * | profile, |
const char * | key, | ||
const size_t | klen, | ||
const char * | value, | ||
const size_t | vlen | ||
) |
sets a specified profile value (if a string)
- Parameters
-
profile profile struct key key in profile klen key length value key's value vlen value length
References co_tree_set_str().
Referenced by co_profile_import_global().
int co_profile_set_uint | ( | co_obj_t * | profile, |
const char * | key, | ||
const size_t | klen, | ||
const unsigned long | value | ||
) |
sets a specified profile value (if an unsigned int)
- Parameters
-
profile profile struct key key in profile klen key length value key's value
References co_tree_set_uint().
int co_profiles_create | ( | const size_t | index_size | ) |
create global profiles list
- Parameters
-
index_size size of index for profiles list (16 or 32 bits)
co_obj_t* co_profiles_process | ( | co_iter_t | iter, |
void * | context | ||
) |
processes all loaded profiles with specified iterator function
- Parameters
-
iter iterator function callback context additional parameters for iterator
References co_list_parse().
int co_schema_register | ( | co_cb_t | cb | ) |
register a callback for populating a profile schema
- Parameters
-
cb schema callback
References co_list_append().
int co_schema_register_global | ( | co_cb_t | cb | ) |
register a callback for populating global profile
- Parameters
-
cb schema callback
References co_list_append().
int co_schemas_load | ( | co_obj_t * | profile | ) |
load schemas for specified profile
- Parameters
-
profile profile to load schemas for
Variable Documentation
co_obj_t* name |
command name
Generated on Fri Jun 6 2014 13:22:05 for commotiond by 1.8.7