This module defines generic binary (octet sequence) types, and arbitrary precision floating-point decimal data types.
For generic coding, the decimal types are a useful alternative to the IDL
fixed
template types which were introduced by CORBA 2.1 and
GIOP 1.1, since the use of template types introduces a distinct type for
each combination of precision and scale.
A generic octet sequence type.
typedef sequence < octet > Binary;
A floating-point decimal type.
struct Decimal { BCD::Binary value; };
The Binary
representation of floating-point values is
designed to support easy conversion to and from strings, while at the
same time minimising the size of the binary representation for GIOP.
A number is converted to the binary representation using the following algorithm.
13 * 16 + 9 = 217
.
Any program receiving a binary value which is not formed according to the above specification should raise a CORBA::DATA_CONVERSION system exception.
Note: a struct is used because it allows overloaded methods to be defined in C++ and Java for decimal manipulation. It also guarantees that a distinct type is generated for the Java IDL language mapping.
A floating-point decimal (money) type. Uses the same representation
as Decimal
but may be used where a semantic distinction is
required.
struct Money { BCD::Binary value; };
Note: a struct is used because it allows overloaded methods to be defined in C++ and Java for money manipulation. It also guarantees that a distinct type is generated for the Java IDL language mapping.