Inspirel banner

Programming Distributed Systems with YAMI4

3.4.1 Ada

The YAMI.Parameters package defines the indefinite type Parameters_Collection and a set of primitive operations, including constructor functions that have to be used to provide an initial value:

with YAMI.Parameters;
use YAMI.Parameters;

-- ...
declare
   Params : Parameters_Collection := Make_Parameters;
begin
   -- ...
end;

Objects of the Parameters_Collection type can be created as local objects, at the library level or dynamically allocated. For consistency of handling finalization, there is a dedicated access type with convenience constructor function that allocates the object dynamically and with the Free function for proper deallocation:

declare
   Params : Parameters_Collection_Access := New_Parameters;
begin
   --  ...
   Free (Params);
end;

It is relatively inexpensive to create empty parameters objects, so the recommended practice is to create them in the innermost scope where they are needed.