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).
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 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 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.


