Dynamic Data: How to access multi-level nesting elements using C++11


With this example, you will learn how to manage complex objects with several levels of nesting and different kinds of members programmatically on an unknown structure. RTIⓇ ConnextⓇ DDS provides tools to access the different members independently if they are a primitive type, struct type, sequence, etc.

Example Description

In this example, we use the Dynamic Data APIs provided by Connext DDS to access a sample with an unknown structure that mixes primitive and complex types, as well as sequences and arrays.

Dynamic Data allows us to access the member information such as the name or the kind of the member. Then if the member is a primitive type, we will  get/set the value. If it is a complex type, we will use  loan_value() to bind the object and then with the method  get() we will obtain a reference to a DynamicData object associated with the loaned value. Once we have the DynamicData object, we will be able to traverse through the different members, repeating the procedure recursively. It’s important to highlight that since we are getting a reference, any modification will be made on the original object.

The example shows how to process the Dynamic Data object in the method listMembers(), in the file test_subscriber.

Programming Language:


Can anyone access it? 502 ERROR The request could not be satisfied. CloudFront wasn't able to connect to the origin. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.