libamxc
1.10.3
C Generic Data Containers
|
Data Structures | |
struct | _amxc_htable_it |
The hash table iterator structure. More... | |
Macros | |
#define | amxc_htable_it_get_data(it, type, member) ((type*) (((char*) it) - offsetof(type, member))) |
Gets the data pointer from an hash table iterator. More... | |
Functions | |
int | amxc_htable_it_init (amxc_htable_it_t *const it) |
Initializes a hash table.iterator. More... | |
void | amxc_htable_it_clean (amxc_htable_it_t *const it, amxc_htable_it_delete_t func) |
Removes the iterator from the htable and frees allocated memory. More... | |
amxc_htable_it_t * | amxc_htable_it_get_next (const amxc_htable_it_t *const reference) |
Gets the next iterator in the hash table. More... | |
amxc_htable_it_t * | amxc_htable_it_get_previous (const amxc_htable_it_t *const reference) |
Gets the previous iterator in the hash table. More... | |
amxc_htable_it_t * | amxc_htable_it_get_next_key (const amxc_htable_it_t *const reference) |
Gets the next iterator in the hash table with the same key. More... | |
amxc_htable_it_t * | amxc_htable_it_get_previous_key (const amxc_htable_it_t *const reference) |
Gets the previous iterator in the hash table with the same key. More... | |
void | amxc_htable_it_take (amxc_htable_it_t *const it) |
Removes the iterator from the hash table. More... | |
AMXC_INLINE const char * | amxc_htable_it_get_key (const amxc_htable_it_t *const it) |
Gets the key from the iterator. More... | |
#define amxc_htable_it_get_data | ( | it, | |
type, | |||
member | |||
) | ((type*) (((char*) it) - offsetof(type, member))) |
Gets the data pointer from an hash table iterator.
Definition at line 87 of file amxc_htable.h.
void amxc_htable_it_clean | ( | amxc_htable_it_t *const | it, |
amxc_htable_it_delete_t | func | ||
) |
Removes the iterator from the htable and frees allocated memory.
If the iterator is in a hash table, it is removed from the table, when a delete function is provided, it is called to free up the memory.
it | a pointer to the hash table iterator structure |
func | pointer to a function that is called to free the hash table item |
Definition at line 82 of file amxc_htable_it.c.
AMXC_INLINE const char* amxc_htable_it_get_key | ( | const amxc_htable_it_t *const | it | ) |
Gets the key from the iterator.
When an iterator is in a hash table, it has a key set. An iterator that is not in a list can have a key set.
it | a pointer to the hash table iterator structure |
Definition at line 672 of file amxc_htable.h.
amxc_htable_it_t* amxc_htable_it_get_next | ( | const amxc_htable_it_t *const | reference | ) |
Gets the next iterator in the hash table.
Searches the next hash table iterator in the hash table, using the provided iterator as a reference. The iterator returned can have another key as the reference provided. If it must have the same key, you should use amxc_htable_it_get_next_key
reference | a pointer to the hash table iterator structure |
Definition at line 100 of file amxc_htable_it.c.
amxc_htable_it_t* amxc_htable_it_get_next_key | ( | const amxc_htable_it_t *const | reference | ) |
Gets the next iterator in the hash table with the same key.
Searches the next hash table iterator in the hash table, using the provided iterator as a reference. The iterator returned has the same key as the reference provided.
reference | a pointer to the hash table iterator structure |
Definition at line 134 of file amxc_htable_it.c.
amxc_htable_it_t* amxc_htable_it_get_previous | ( | const amxc_htable_it_t *const | reference | ) |
Gets the previous iterator in the hash table.
Searches the previous hash table iterator in the hash table, using the provided iterator as a reference. The iterator returned can have another key as the reference provided. If it must have the same key, you should use amxc_htable_it_get_previous_key
reference | a pointer to the hash table iterator structure |
Definition at line 117 of file amxc_htable_it.c.
amxc_htable_it_t* amxc_htable_it_get_previous_key | ( | const amxc_htable_it_t *const | reference | ) |
Gets the previous iterator in the hash table with the same key.
Searches the previous hash table iterator in the hash table, using the provided iterator as a reference. The iterator returned has the same key as the reference provided.
reference | a pointer to the hash table iterator structure |
Definition at line 148 of file amxc_htable_it.c.
int amxc_htable_it_init | ( | amxc_htable_it_t *const | it | ) |
Initializes a hash table.iterator.
Initializes the hash table iterator structure. All pointers are reset to NULL.
it | a pointer to the hash table iterator structure. |
Definition at line 68 of file amxc_htable_it.c.
void amxc_htable_it_take | ( | amxc_htable_it_t *const | it | ) |
Removes the iterator from the hash table.
This function only removes the iterator from the hash table, it does not clean any memory allocated for the iterator.
it | a pointer to the hash table iterator structure |
Definition at line 152 of file amxc_htable_it.c.