comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Generalized serialization for enumeration types
Date: Wed, 26 Aug 2009 12:44:11 -0700
Date: 2009-08-26T12:44:11-07:00	[thread overview]
Message-ID: <h742ur$f1m$1@news.tornevall.net> (raw)
In-Reply-To: <249a69e5-8e21-4968-a183-64732618660a@h21g2000yqa.googlegroups.com>

xorque wrote:
> 
> 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.

'Pos for enumeration types gives values that satisfy this rule. They are 
universal_integer, and so may be used anywhere a value of your unsigned 32 bit 
integer type is needed.

I don't know if this helps you, however.

-- 
Jeff Carter
"If you don't get the President of the United States on that
phone, ... you're going to have to answer to the Coca-Cola
Company."
Dr. Strangelove
32



  parent reply	other threads:[~2009-08-26 19:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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