7.17.1. Interface Definition Language

The interface definition language is used to describe types used by CORBA, from the basic types of individual arguments to the complex types of interfaces and objects. The language is similar in syntax to C++.

7.17.1.1. Basic Types

The integer types are short, long and long long for signed integer numbers of 16, 32 and 64 bits and unsigned short, unsigned long and unsigned long long for their unsigned counterparts.

const short aShortConstant = 6 * 7;

The floating point types are float, double and long double for ANSI/IEEE 754-1985 single precision, double precision and double extended precision floating point numbers.

const float aFloatConstant = 3.141593;

The character types are char for a single character in a single-byte character set and wchar for a single character in a multiple-byte character set. The interface definition language itself uses ISO 8859-1 Latin 1.

const char aTab = '\t';
const wchar aWideTab = L'\t';

The logical type is boolean with values of true and false.

const boolean aTrueValue = TRUE;
const boolean aFalseValue = FALSE;

The special types are octet for 8 bits of raw data and any for a container of another arbitrary type.

7.17.1.2. Constructed Data Types

A structure represents a classical compound type with named members that all contain a value.

struct aPerson
{
  string firstName;
  string lastName;
  short  age;
};

An exception is a structure that can be returned as an exceptional result of an operation. A number of standard exceptions is defined. Note there is no inheritance in exception declarations, however, language mappings do add inheritance to make it easier to catch standard exceptions.

exception anException
{
  string reason;
  string severity;
};
exception COMM_FAILURE
{
  unsigned long minor;
  completion_status completed;
};

A union represents a classical compound type with named members out of which one contains a value. A discriminator is used to determine which of the members contaisn the value.

union aSillyUnion switch (short)
{
  case 1  : long aLongValue;
  case 2  : float aFloatValue;
  default : string aStringValue;
};

An enum represents a classical enumerated type with distinct identifiers stored as 32 bit unsigned integers.

enum aBaseColor { red, green, blue }

An array is a container for a fixed number of items of the same type addressed by integer indices.

typedef long aLongArray [10];

A sequence is a container for a variable number of items of the same type addressed by integer indices. The maximum number of items in the container can be limited explicitly.

typedef sequence<long,10> aBoundedVector;
typedef sequence<long> anUnboundedVector;

A string is a sequence of char items. A wstring is a sequence of wchar items.

typedef string<10> aBoundedString;
typedef string anUnboundedString;

A fixed point type represents a fixed point number of upto 31 significant digits.

typedef fixed<10,2> aPrice;

7.17.1.3. Constructed Object Types

An interface type represents an object that is passed by reference and accessed remotely. The declaration of an interface type can specify multiple interface inheritance, attributes and operations. Apart from this, the declaration also creates a lexical scope within which other declarations can appear.

abstract interface aParentInterface
{
  attribute string aStringAttribute;
  short aMethod (in long aLongArgument, inout float aFloatArgument);
}

interface aChildInterface : aParentInterface
{
  readonly attribute short aShortAttribute;
  oneway void aOnewayMethod (in long anArgument);
  void aTwowayMethod () raises anException;
}

In some situations, it might be useful to have an interface type that can represent both an object passed by reference and an object passed by value. This is possible when the interface is denoted as abstract.

It is also possible to use interface types to describe objects that are not invoked through CORBA, the interface types are then denoted as local.

A value type represents an object that is passed by value and accessed locally. The declaration of a value type can specify single value type inheritance, single interface and multiple abstract interface support, attributes with private or public visibility, operations and initializers. Apart from this, the declaration also creates a lexical scope within which other declarations can appear.

valuetype aChildValue : truncatable aParentValue, supports anInterface
{
  private short aShortMember;
  public aParentValue aValueMember;
  factory aFactory (in string anArgument);
  short aLocalMethod (in long aLongArgument, in float aFloatArgument);
}

A value type can support multiple abstract interfaces but only a single interface that is not abstract. When used as an instance of one of the supported abstract interfaces, the value type is passed by value. When used as an instance of the supported interface that is not abstract, the value type is passed by reference.

When an object is passed by value, it might happen that an implementation of its type is not available to the receiver, but an implementation of its parent type is. When a value type is denoted as truncatable, its implementation is considered compatible with the implementation of its parent to the degree that the state of the type can be truncated to the portion inherited from its parent and used by its parent.

A value type that is declared custom will rely on user defined marshalling implementation. A custom value type may not be truncatable.