#include "ks_config.h"
#include "ks_assoc.h"
#include "ks_string.h"
#include <string.h>
#include <stdio.h>
Go to the source code of this file.
Functions | |
| ks_type_t * | ks_assoc_type (void) |
| void | ks_assoc_init (ks_assoc_t *s) |
| ks_assoc_t * | ks_assoc_new (void) |
| void | ks_assoc_fini (ks_assoc_t *s) |
| void | ks_assoc_free (ks_assoc_t *s) |
| void | ks_assoc_put (ks_assoc_t *s, const char *key, size_t len, ks_base_t *ptr) |
| ks_base_t * | ks_assoc_get (ks_assoc_t *s, const char *key, size_t len) |
| int | ks_assoc_size (ks_assoc_t *s) |
| ks_array_t * | ks_assoc_keys (ks_assoc_t *s) |
This module provides an associative array, allowing us to deal with dictionaries of information.
Definition in file ks_assoc.c.
|
|
Clear the state of a ks_assoc_t, leaving in the ks_assoc_t in a suitable state for ks_assoc_init() to reinitialise.
Definition at line 238 of file ks_assoc.c. References _ks_assoc_t::array, and ks_array_fini(). Referenced by ks_assoc_free(). |
|
|
Destroy a ks_assoc_t, freeing all memory used by it.
Definition at line 251 of file ks_assoc.c. References ks_assoc_fini(), and ks_free(). Referenced by ks_response_free(). |
|
||||||||||||||||
|
Retrieve the data associated with a given key from a ks_assoc_t.
Definition at line 319 of file ks_assoc.c. References _ks_bucket_t::data. Referenced by ks_combination_data(), ks_combination_score(), ks_fact_data(), ks_fact_feed(), ks_fact_identity(), ks_fact_value(), ks_response_combination(), ks_response_combinations(), ks_response_error(), ks_response_id(), ks_response_message(), and ks_response_time(). |
|
|
Initialise a ks_assoc_t. This will have been done for you by ks_assoc_new() for each new ks_assoc_t. If you need to reinitialise a ks_assoc_t, then you should first clear its state using ks_assoc_fini(), or your application could leak memory.
Definition at line 210 of file ks_assoc.c. References _ks_assoc_t::array, _ks_assoc_t::base, ks_array_init(), and _ks_base_t::type. Referenced by ks_assoc_new(). |
|
|
Return the list of keys stored in a ks_assoc_t
Definition at line 350 of file ks_assoc.c. References _ks_assoc_t::array, _ks_bucket_t::key, _ks_bucket_t::klen, ks_array_add(), ks_array_get(), ks_array_length(), ks_array_new(), KS_CAST, and ks_string_new(). |
|
|
Create a new, initialised ks_assoc_t.
Definition at line 222 of file ks_assoc.c. References ks_assoc_init(), and ks_malloc(). |
|
||||||||||||||||||||
|
Put new data in a ks_assoc_t, and associate it with a given key. If the key already exists, the existing data associated with that key is destroyed and the new data inserted in its place, otherwise a new bucket is created for the key and data.
Definition at line 295 of file ks_assoc.c. References _ks_assoc_t::array, _ks_bucket_t::data, and ks_array_add(). Referenced by ks_fact_feed(). |
|
|
Find the number of entries in a ks_assoc_t
Definition at line 335 of file ks_assoc.c. References _ks_assoc_t::array, and ks_array_length(). Referenced by ks_response_combinations_size(). |
|
|
Retrieve the metaclass for ks_assoc_t objects.
Definition at line 172 of file ks_assoc.c. Referenced by ks_response_bparse(). |
1.4.4