[comp.lang.ada] How do you do this in Ada?

billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 ) (03/14/90)

   (Another article from comp.software-eng which should have gone
    to comp.lang.ada originally...)

From westley@corsair.uucp (Terry J. Westley):

 We are building a real-time radar simulation on a distributed network of
 ~35 Sun workstations and ~35 68030 CPU boards (Motorola MVME147
 specifically).  Parts of the network will be Ethernet; the backbone will
 be FDDI.  Now, for my question:
 
 I have approximately 200 unique messages that are transmitted over the
 net among all the various nodes.  How do I send a particular Ada object
 of some arbitrary record type to another node while:
 
 1) preserving strong typing -- I don't want to have to convert
    everything to some common structure such as an array of bytes
 
 2) reducing messages to the smallest possible size -- I need to reduce
    the net traffic as much as possible -- as you know, there are numerous
    challenges relating to using variant record structures while trying
    to achieve this goal
 
 3) avoiding giving global visibility to all message types to all program
    units
 
 I started out by writing a LAN interface package as a generic patterned
 after sequential_io.  You instantiate it with the particular variant
 record structure that applies to the sender and receiver of that
 particular data.  I also imported a function to determine the size of
 a particular record so that I wouldn't always be sending the maximum
 size of the record.
 
 The major problem with this is that I have many different combinations
 of messages to be sent to each destination.  Here is a much simplified
 example of this problem.  Suppose I have three elements that need to
 communicate:
 
 	Element #	Runs on Processor	Needs message types
 	---------	----------------	-------------------
             1                  A                       a, b, c
             2                  B                       b, c
             3                  C                       a, c
 
 I could build a variant record structure of message types a, b, and c.
 However, then Element 2 and 3 have visibility to message types they have
 no business seeing.  I can't build three variant records (a-b-c, b-c,
 and a-c) because the record types will now be incompatible.
 
 Any ideas?
 
 Terry J. Westley
 Arvin/Calspan Advanced Technology Center
 P.O. Box 400, Buffalo, NY 14225
 acsu.buffalo.edu!planck!westley@hercules