A minimal, deterministic array abstraction used by higher-level data structures (heaps, maps, queues, stacks). The array provides three core operations — SetAt, GetAt, RemoveAt — and verification helpers to ensure capacity and API validity.
Characteristics
- Fixed capacity defined at initialization; no dynamic allocation.
- O(1) SetAt/GetAt/RemoveAt when implemented over contiguous storage.
- Element ownership managed via JUNO_POINTER_T (Copy/Reset).
- Non-thread-safe by default; guard externally if needed.
Invariants and requirements
- zCapacity > 0 and ptApi != NULL (verified by JunoDs_ArrayVerify).
- Implementations must define how SetAt copies into storage, how GetAt returns a pointer descriptor to the slot, and how RemoveAt clears a slot (typically via the pointer API's Reset).
◆ JUNO_MODULE_ROOT()
Array root with capacity.
◆ JunoDs_ArrayInit()
Initialize an array root with capacity and API.
- Parameters
-
| ptArray | Array instance to initialize (output). |
| ptArrayApi | Array vtable with SetAt/GetAt/RemoveAt implementations. |
| iCapacity | Fixed capacity for this array (must be > 0). |
| pfcnFailureHdlr | Optional failure handler for assertions (can be NULL). |
| pvUserData | Optional user data passed to the failure handler (can be NULL). |
- Returns
- Result of JunoDs_ArrayVerify on the configured array.
◆ JunoDs_ArrayVerify()
Verify an array instance's capacity and API.
Ensures ptArray is non-NULL, capacity is non-zero, and required vtable entries are present.
◆ JunoDs_ArrayVerifyIndex()
Verify an index is within array capacity.
- Parameters
-
| ptArray | Array instance. |
| iIndex | Index to check. |
- Returns
- JUNO_STATUS_SUCCESS when 0 <= iIndex < zCapacity; otherwise JUNO_STATUS_OOB_ERROR (and invokes the failure handler, if provided).