union

4 posts / 0 new
Last post
frgo's picture
Offline
Last seen: 1 year 11 months ago
Joined: 12/28/2011
Posts: 20
Using "union" in IDL

Hello,

I am trying to use the union construct to define data as follows:

// Data Package Kinds

enum data_packet_kind
{
EVENT,
REQUEST,
RESPONSE,
COMMAND,
COMMAND_RESULT,
CAT,
CAT_REPLY,
TEXT_MESSAGE
};

// all types are defined - see attached IDL file

struct data_packet_t
{
data_packet_kind packet_kind;

union data switch ( data_packet_kind )
{
case EVENT:
event_t event;

Keywords:
6 posts / 0 new
Last post
Offline
Last seen: 1 year 11 months ago
Joined: 07/12/2012
Posts: 51
Reading a union (TCKind.TK_UNION) dynamically

I am having a problem to read a union from DynamicData. The problem is to read the value of the discriminator so that the member

with the valid data can be identified. I can read all the values of the member fields and of course all but one have invalid data. How does one through

the TypeCode and DynamicData API get the value of the discriminator. The closest I can get to the discriminator is to get only the TypeCode with

discriminator_type(). Can someone point me to the relevant API functions to accomplish this or have a (Java) example to share ?


Thank you

Organization:
Subscribe to RSS - union