Are unbounded sequences really unbounded?
Note: Applies to RTI Connext 4.x through 5.1. ETA: As of 5.2, RTI Connext supports truly unbounded sequences and strings in the C, C++, and .NET APIs.
Unbounded sequences are actually not unbounded at all. They are bounded sequences whose bound is initialized by RTI Connext instead of by the user. As explained in the Core Libraries and Utilities User's Manual, a sequence's "bound" is the highest possible value for its "maximum" (i.e., the number of elements that are allocated for the sequence); unbounded sequences are given a default bound of 100 elements.
So an "unbounded sequence" is really a bounded sequence of bound 100. Bounding prevents dynamic growth at run time, which could affect real-time behavior. In general, if you attempt to write past the bound of your sequence, you may get the following log messages:
PRESWriterHistoryDriver_initializeSample:!serialize WriterHistoryMemoryPlugin_addEntryToSessions:!initialize sample WriterHistoryMemoryPlugin_getEntry:!add virtual sample to sessions WriterHistoryMemoryPlugin_addSample:!get entry PRESWriterHistoryDriver_addWrite:!add_sample PRESPsWriter_write:!collator addWrite
Here are two ways to increase the bound of an unbounded sequence:
1) Explicitly specify the sequence bound in the IDL file, then run rtiddsgen
. For example:
Before:
struct ShortSequence { sequence<short> short_sequence; };
After:
struct ShortSequence { sequence<short, 200> short_sequence; };
2) Use an unbounded sequence in the IDL, then run rtiddsgen -sequenceSize
to specify the bound. For example:
struct ShortSequence { sequence<short> short_sequence; };
Change the bound on the command-line:
rtiddsgen -sequenceSize 200 ShortSequence.idl
For more information, see the chapter on Data Types in the Core Libraries and Utilities User's Manual.