GenoM IDL sequences mapping differ slightly for bounded or unbouded
variations of the sequence. Both types maps onto a C struct
,
with a _maximum
, _length
and _buffer
members.
For unbounded sequences, buffer
points to a buffer of at most
_maximum
elements and containing _length
valid
elements. An additional member _release
is a function pointer
that can be used to release the storage associated to the
_buffer
and reallocate it. It is the responsibility of the user to
maintain the consistency between those members.
For bounded sequences, buffer
is an array of at most _maximum
elements and containing _length
valid elements. Since _buffer
is
an array, no memory management is necessary for this data type.
For instance, the following IDL:
typedef sequence<long> unbounded; typedef sequence<long,16> bounded;
would map into
typedef struct { uint32_t _maximum, _length; int32_t *_buffer; void (*release)(void *_buffer); } unbounded; typedef struct { const uint32_t _maximum; uint32_t _length; int32_t _buffer[16]; } bounded;