comp.lang.ada
 help / color / mirror / Atom feed
* Generalized serialization for enumeration types
@ 2009-08-26 10:22 xorque
  2009-08-26 11:00 ` okellogg
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: xorque @ 2009-08-26 10:22 UTC (permalink / raw)


Hello.

I'm designing a package that uses a lot of similar but distinct
enumeration types.

At some point, those types need to be encoded to be sent over
the wire. The encoding rules are simple:

  The enumeration values are converted to unsigned 32 bit
  integers with the first value as 0 and increasing sequentially
  with each new value. The 32 bit value is packed into big-endian
  byte order.

The problem is: With so many enumeration types, I now have about 300
lines of almost identical procedures (to be used as stream attributes)
that just call a procedure that packs Unsigned_32 values into
Storage_Element arrays.

Is there some clever way I can just write ONE 'Write attribute
procedure
and ONE 'Read attribute procedure and have all the defined enumeration
types use those?

Freezing rules prevented me from writing a generic
Packed_Enumeration_IO
package ("representation item appears too late").



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-08-28 10:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-26 10:22 Generalized serialization for enumeration types xorque
2009-08-26 11:00 ` okellogg
2009-08-26 11:33   ` xorque
2009-08-26 12:03     ` okellogg
2009-08-26 11:17 ` Georg Bauhaus
2009-08-26 11:35   ` xorque
2009-08-26 12:05 ` Dmitry A. Kazakov
2009-08-26 19:44 ` Jeffrey R. Carter
2009-08-27  5:05 ` sjw
2009-08-28 10:47   ` xorque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox