Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼


The Data Distribution Service for Real-Time Systems: Part 2

Angelo Corsaro is CTO at PrismTech. Angelo also leads strategic standardization at the Object Management Group (OMG), where he co-chairs the Data Distribution Service (DDS) Special Interest Group.

The Data Distribution Service for Real-Time Systems: Part 1
The Data Distribution Service for Real-Time Systems: Part 2

This is the second installment of a series covering the Object Management Group (OMG) Data Distribution Service for Real-Time Systems (DDS). In Part 1, I introduced the basics of DDS and walked you through the steps required to write a simple pub/sub application. In Part 2, I begin examining DDS in depth, starting with data management.

DDS Topics Inside-out

A "topic" represents the unit for information that can produced or consumed by a DDS application. Topics are defined by a name, a type, and a set of QoS policies. Leaving out the QoS, for the time being, let's explore what is so special about them.

DDS is a programming language and OS independent publish/subscribe technology. To ensure independence from a specific programming language and OS, while guaranteeing portability and interoperability, it uses a subset of IDL as the formalism for describing topic types and CDR for encoding them. IDL is a standard syntax for expressing various kind of types while retaining independence from a specific programming language. CDR is a binary serial encoding providing a good trade-off between space and time efficiency.

Since CDR is used under the hood by DDS and not visible to the user, I focus next on the subset of IDL that can be legally used to define a topic type. A topic type is made by an IDL struct plus a key. The struct can contain as many fields as you want and each field can be a primitive type (Table 1), a template type (Table 2), or a constructed type (Table 3).

Table 1: IDL Primitive Types

In Table 1, primitive types are essentially what you'd expect, with just one exception -- the int type is not there! This should not worry you since the IDL integral types short, long, and long long are equivalent to the C99 int16_t, int32_t, and int64_t, thus you have all you need.

Table 2: IDL template types

Table 2 shows IDL templates types. The string and wstring can be parametrized only with respect to their maximum length; the sequence type with respect to its length and contained type; the fixed type with respect to the total number of digits and the scale. The sequence type abstracts homogeneous random access container, pretty much like the std::vector in C++ or java.util.Vector in Java. Finally, it is important to point out that when the maximum length is not provided the type is assumed as having an unbounded length, meaning that the middleware will allocate as much memory as necessary to store the values the application provides.

Table 3: IDL constructed primitive types

Table 3 shows that DDS supports three different kinds of IDL constructed types: enum, struct, and union. Putting it all together, you should now realize that a Topic type is a struct that can contain as fields nested structures, unions, enumerations, template types as well as primitive types. In addition to this, you can define multi-dimensional arrays of any DDS-supported or userdefined type.

This is all nice, but you might wonder how this it ties-in with programming languages such as C++, Java, and C#. The answer is not really surprising, essentially there is a language-specific mapping from the IDL-types described above to mainstream programming languages.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.