Automatic Serialization of Dynamic Structures in Ada

Serialization is the process that transforms the state of a software object into a sequence of bytes. Serialization is useful, for example, to store the value of an object in persistent memory or to send it through a network channel. Ada provides object serialization by means of the Streams package. However, default Ada serialization does not address the problem of serializing dynamic structures automatically. The streaming of an access variable in Ada flattens the value of the access variable itself and not the value of the object referenced by it. It is the responsibility of the programmer to write custom serialization routines for the lists, trees, stacks or any other dynamic structure requiring serialization. In this paper, we present an algorithm for the automatic generation of serialization subprograms for dynamic structures in Ada. We will use ASIS for analyzing the structure of the types to be serialized.