Inspirel banner

Programming Distributed Systems with YAMI4

3.13.1 Ada

In order to describe a raw binary data the program has to use the types defined in the YAMI.Serializables package. These types were prepared to handle scattered (non-contiguous) binary buffers.

The following example shows how to describe two binary buffers as a single list:

Raw_Buffer_1 : aliased YAMI.Serializables.Serialization_Buffer :=
  --  ...
Raw_Buffer_2 : aliased YAMI.Serializables.Serialization_Buffer :=
  --  ...

List_Of_Buffers :
  YAMI.Serializables.Serialization_Buffer_List :=
  (1 => Raw_Buffer_1'Unchecked_Access,
   2 => Raw_Buffer_2'Unchecked_Access);

Once the list of buffers is prepared, it can be wrapped as a Serializable object:

Raw_Binary :
  YAMI.Raw_Buffer_Data_Sources.Raw_Buffer_Data_Source :=
  YAMI.Raw_Buffer_Data_Sources.Make_Raw_Buffer_Data_Source
  (List_Of_Buffers);

The Raw_Binary object above can be passed to YAMI4 instead of regular Parameters object. This is possible because both Parameters and Raw_Buffer_Data_Source implement the Serializable interface and objects of both types can be used for describing data.

Users with special data structure requirements can also provide their own implementations of the Serializable interface and use them with message sending operations.