From: xorque <xorquewasp@googlemail.com>
Subject: Generalized serialization for enumeration types
Date: Wed, 26 Aug 2009 03:22:08 -0700 (PDT)
Date: 2009-08-26T03:22:08-07:00 [thread overview]
Message-ID: <249a69e5-8e21-4968-a183-64732618660a@h21g2000yqa.googlegroups.com> (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").
next reply other threads:[~2009-08-26 10:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 10:22 xorque [this message]
2009-08-26 11:00 ` Generalized serialization for enumeration types 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox