IDL Data Types – Part 1

February 24, 2008 at 9:19 am (CORBA, Unit 4) (, )

Primitive Types

IDL features a variety of primitive types. These types store simple values such as integral numbers, floating point numbers, character strings, and so on.

a) void

  • This is analogous to the void type in C, C++ and Java
  • This is useful for methods that don’t return any value.

 

b) boolean

  • Stores a boolean value either 0 (false) or 1(true)
  • Depending on the programming language used, the IDL boolean type can map to an integral type (short int in C/C++) or to the language’s native Boolean type (as in Java)

boolean aBoolean;

 

c) char and wchar

  • This is analogous to char type in C/C++ and Java. And directly maps.
  • Stores a single character value
  • The char data type is an 8-bit quantity

char aChar;

  • In version 2.1, wchar or wide character type is an 16-bit quantity

 

Floating Point Types

a) float

  • The IDL float type represents an IEEE single-precision floating point value
  • Analogous to C, C++, and Java

float aFloat;

 

b) double and long double

  • Represents an IEEE double-precision floating point value
  • Corresponds to the double type in leading languages

double aDouble;

  • The long double type, introduced in CORBA 2.1, represents IEEE double-extended floating point value, having an exponent of at least 15 bits and a signed fraction of at least 64 bits.

 

Integer Types

  • Unlike most familiar programming languages, IDL doesn’t define a plain int type only short and long integer types.

 

a) long and long long

  • The IDL long type represents a 32-bit signed quantity, like C/C++’s int and Java’s int

Ex: long aLong;

  • In CORBA 2.1 the long type was added, which is a 64-bit signed quantity

 

b) unsigned long and unsigned long long

  • The unsigned long type in IDL is an unsigned version of the long type

Ex: unsigned long anUnsignedLong;

  • CORBA 2.1 added the unsigned long long type, which is a 64-bit unsigned quantity.

 

c) short

  • Represents a 16-bit signed quantity, as in C, C++, and Java
  • It’s range -215 … 215-1.

Ex: short aShort;

 

d) unsigned short

  • Unsigned version of short
  • Range   – 0…216-1

Ex: unsigned short aUnsignedShort;

 

e) octet

  • It is an 8-bit quantity that is not translated in any way during transmission.
  • The similar type is available in Java as byte.

Ex: octet aOctet;

 

f) string

  • Represents a collection of characters. Similar to C++’s Cstring and Java’s String class.
  • In ‘C’ character arrays are used as string.
  • IDL supports fixed-length and variable-length strings.

Ex: string aFixedLength[20];

       string aVariantLength;

 

The const modifier

  • const values are useful for values that should not change.
  • The scope of the const value is interface or module.

Ex: const float pi = 3.14;

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: