20.3.10 IDL Forward Declaration

RTI Code Generator supports forward declarations of structs, value types, and unions, meaning that you can use a type before defining it.

A type that is not defined yet can only appear as the element type of a sequence definition, as an @external member, or (if the type being defined is not a union) as an @optional member.

In the following example, MyStructFD is not defined before it is used as a member on MyStruct:

struct MyStructFD;
 
struct MyStruct {
    sequence <MyStructFD> member_1;
    @external MyStructFD member_2;
    @optional MyStructFD member_3;
};
 
union MyUnion switch (long) {
    case 1: sequence <MyStructFD> member_1;
    case 2: @external MyStructFD member_2;
    // Incomplete type cannot be used with @optional when defining a union
    // default: @optional MyStructFD member_3;
};
 
struct MyStructFD {
    long member_FD;
};

Forward declarations are not supported in the Python language.

See also 20.4.2 XML Forward Declaration.