Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

IDL within a union, another sequence, or an array in C++

When a sequence is used within a union, within another sequence, or as part of an array, the structure generated for the sequence is used. In unions, the structure type itself is used, but within other sequences, a pointer to the structure type is used. For example:

typedef sequence<long> seqlong;

typedef sequence long2d;

union u switch(short)
{
  case 0:
   long x;
  default:
   long2d matrix;
};

struct s
{
  seqlong five_sequences[5];
};

is mapped as:

struct __seq_int
{
  int* data;
  int dataLen;
  int dataLenReq;
};

typedef __seq_int seqlong;

struct __seq_seqlong
{
  seqlong* data;
  int dataLen;
  int dataLenReq;
};

typedef __seq_seqlong long2d;

struct u
{
  short int _d;
  union {
   int x;
   long2d matrix;
  } _u;
};

typedef struct s s;

struct s
{
  seqlong five_sequences[5];
};