Unbounded Support For Sequences and Strings 4

When we first designed Connext DDS, deterministic memory allocation was on the top of our priority list. At that time most of our customers used small data types such as sensor and track data. We decided to go with an approach in which we pre-allocated the samples in the DataWriter and DataReader queues to their maximum size. For example:

struct Position {
    double latitude;
    double longitude;
}

struct VehicleTrack {
    string<64> vehicleID; //@key
    Position position;
}

In the previous example, a sample of type VehicleTrack was pre-allocated to its maximum size. Even if vehicleID did not have a length of 64 bytes, Connext DDS pre-allocated a string of 64 bytes to store the sample value.

As our customer base increased, the set of use cases expanded, and with that came the need to be more flexible in our memory allocation policies. For example, customers may use Connext DDS to publish and subscribe video and audio. Typically these data types are characterized for having unbounded members. For example:

struct VideoFrame {
    boolean keyFrame;
    /* The customer does not necessarily know the maximum 
       size of the data sequence */
    sequence<octet> data;
};

Pre-allocating memory for samples like VideoFrame above may become prohibitive and really expensive as the customer will be forced to use an artificial and arbitrarily large bound for the variable size sequence. For example:

struct VideoFrame {
    boolean keyFrame;
    /* Alternatively the customer can use the code generator 
       command-line option -sequenceSize to set an implicit 
       limit for the unbounded sequence */
    sequence<octet,1024000> data; 
};

In Connext DDS 5.2.0, we have introduced support for unbounded sequences and strings.

To support unbounded sequences and strings, the Code Generator has a new command-line option: -unboundedSupport. This new option may only be used when generating code for .NET, C, and C++ (that is, the -language option must be specified for C++/CLI, C#, C, or C++).

With this option, Connext DDS will not pre-allocate the unbounded members to their maximum size. For unbounded members, the generated code will de-serialize the samples by dynamically allocating and de-allocating memory to accommodate the actual size of the unbounded member. Unbounded sequences and strings are also supported with DynamicData and Built-in Types and they integrate with the following tools and services:

  • Routing Service
  • Queuing Service
  • Recording Service on serialized and automatic mode (records in serialized format)
  • Replay Service when recorded in serialized mode
  • Spy
  • Admin Console
  • Toolkit for LabVIEW

The integration with Persistence Service, Database Integration Service and Spreadsheet Add-in for Microsoft Excel is not available at this point.

For additional information, check Chapter 3 Data Types and DDS Data Samples and Chapter 20 DDS Sample-Data and Instance-Data Memory Management in the RTI Connext DDS Core Libraries User’s Manual as well as the User’s Manuals for services and tools.

4 comments

  1. Pingback: Code Generator: Experiment with New Features « RTI Blog

  2. Pingback: More Reasons to Love Eddy « RTI Blog

Submit a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s