Fermer2
PpHdLe 18/09/2016 à 19:17
Comme vous le savez peut-être, depuis quelque temps je bosse sur M*LIB, une librairie permettant de faire des containers génériques en C. En gros un équivalent de la STL en pur C (mais pas que).
Ça a pas mal avancé, et voici un petit aperçu de ce qu'elle permet :
M*LIB is a meta library allowing the programmer to use **generic but type safe container** in pure C language.
The objects within the containers can have proper constructor and destructor: it will be handled by the library. It allows the library to construct fully recursive objects (using container of container of objects).

The available containers are:

* m-list.h: header for creating linked list of generic type,
* m-dict.h: header for creating dictionary of generic types,
* m-shared.h: header for creating shared pointer of generic type,
* m-array.h: header for creating array of generic type and of dynamic variable size,
* m-tuple.h: header for creating arbitrary tuple of generic type,
* m-btree.h: header for creating binary sorted tree TODO

Each containers define iterators which are parts of the generality of the library.

The available intrusive containers are:

* m-i-list.h: header for creating dual-linked intrusive list of generic type, TODO
* m-i-shared.h: header for creating intrusiv eshared pointer of generic type, TODO

The available containers for thread synchronization are:

* m-buffer.h: header for creating fixed-size queue (or stack) of generic type (thread safe),
* m-pbuffer.h: header for creating fixed-size priority queue of generic type (thread safe) TODO,
* m-snapshot: header for creating 'snapshot' buffer for passing data between a producer and multiple consumers running at different rates (thread safe). It ensures that the consumer only sees complete data with minimal lag, but the consumer doesn't expect to see every piece of data.


Other headers offering other functionality are:

* m-bitset.h: header for creating bit set TODO
* m-string.h: header for creating variable-length string,
* m-core.h: header for meta-programming with the C preprocessor.
* m-mutex.h: header for providing a very thin layer accross multiple implementation of mutex/threads.
* m-algo.h: header for providing various generic algorithms to the previous containers. WIP

Il me reste pas mal de boulot à faire pour que tout fonctionne ensemble harmonieusement, mais c'est déjà tout à fait utilisable.
Par contre, je ne sais pas comment nommer cette librarie... ce qui est gênant pour faire une release !

Des idées ?

Link: https://github.com/P-p-H-d/mlib