Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSMX support for C++ #453

Merged
merged 21 commits into from
Sep 20, 2023
Merged

PSMX support for C++ #453

merged 21 commits into from
Sep 20, 2023

Conversation

eboasson
Copy link
Contributor

@eboasson eboasson commented Sep 6, 2023

reicheratwork and others added 6 commits September 5, 2023 12:35
The addition of the PSMX model of data exchange in CycloneDDS
requires the addition of PSMX specific serdata functions:
from_loaned_sample and from_psmx, these have been implemented
It also requires the removal of the hardcoded iceoryx code, as this
is now handled through PSMX functionality and any loaded module's
implementation

Signed-off-by: Martijn Reicher <[email protected]>
As this type of exchange is now abstracted away behind PSMX calls, it
is no longer necessary

Signed-off-by: Martijn Reicher <[email protected]>
As per clang's recommendation.

Signed-off-by: Erik Boasson <[email protected]>
Copy link
Contributor

@dpotman dpotman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The datatopic changes and the PSMX qos implementation look fine to me.

A few details on other things:

  • wrong indenting for an if statement, see below
  • getSampleSize defined in src/ddscxx/include/org/eclipse/cyclonedds/topic/TopicTraits.hpp:113 seems to be unused.

And I think we need a replacement for the shared memory tests that are removed with this PR.

void PSMXInstancesDelegate::check() const
{
if (instances_.size() > DDS_MAX_PSMX_INSTANCES)
ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "Invalid size of PSMXInstances::instances value (%ld > %d).", instances_.size(), DDS_MAX_PSMX_INSTANCES);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indenting

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct.


if (!m_t.compare_exchange_strong(t, static_cast<T*>(newloan->sample_ptr), std::memory_order_seq_cst))
{
//something went wrong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is error handling required here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me go through this a bit.

if (!serialize_data)
metadata->sample_state = (key ? DDS_LOANED_SAMPLE_STATE_RAW_KEY : DDS_LOANED_SAMPLE_STATE_RAW_DATA);

metadata->cdr_identifier = hdr[0]; //remove endianness?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's no need to 'remove' any endianness, as the endianness in the header is native

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct.
I will fix this.

eboasson and others added 14 commits September 9, 2023 15:12
Signed-off-by: Erik Boasson <[email protected]>
Now that Iceoryx is loaded as a PSMX plugin there is no longer any
dependency on Iceoryx in the C++ API.  The Iceoryx-based test uses the
C++ API of Iceoryx, and so the Iceoryx C binding is no longer relevant.

Signed-off-by: Erik Boasson <[email protected]>
* ENABLE_SHM => ENABLE_ICEORYX, which now only has to do with testing

* SharedMemoryTest => IceoryxTest

Signed-off-by: Erik Boasson <[email protected]>
@@ -1887,6 +1887,19 @@ class TTypeConsistencyEnforcement : public dds::core::Value<D>
//==============================================================================


template <typename D>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still need to add documentation to this.

@@ -195,6 +198,7 @@ OMG_DDS_POLICY_TRAITS(DataRepresentation, 23)
OMG_DDS_POLICY_TRAITS(TypeConsistencyEnforcement, 24)
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
OMG_DDS_POLICY_TRAITS(WriterBatching, 25)
OMG_DDS_POLICY_TRAITS(PSMXInstances, 34)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this comment should be on the CycloneDDS-C repository's PR, but are we sure that this new Policy-ID will not conflict with other vendors' stuff?

if (!serialize_data)
metadata->sample_state = (key ? DDS_LOANED_SAMPLE_STATE_RAW_KEY : DDS_LOANED_SAMPLE_STATE_RAW_DATA);

metadata->cdr_identifier = hdr[0]; //remove endianness?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct.
I will fix this.


if (!m_t.compare_exchange_strong(t, static_cast<T*>(newloan->sample_ptr), std::memory_order_seq_cst))
{
//something went wrong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me go through this a bit.

void PSMXInstancesDelegate::check() const
{
if (instances_.size() > DDS_MAX_PSMX_INSTANCES)
ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "Invalid size of PSMXInstances::instances value (%ld > %d).", instances_.size(), DDS_MAX_PSMX_INSTANCES);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct.

- Added documentation to new PSMXInstances QoSPolicy
- Added exception thrown when loan setting fails.
- Small layout fixes

Signed-off-by: Martijn Reicher <[email protected]>
@eboasson
Copy link
Contributor Author

@eboasson eboasson merged commit ef77160 into eclipse-cyclonedds:master Sep 20, 2023
1 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants