You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**C++ (32 utilities)** — templates and header-only classes in `include/memkit/containers/`, included via `<memkit/memkit.hpp>`.
58
58
59
-
**C (14 containers)** — type-erased by design (C23 has no generics). Each container exposes `*_init` / `*_create` / `*_destroy` over a shared `*_box` implementation. Utility types (`SmallString`, `SmallBuffer`, queues, maps, `FixedVariant`, `TokenBucket`, `FixedIoVec`, `LookupTable`, etc.) are C++-only.
59
+
**C (14 containers + arena)** — type-erased by design (C23 has no generics). Each container exposes `*_init` / `*_create` / `*_destroy` over a shared `*_box` implementation. Utility types (`SmallString`, `SmallBuffer`, queues, maps, `FixedVariant`, `TokenBucket`, `FixedIoVec`, `LookupTable`, etc.) are **C++-only** by design.
60
+
61
+
### API completeness (v0.2)
62
+
63
+
The public API is **feature-complete** for embedded use on Unix (macOS and Linux). Every shipped container is listed in the [C++ API reference](#c-api) and [C API reference](#c-api-1) below; authoritative signatures live in the headers.
64
+
65
+
| Surface | Count | MCU | MPU | Notes |
66
+
|---------|-------|-----|-----|-------|
67
+
| C++ utilities | 32 | all | all | `#include <memkit/memkit.hpp>` |
| C arena | 1 | yes | yes | Bump allocator; mmap/heap create on MPU |
70
+
| C++-only helpers | 18 | yes | yes | No C bindings (see [cheat sheet](#container-cheat-sheet)) |
71
+
72
+
**Tests:** 31 C++ test binaries cover all 32 C++ containers (`Stack` and `Queue` share `test_stack_queue_cpp.cpp`). C API coverage is `test_c_api_smoke.c` (tier 1, MCU) and `test_c_api_extended.c` (tier 1 + tier 2 + create paths, MPU).
60
73
61
74
Pick the API that fits your project:
62
75
@@ -139,45 +152,47 @@ Include the umbrella header:
139
152
140
153
All containers live in namespace `memkit`. Operations return `memkit::status`; use `memkit::ok(st)` to test success.
Memory helpers: `memkit::memory::static_arena`, `fixed_buffer`, `fixed_pool`, and on MPU `heap_arena`, `mmap_arena`, `mmap_storage`.
155
+
### Containers (complete)
156
+
157
+
All types live in namespace `memkit`. Operations return `memkit::status` unless noted. Every class supports `init` from caller storage; most also support `init_from_arena`. Move-only; destructors call `clear()`.
**Memory helpers** (`memkit/memory/`): `fixed_buffer`, `static_arena`, `fixed_pool`; on MPU also `heap_arena`, `mmap_arena`, `mmap_storage`, `heap_storage`.
181
196
182
197
Type aliases: `memkit::Arena<…>`, `memkit::FixedPool<…>`.
183
198
@@ -443,6 +458,46 @@ Controlled by `MEMKIT_C_API_FULL` and `MEMKIT_C_API_EXTENDED` in `memkit_config.
443
458
444
459
On MCU firmware that needs tier-2 containers, use the C++ API (`memkit.hpp`) with static or arena storage instead of the C stubs.
445
460
461
+
### Complete C API reference
462
+
463
+
Every C container follows the same conventions: `<name>_status_t`, `<name>_config_t`, opaque `<name>_t` blob, `<name>_init` / `<name>_create` / `<name>_deinit` / `<name>_destroy`, and `<name>_status_ok()`. Element types are passed as `void *` with `elem_size` (and optional copy/destroy callbacks).
464
+
465
+
**Arena** (`arena.h`) — tier 1, all targets
466
+
467
+
| Function | Purpose |
468
+
|----------|---------|
469
+
|`arena_init`, `arena_deinit`| Embed arena over caller buffer |
470
+
|`arena_create`, `arena_create_with_backing`, `arena_destroy`| MPU: heap or mmap backing |
**Umbrella header:**`#include <memkit.h>` pulls `memkit_config.h` and all container headers above.
500
+
446
501
### Opaque objects
447
502
448
503
Each container handle embeds implementation storage:
@@ -713,3 +768,26 @@ memkit is intentionally slightly slower than a one-off C ring — you trade a fe
713
768
---
714
769
715
770
## Examples (MCU)
771
+
772
+
| Example | Language | Demonstrates |
773
+
|---------|----------|--------------|
774
+
|`example_mcu.cpp`| C++ | Static ring + arena-backed ring |
775
+
|`example_mcu_c.c`| C | Tier-1 ring + queue with caller storage |
776
+
|`example_embedded_patterns.cpp`| C++ | DoubleBuffer, MpscQueue, LookupTable, bit stream, MovingAverage |
777
+
|`example_comm_pipeline.cpp`| C++ | ByteRing RX, SpscQueue, TokenBucket pacing |
778
+
779
+
MPU examples: `example_mpu.cpp` (C++ mmap arena), `example_mpu.c` (C arena create + tier-2 create helpers). Built with `make mpu`.
780
+
781
+
---
782
+
783
+
## Future work
784
+
785
+
Not required for the current v0.2 feature set; possible follow-ups if demand appears:
786
+
787
+
| Area | Description |
788
+
|------|-------------|
789
+
|**Windows support**|`VirtualAlloc`/`VirtualFree` for the mmap arena path, MSVC/clang-cl CI, and CMake-first host builds. Core MCU containers are already portable; the gap is MPU optional backing and toolchain plumbing. |
790
+
|**Exhaustive unit / fuzz / concurrency tests**| Today’s 31 C++ tests are happy-path smoke/integration coverage. Deeper work would add multi-threaded MPSC/SPSC stress tests, systematic error-path cases, and fuzz/property tests. |
791
+
|**Per-container C API test parity**| C++ has one test file per container (except shared stack/queue). C has `test_c_api_smoke.c` + `test_c_api_extended.c` integration tests only — not dedicated per-header unit tests matching the C++ matrix. |
0 commit comments