13.1.16 Typedefs
A typedef in OMG IDL is mapped to a typedef in C++. Depending upon the OMG IDL data type, additional typedefs and member functions may be defined. The generated code for each data type is as follows:
- Basic data types (short, long, unsigned short, unsigned long, float, double, char, boolean, and octet)
Basic data types map to a simple typedef. For example:
// OMG IDL typedef long ID; // C++ typedef CORBA::Long ID;
- string
A string typedef is mapped to a simple typedef. For example:
// OMG IDL typedef string IDStr; // C++ typedef char * IDStr;
- object, interfaces, TypeCode
Object, interfaces, and TypeCode types are mapped to four typedefs. For example:
// OMG IDL typedef Item Intf; // C++ typedef Item Intf; typedef Item_ptr Intf_ptr; typedef Item_var Intf_var; typedef Item_ptr &Intf _out;
- enum, struct, union, sequence
UDTs are mapped to three typedefs. For example:
// OMG IDL typedef LogList ListRetType; // C++ typedef LogList ListRetType; typedef LogList_var ListRetType_var; typedef LogList_out &ListRetType_out;
- array
Arrays are mapped to four typedefs and the static member functions to allocate and free memory. For example:
// OMG IDL typedef LogArray ArrayRetType; // C++ typedef LogArray ArrayRetType; typedef LogArray_var ArrayRetType_var; typedef LogArray_forany ArrayRetType_forany; typedef LogArray_slice ArrayRetType_slice; ArrayRetType_slice * ArrayRetType_alloc(); void ArrayRetType_free(ArrayRetType_slice *);
Parent topic: Mappings