Hi,
We are trying to use our own defined type that uses an enum. But, we are getting this java.langException when we attempt to run our IDL file with this content
struct State {
enum foo { ZERO=0,ONE=1 } bar;
};
This IDL syntax appears to be okay wrt to OMG IDL spec grammar v4.2 in section 7.4.1.3. Is this syntax invalid for using an enum in an IDL file for use with rtiddsgen? We ae using RTI DDS v5.3.1 on RHEL7.3. The version of rtiddsgen in our RTI DDS installation is v2.5.2.
tia,bernardo
Hi Bernardo,
From your example, I understand you are trying to declare an enum and then use it in the scope of a structure.
According to IDL v4.2, a structure is defined as follows:
Every member is composed of a
<type_spec>
and one or multiple<declarators>
. If you go the definition of both, you will find the following:That is, you may only refer to existing types (i.e., either simple built-in types --
<base_type_spec>
or custom types declared outside the scope of the structure, identified by their<scope_name>
), and name those members using a declarator (e.g.,int a,b,c;
).Just for completion, an enum may only be declared as follows (out of the scope of a structure). Note that the braces that are not between quotes refer to optional comma-separeted enumerators you may append at the end of the enum declaration (e.g.,
BLUE, RED
).Therefore, to achieve what you intent, according to IDL v4.2 you must do the following:
Let me know if this solves your question.
Thanks,
Fernando.