Previous | Table of Contents | Next |
OMG IDL defines the keyword sequence to be a one-dimensional array with two characteristics: an optional maximum size that
is fixed at compile time, and a length that is determined at run-time. Like the definition of strings, OMG IDL allows sequences
to be defined in one of two ways: bounded and unbounded. A sequence is bounded if a maximum size is specified, else it is
considered unbounded.
18.2.7.1 Mapping for Unbounded Sequence Types
The mapping of the following OMG IDL syntax for the unbounded sequence of type T
// OMG IDL for Ttypedef ... T;typedef sequence<T> UNBOUNDED_SEQUENCE;
maps to the following Microsoft IDL and ODL syntax:
// Microsoft IDL or ODLtypedef ... U;typedef struct
{unsigned long cbMaxSize;unsigned long cbLengthUsed;[size_is(cbMaxSize), length_is(cbLengthUsed), unique]
U * pValue;} UNBOUNDED_SEQUENCE;
The encoding for an unbounded OMG IDL sequence of type T is that of a Microsoft IDL or ODL struct containing a unique pointer
to a conformant array of type U, where U is the Microsoft IDL or ODL mapping of T. The enclosing struct in the Microsoft IDL/ODL
mapping is necessary to provide a scope in which extent and data bounds can be defined.
18.2.7.2 Mapping for Bounded Sequence Types
The mapping for the following OMG IDL syntax for the bounded sequence of type T that can grow to be N size:
// OMG IDL for T const long N = ...; typedef ...T; typedef sequence<T,N> BOUNDED_SEQUENCE_OF_N;
maps to the following Microsoft IDL or ODL syntax:
// Microsoft IDL or ODLconst long N = ...;typedef ...U;
typedef struct{unsigned long reserved;unsigned long cbLengthUsed;[length_is(cbLengthUsed)] U Value[N];} BOUNDED_SEQUENCE_OF_N;
Note – The maximum size of the bounded sequence is declared in the declaration of the array and therefore a [size is ()] attribute
is not needed.