On this page
Verada.Containers.Unbounded.Maps
A limited reclaimed insertion-order key/value table.
Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.
Availability and ownership
Keys and values are kept in one-based parallel arrays and looked up one by one. There is no Include, Remove or iteration. Copy is explicit; Clear releases the arrays.
A client proof uses these contracts without proving the body again (see library assurance). Global => null excludes package-global effects, not changes made through an in out argument.
Import and instantiate
Place the declaration in a declarative part, with the actuals your program needs.
with Verada.Containers.Unbounded.Maps;
package Instance_Name is new Verada.Containers.Unbounded.Maps (Integer, Integer);import Verada.Containers.Unbounded.Maps;
package Instance_Name = new Verada.Containers.Unbounded.Maps<Integer, Integer>;
Vibe does not instantiate library generics; see library use across syntaxes. In Varc, keep each name's declared spelling and write & on arguments the call changes.
Contract and lifecycle reading
A Pre condition is the caller's obligation; a Post is what a normal return guarantees. What a postcondition does not state, a client cannot assume. Ghost functions are for contracts and ghost code. The family guide describes copying, lifetime, order and cost.
API 001
Generic formals (declaration) — Generic actuals establish this instance's nominal types and declared operations. Private formals require suitable definite nonlimited actuals; capacity/comparison/float restrictions are shown below. Defaulted comparison is resolved from the actual type, not an automatic proof of ordering laws.
Declared interface:
generic
type Key_Type is private;
type Element_Type is private;API 002
Key_Array (declaration) — Unconstrained Positive-indexed key value array for content snapshots/contracts. A particular Model result has its own lower-bound guarantee; the array type alone does not force every object to start at 1.
Declared interface:
type Key_Array is array (Positive range <>) of Key_Type;API 003
Element_Array (declaration) — Unconstrained Positive-indexed element value array for content snapshots/contracts. A particular Model result has its own lower-bound guarantee; the array type alone does not force every object to start at 1.
Declared interface:
type Element_Array is array (Positive range <>) of Element_Type;API 004
Map (declaration) — Limited reclaimed parallel-array map, initially empty. Use explicit Copy; scope cleanup clears its owned arrays.
Declared interface:
type Map is limited private
with Default_Initial_Condition => Length (Map) = 0,
Finalizable => (Finalize => Clear, Relaxed_Finalization => True);API 005
Length (declaration) — Observe the logical length/cardinality, not backing capacity or physical allocation size.
API 006
Keys_Model (declaration) — Observe the ordered keys through this declared sequence/array model; it does not by itself supply the associated values.
On normal return the declared contract establishes:
Keys_Model'Result'Length = Length (Container)
and then (Keys_Model'Result'Length = 0 or else Keys_Model'Result'First = 1)API 007
Elements_Model (declaration) — Observe the elements in positions paired with Keys_Model.
On normal return the declared contract establishes:
Elements_Model'Result'Length = Length (Container)
and then (Elements_Model'Result'Length = 0 or else Elements_Model'Result'First = 1)API 008
Key (declaration) — Read the key at a present numeric position, not the value associated with an arbitrary key.
Before this operation, establish:
Index <= Length (Container)On normal return the declared contract establishes:
Key'Result = Keys_Model (Container) (Index)API 009
Element (declaration) — Read an existing logical element; the required index/cursor/presence condition is distinct from the index type's capacity bound.
Before this operation, establish:
Index <= Length (Container)On normal return the declared contract establishes:
Element'Result = Elements_Model (Container) (Index)API 010
Find (declaration) — Search for a key/item and return its position/cursor or the declared absent sentinel. The exact contract determines whether first-match/completeness is promised.
On normal return the declared contract establishes:
(if Find'Result = 0 then (for all I in 1 .. Length (Container) => Key (Container, I) /= K)
else Find'Result <= Length (Container) and then Key (Container, Find'Result) = K)API 011
Contains (declaration) — Test the family's declared membership/search relation; it is not a mutation or a guarantee of constant-time lookup.
API 012
Value (declaration) — Return the value for a present map/dictionary key; establish Contains before lookup.
Before this operation, establish:
Contains (Container, K)API 013
Same_Elements_Except (declaration) — Ghost preservation relation for map elements other than the named key; it is not a value update.
Ghost: for contracts and ghost code, and left out of the program.
API 014
Clear (declaration) — Make the logical container empty. Storage release, cursor validity and inactive-slot contents follow this family's lifecycle rules, not a universal secure-erasure contract.
On normal return the declared contract establishes:
Length (Container) = 0API 015
Insert (declaration) — Add a new element/pair at the family's specified position/order. Absence, room and cursor/index requirements are independent caller obligations.
Before this operation, establish:
not Contains (Container, K)On normal return the declared contract establishes:
Keys_Model (Container) = Keys_Model (Container)'Old & K
and Elements_Model (Container) = Elements_Model (Container)'Old & New_ItemAPI 016
Replace (declaration) — Replace an existing map key's value while preserving key order and unrelated pairs.
Before this operation, establish:
Contains (Container, K)On normal return the declared contract establishes:
Keys_Model (Container) = Keys_Model (Container)'Old
and Length (Container) = Length (Container)'Old
and (for all I in 1 .. Length (Container) => (if Key (Container, I) = K then Element (Container, I) = New_Item))
and Same_Elements_Except (Container, Elements_Model (Container)'Old, K)API 017
Copy (declaration) — Explicitly create the source's logical contents in a mutable target. Observe language alias/ownership rules; this is not a shallow owner assignment.
On normal return the declared contract establishes:
Keys_Model (Target) = Keys_Model (Source) and then Elements_Model (Target) = Elements_Model (Source)