I have the following CORBA IDL 3.2, which attempts to declare a mutually recursive structure:
module SE
{
interface SE
{
typedef unsigned short MenuItemID; // a small integer representing a unique menu item
enum MenuSubaction { CollectCharacter, CollectStruct };
struct MenuItemAction; // forward declaration
union MenuSubactionParameter switch (MenuSubaction)
{ case CollectStruct: MenuItemAction sub_structure; // <<<<<<<<< use of forward
};
struct MenuItemAction { MenuSubaction menu_subaction;
MenuSubactionParameter menu_subaction_parameter;
};
}; // interface
}; // module
I get a complaint from Sun JDK 1.7 idlj on the line marked with <<<<<
... SE.idl (line xx): Illegal reference to incomplete forward declaration of type MenuItemAction.
Note: this isn't a "forward interface" declaration.
What's an "incomplete forward declaration"? (If you successfully declared as a forward declaration, I wouldn't think the forward declaration as incomplete, just not yet defined. Maybe that's just an easy to misinterpret phrase).
More importantly, how do I manage to define my recursive structure?
I'm new to CORBA, so I don't really :-} know what I'm doing. I don't see why CORBA can't define such recursive structures; one transmits a particular instance that won't be recursive. In particular, this one forms a tree, which should be "easy" for CORBA to send.
EDIT: Brian had the right answer. I needed to replace the direct mention of the forward reference,
MenuItemAction sub_structure
with
sequence<MenuItemAction> sub_structure>