Resources | Resources |



IDL sequence in C++

IDL sequences are mapped slightly different for each instance, depending on usage. This section first presents the mapping in general, and then discusses the differences in mapping when sequences are used in in parameters, in rout parameters, in inrout parameters, within structures, and within unions or other sequences.

For each sequence type sequence, a corresponding structure __seq_T is generated with three members:

T* data; 
int dataLen;
int dataLenReq;

The dataLen member specifies the number of elements in the array data. When the sequence is transmitted as an inrout or rout argument, upon completion of the call, the dataLenReq member is populated with the number of elements required to store the contents of the sequence.

Note: Sequence lengths are always in terms of the number of elements in the sequence, not the number of bytes required to store the sequence.

Consider the following mapping example for a sequence of long integers.

typedef sequence<long> seqlong; 

is mapped as:

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

typedef __seq_int seqlong;

This structure is used when constructing sequences of sequence types, and when sequence types are used as part of unions.