Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Industrial Internet of Things >> Internet of Things Technology

Key Enhancements in RTI Connext’s Modern C++ DDS API

Key Enhancements in RTI Connext’s Modern C++ DDS API

Since we introduced the modern C++ API for DDS, we’ve seen significant interest from our customers. Many have begun building new systems using C++11, and we’ve continued to refine the API with a number of impactful enhancements.

Enhanced IDL Mapping to Modern C++

RTI’s Code Generator now offers a new -stl option, used in conjunction with -language C++03 or -language C++11. This option updates the mapping of several IDL types:

For example, given the following IDL type:

struct MyType {
    sequence<long> my_unbounded_seq;
    sequence<long, 10> my_bounded_seq;
    @use_vector sequence<long, 10> my_other_bounded_seq
    string my_str;
    @external long my_external;
};

Using the command rtiddsgen -language C++11 -stl -unboundedSupport MyType.idl, the generated C++11 class looks like this:

class MyType {
public:
    MyType();
    ...
    MyType (MyType&&) = default;
    MyType& operator=(MyType&&) = default;
    MyType& operator=(const MyType&) = default;
    MyType(const MyType&) = default;
    std::vector<int32_t>& my_unbounded_seq() noexcept;
    const std::vector<int32_t>& my_unbounded_seq() const noexcept;
    void my_unbounded_seq(const std::vector<int32_t>& value);
    rti::core::bounded_sequence<int32_t, 10>& my_bounded_seq() noexcept;
    const rti::core::bounded_sequence<int32_t, 10>& my_bounded_seq() const noexcept;
    void my_bounded_seq(const rti::core::bounded_sequence<int32_t, 10>& value);
    std::vector<int32_t>& my_other_bounded_seq() noexcept;
    const std::vector<int32_t>& my_other_bounded_seq() const noexcept;
    void my_other_bounded_seq(const std::vector<int32_t>& value);
    std::string& my_str() noexcept;
    const std::string& my_str() const noexcept;
    void my_str(const std::string& value);
    dds::core::external<int32_t>& my_external() noexcept;
    const dds::core::external<int32_t>& my_external() const noexcept;
    void my_external(dds::core::external<int32_t> value);
    ...
};

Request‑Reply API for Modern C++

The API now includes two new entities: rti::request::Requester and rti::request::Replier. These provide a native request‑reply pattern, which is already available in other languages and has been introduced in a prototype in version 5.3 and is production‑ready in 5.3.0.7.

A concise code example is available here.

Smaller API Enhancements

We’ve simplified several common tasks:

condition.handler([]() {
    // do something
});

// or, with the new signature
condition.handler([](dds::core::cond::Condition c) {
    // do something (condition == c)
});

TopicQuery for On‑Demand Historical Data

TopicQuery, introduced in 5.3, allows applications to retrieve historical data on‑demand. In the modern C++ API you can create a TopicQuery from a DataReader like this:

rti::sub::TopicQuery my_topic_query(
    my_reader,
    rti::sub::TopicQuerySelection(dds::topic::Filter("x < 10"))
);

You can then take historical samples that match the filter while still receiving live data normally.

Looking Ahead

With C++17 now approved and C++20 on the horizon, RTI Connext will continue to evolve the C++ API with modern language features and performance improvements. Stay tuned or subscribe to the RTI Blog for the latest updates.

Internet of Things Technology

  1. Introducing A3: New AI Community, Tools, and Guides for Automation Leaders
  2. CatalystEX 4.5: New Features, Enhanced Compatibility, and GrabCad Print Integration
  3. Augmented Reality: Transforming Connected Field Service
  4. Why 5G Rollout Is Slowed: Cost, Spectrum, and Coverage Challenges
  5. G.hn: Powering the Industrial IoT Revolution for Cost‑Effective, Reliable Connectivity
  6. Cyber‑Physical Security: Why Hacking Risks Are Expanding Beyond the Virtual Realm
  7. C# vs C++: A Clear Comparison of Features, Performance, and Use Cases
  8. C++ vs Java: Key Differences, History, and When to Use Each
  9. Industry 5.0: Redefining Manufacturing for the Future
  10. Unlocking HR Excellence in Modern Manufacturing: Proven Strategies & Secrets