|
TeoCCl library
0.1.7
|
Map module. More...
Go to the source code of this file.
Data Structures | |
| struct | teoMap |
| struct | teoMapElementData |
| struct | teoMapIterator |
Macros | |
| #define | HASH_TABLE_SIZE 127 |
| #define | HASH_TABLE_INITVAL 77557755 |
Typedefs | |
| typedef struct teoMap | teoMap |
| typedef struct teoMapElementData | teoMapElementData |
| typedef struct teoMapIterator | teoMapIterator |
| typedef int(* | teoMapForeachFunction )(teoMap *m, int idx, teoMapElementData *d, void *user_data) |
Functions | |
| uint8_t * | teoMapGetFirst (teoMap *map, size_t *data_length) |
| Get first available element from hash table. More... | |
| size_t | teoMapSize (teoMap *map) |
| Get number of elements in TR-UPD map. More... | |
| teoMap * | teoMapNew (size_t size, int auto_resize_f) |
| Create new map. More... | |
| void | teoMapDestroy (teoMap *map) |
| Destroy map. More... | |
| void | teoMapClear (teoMap *map) |
| uint8_t * | teoMapAdd (teoMap *map, const uint8_t *key, size_t key_length, const uint8_t *data, size_t data_length) |
| Add (or update) key data to the map. More... | |
| uint8_t * | teoMapGet (teoMap *map, const uint8_t *key, size_t key_length, size_t *data_length) |
| Get key data from hash table. More... | |
| int | teoMapDelete (teoMap *map, const uint8_t *key, size_t key_length) |
| Delete keys element from map. More... | |
| teoMapIterator * | teoMapIteratorNew (teoMap *map) |
| Create new map iterator. More... | |
| void | teoMapIteratorReset (teoMapIterator *map_it, teoMap *map) |
| Reset map iterator. More... | |
| teoMapIterator * | teoMapIteratorReverseNew (teoMap *map) |
| Create new map reverse iterator. More... | |
| void | teoMapIteratorReverseReset (teoMapIterator *map_it, teoMap *map) |
| Reset map iterator. More... | |
| int | teoMapIteratorFree (teoMapIterator *map_it) |
| Destroy map iterator. More... | |
| teoMapElementData * | teoMapIteratorNext (teoMapIterator *map_it) |
| Get next maps element. More... | |
| teoMapElementData * | teoMapIteratorPrev (teoMapIterator *map_it) |
| Get previous maps element. More... | |
| int | teoMapForeach (teoMap *m, teoMapForeachFunction callback, void *user_data) |
| Loop through map and call callback function with index and data in parameters. More... | |
Map module.
Created on June 6, 2016, 12:26 PM
| #define HASH_TABLE_INITVAL 77557755 |
| #define HASH_TABLE_SIZE 127 |
Referenced by teo::Map::Map(), and teoMapClear().
| typedef struct teoMapElementData teoMapElementData |
| typedef int(* teoMapForeachFunction)(teoMap *m, int idx, teoMapElementData *d, void *user_data) |
| typedef struct teoMapIterator teoMapIterator |
| uint8_t* teoMapAdd | ( | teoMap * | map, |
| const uint8_t * | key, | ||
| size_t | key_length, | ||
| const uint8_t * | data, | ||
| size_t | data_length | ||
| ) |
Add (or update) key data to the map.
| map | |
| key | |
| key_length | |
| data | |
| data_length |
| map | Pointer to teoMapData |
| key | Pointer to key |
| key_length | Key length |
| data | Pointer to data |
| data_length | Data length |
References ccl_malloc(), teoQueueData::data, teoMapElementData::data, teoMapElementData::data_length, teoMapElementData::hash, teoMapElementData::key_length, teoQueueAdd(), and teoQueueUpdate().
Referenced by teo::Map::add(), and cclLruRefer().
| void teoMapClear | ( | teoMap * | map | ) |
| map |
References teoMap::hash_map_size, HASH_TABLE_SIZE, teoMap::q, and teoQueueFree().
Referenced by teo::Map::mapClear().
| int teoMapDelete | ( | teoMap * | map, |
| const uint8_t * | key, | ||
| size_t | key_length | ||
| ) |
Delete keys element from map.
| map | Pointer to teoMapData |
| key | Pointer to key |
| key_length | Key length |
References teoMap::auto_resize_f, teoMapElementData::hash, teoMap::hash_map_size, teoMap::length, teoMap::q, and teoQueueDelete().
Referenced by cclLruRefer(), and teo::Map::del().
| void teoMapDestroy | ( | teoMap * | map | ) |
Destroy map.
| map | |
| map | Pointer to teoMapData |
References teoMap::hash_map_size, teoMap::q, and teoQueueDestroy().
Referenced by teo::Map::~Map().
| int teoMapForeach | ( | teoMap * | map, |
| teoMapForeachFunction | callback, | ||
| void * | user_data | ||
| ) |
Loop through map and call callback function with index and data in parameters.
| m | Pointer to teoMap |
| callback | Pointer to callback function teoMapForeachFunction |
References teoMapIteratorNext(), and teoMapIteratorReset().
Referenced by teo::Map::foreach().
| uint8_t* teoMapGet | ( | teoMap * | map, |
| const uint8_t * | key, | ||
| size_t | key_length, | ||
| size_t * | data_length | ||
| ) |
Get key data from hash table.
| map | Pointer to teoMapData |
| key | Pointer to key |
| key_length | Key length |
| data_length | [out] Pointer to data length |
References teoMapElementData::data, teoMapElementData::data_length, and teoMapElementData::key_length.
Referenced by cclLruRefer(), and teo::Map::get().
| uint8_t* teoMapGetFirst | ( | teoMap * | map, |
| size_t * | data_length | ||
| ) |
Get first available element from hash table.
| map | |
| data_length |
| map | Pointer to teoHashTdata |
| data_length | [out] Pointer to returned data length (may be NULL) |
References teoMapIteratorNext(), and teoMapIteratorReset().
Referenced by teo::Map::getFirst().
| int teoMapIteratorFree | ( | teoMapIterator * | map_it | ) |
Destroy map iterator.
| map_it | Pointer to teoMapIterator |
Referenced by teo::Map::iteratorFree().
| teoMapIterator* teoMapIteratorNew | ( | teoMap * | map | ) |
Create new map iterator.
| map | Pointer to teoMapData |
References ccl_malloc(), and teoMapIteratorReset().
Referenced by teo::Map::iterator().
| teoMapElementData* teoMapIteratorNext | ( | teoMapIterator * | map_it | ) |
Get next maps element.
| map_it | Pointer to teoMapIterator |
References teoQueueData::data, teoMap::hash_map_size, teoMapIterator::idx, teoMapIterator::it, teoMapIterator::map, teoMap::q, teoQueueIteratorNext(), teoQueueIteratorReset(), and teoMapIterator::tmv.
Referenced by teo::Map::iteratorNext(), teoMapForeach(), and teoMapGetFirst().
| teoMapElementData* teoMapIteratorPrev | ( | teoMapIterator * | map_it | ) |
Get previous maps element.
| map_it | Pointer to teoMapIterator |
References teoQueueData::data, teoMapIterator::idx, teoMapIterator::it, teoMapIterator::map, teoMap::q, teoQueueIteratorPrev(), teoQueueIteratorReset(), and teoMapIterator::tmv.
Referenced by teo::Map::iterator_prev().
| void teoMapIteratorReset | ( | teoMapIterator * | map_it, |
| teoMap * | map | ||
| ) |
Reset map iterator.
Binds iterator to map, set forward iteration direction.
| map_it | Pointer to teoMapIterator |
| map | Pointer to teoMapData |
References teoMapIterator::idx, teoMapIterator::it, teoMapIterator::map, teoMap::q, teoQueueIteratorReset(), and teoMapIterator::tmv.
Referenced by teoMapForeach(), teoMapGetFirst(), and teoMapIteratorNew().
| teoMapIterator* teoMapIteratorReverseNew | ( | teoMap * | map | ) |
Create new map reverse iterator.
| map | Pointer to teoMapData |
References ccl_malloc(), and teoMapIteratorReverseReset().
Referenced by teo::Map::iteratorReverse().
| void teoMapIteratorReverseReset | ( | teoMapIterator * | map_it, |
| teoMap * | map | ||
| ) |
Reset map iterator.
Binds iterator to map, set reverse iteration direction.
| map_it | Pointer to teoMapIterator |
| map | Pointer to teoMapData |
References teoMap::hash_map_size, teoMapIterator::idx, teoMapIterator::it, teoMapIterator::map, teoMap::q, teoQueueIteratorReset(), and teoMapIterator::tmv.
Referenced by teoMapIteratorReverseNew().
| teoMap* teoMapNew | ( | size_t | size, |
| int | auto_resize_f | ||
| ) |
Create new map.
| size | |
| auto_resize_f |
| size | Size of hash map (hash map resized automatically) |
| auto_resize_f | Auto resize hash map |
References teoMap::auto_resize_f, ccl_malloc(), teoMap::collisions, teoMap::hash_map_size, teoMap::length, teoMap::q, and teoQueueNew().
Referenced by cclLruInit(), and teo::Map::Map().
| size_t teoMapSize | ( | teoMap * | map | ) |
Get number of elements in TR-UPD map.
| map | Pointer to teoMapData |
References teoMap::length.
Referenced by teo::Map::size().