name mode size
.mulle-env 040000
.mulle-sde 040000
.mulle-sourcetree 040000
cmake 040000
dox 040000
mulle-project 040000
src 040000
test 040000
.gitignore 100644 966B
.travis.yml 100644 602B
CMakeLists.txt 100644 2.86kB
LICENSE 100644 1.72kB 100644 5.74kB 100644 2.27kB
mulle-container.sublime-project 100644 234B
# mulle-container A collection of C (C99) data structures dealing exclusively with void pointers. They utilize callbacks that are compatible to OS X's [`NSHashtable`](// and friends. Data structures can live (temporarily) on the stack, or permanently in the heap. [mulle-allocator](// is used pervasively to simplify memory management. None of them are thread-safe. > This library could benefit from more tests. Do not assume, that it > is completely bug free. Fork | Build Status | Release Version ----------|---------------|----------------------------------- [Mulle kybernetiK](// | [![Build Status](]( | ![Mulle kybernetiK tag]( [![Build Status](]( ## Install Install the prerequisites first: | Prerequisites | |---------------------------------------------------------| | [cityhash](// | | [mulle-allocator](// | Then build and install ``` mkdir build 2> /dev/null ( cd build ; cmake .. ; make install ) ``` Or let [mulle-sde](// do it all for you. ## Example The API of the containers is fairly uniform, here is an example using `mulle_bigmap` to associate c-strings with each other. All the necessary memory management (copying of keys and values) is performed by `mulle_bigmap` using callbacks: ``` #include <mulle_container/mulle_container.h> static struct mulle_container_keyvaluecallback callback; static void test( void) { struct mulle_bigmap *map; struct mulle_bigmapenumerator rover; void *key; void *value; map = mulle_bigmap_create( 0, &callback, NULL); mulle_bigmap_set( map, "VfL", "VFL"); mulle_bigmap_set( map, "Bochum", "BOCHUM"); mulle_bigmap_set( map, "1848", "1848"); if( ! mulle_bigmap_get( map, "1849")) { rover = mulle_bigmap_enumerate( map); while( mulle_bigmapenumerator_next( &rover, &key, &value)) printf( "%s : %s\n", key, value); mulle_bigmapenumerator_done( &rover); } mulle_bigmap_remove( map, "1848"); mulle_bigmap_destroy( map); } int main( void) { callback.keycallback = mulle_container_keycallback_copied_cstring; callback.valuecallback = mulle_container_valuecallback_copied_cstring; test(); } ``` ## API The name of the functions is consistent. Each function is a **verb** that is prefixed with the name of the data structure it handles. So for example the `get` function for `mulle_array` is `mulle_array_get`. The first parameter, except for creation functions, is always the container itself. Check out [](dox/ for a list of common verbs used. The various functions `assert` their parameters, but when compiled for release there are no runtime checks. For development it is wise to use a debug version of the library. File | Description ------------------------------------------------------------ | ---------------------------------------- [`mulle_container_callback`](dox/ | Callback structures for sets, arrays and maps. &nbsp; | &nbsp; [`mulle_array`](dox/ | A growing mutable array of void pointers (-> objects) with enumeration. (NSMutableArray) [`mulle_pointerarray`](dox/ | A growing mutable array of void pointers w/o callbacks. [`mulle_pointerpairarray`](dox/ | A growing mutable array of pairs of void pointers w/o callbacks. &nbsp; | &nbsp; [`mulle_hash`](dox/ | The default hash. Currently it's a wrapper for the [CityHash]( The choice of CityHash is pretty close to arbitrary, it might change in the future. [`mulle_prime`](dox/ | A simple scheme to get prime values for bit depths (up to 32 bit) &nbsp; | &nbsp; [`mulle_bigmap`](dox/ | A two level growing hashmap (key indexing value map). Deemed useful for really big hash tables. [`mulle_map`](dox/ | A single level growing hashmap (key indexing value map). Your standard key/value associating hashtable (NSMutableDictionary) &nbsp; | &nbsp; [`mulle_bigset`](dox/ | A two level growing hashmap (key indexing value map). Deemed useful for really big hash tables. [`mulle_set`](dox/ | A single level growing hashed set. (NSMutableSet) [`mulle_pointerset`](dox/ | A binary searching set of void pointers, based on pointer equality. Useful for very small sets. ### Platforms and Compilers All platforms and compilers supported by [mulle-c11](// and [mulle-thread](// ## Author [Nat!](// for [Mulle kybernetiK](// and [Codeon GmbH](//