c++keydata-distribution-serviceqos

DDS QoS: Is it possible to send data without specifying a key?


I am currently using Eclipse Cyclone DDS C++ and I am wondering if it is possible to send data without any key specified with #pragma keylist in an IDL.

Is it possible to achive this through QoS-Settings? If so, how?


Solution

  • If you do #pragma keylist TYPE without listing any key fields, the IDL compiler will generate everything you need for creating a topic that doesn't have any key fields. So

    struct S {
      long something;
      string orother;
    };
    #pragma keylist S
    

    is perfectly valid, and then you can create a topic for S.

    I am not entirely sure what you mean by

    In this case writes to the same topic could not be distinguished by the readers.

    The above will result in a single instance for this topic. You can still have a history and so, e.g., the reader can still ensure it sees every update by specifying a KEEP_ALL history setting. The reader can therefore still distinguish between the writes by looking at the content and/or the sample info, but for DDS these are all updates to this one instance.

    Is it possible to achive this through the QoS-Settings?

    No, you cannot (currently) override the key fields using the QoS settings.