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

Iox #27 add typed client and server api [stacked PR #5] #1089

Merged
merged 8 commits into from
Feb 22, 2022

Conversation

elBoberido
Copy link
Member

@elBoberido elBoberido commented Feb 10, 2022

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-#123-this-is-a-branch)
  5. Commits messages are according to this guideline
    • Commit messages have the issue ID (iox-#123 commit text)
    • Commit messages are signed (git commit -s)
    • Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. Assign PR to reviewer

Notes for Reviewer

This PR adds the typed API. The functionality is complete.

Test will be added in PR #1140

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
    • Each unit test case has a unique UUID
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

@elBoberido elBoberido self-assigned this Feb 10, 2022
@elBoberido elBoberido added the enhancement New feature label Feb 10, 2022
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from 526053c to 9185db9 Compare February 10, 2022 19:56
@elBoberido elBoberido changed the title [do-not-review] Iox #27 add typed client and server api [stacked PR #4] [do-not-review] Iox #27 add typed client and server api [stacked PR #5] Feb 10, 2022
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from 6c5053a to eec32b3 Compare February 10, 2022 22:01
@elBoberido elBoberido changed the base branch from iox-#27-add-client-and-server-port-to-runtime-and-roudi to iox-#27-add-untyped-client-and-server-api February 10, 2022 22:04
@elBoberido elBoberido force-pushed the iox-#27-add-untyped-client-and-server-api branch from cafa071 to 23359fb Compare February 10, 2022 22:35
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from 6eaf3c7 to 5510a8b Compare February 10, 2022 22:38
@elBoberido elBoberido force-pushed the iox-#27-add-untyped-client-and-server-api branch from 23359fb to f346fb0 Compare February 11, 2022 11:06
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from 5510a8b to b3202dd Compare February 11, 2022 11:07
@elBoberido elBoberido force-pushed the iox-#27-add-untyped-client-and-server-api branch from f346fb0 to 1cbc765 Compare February 11, 2022 11:24
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from b3202dd to 877a24c Compare February 11, 2022 11:28
@elBoberido elBoberido marked this pull request as draft February 11, 2022 11:28
@elBoberido elBoberido mentioned this pull request Feb 11, 2022
20 tasks
@elBoberido elBoberido force-pushed the iox-#27-add-untyped-client-and-server-api branch from 1cbc765 to 601edf6 Compare February 11, 2022 18:21
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch 2 times, most recently from c2d4ecc to 19ee1af Compare February 11, 2022 22:02
@elBoberido elBoberido force-pushed the iox-#27-add-untyped-client-and-server-api branch from 891b47e to e74429c Compare February 14, 2022 15:21
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch 7 times, most recently from edd8b95 to 08f6def Compare February 15, 2022 16:39
@elBoberido elBoberido changed the base branch from iox-#27-add-untyped-client-and-server-api to iox-#27-preparations-for-typed-client-and-server-api February 15, 2022 16:40
@elBoberido elBoberido force-pushed the iox-#27-preparations-for-typed-client-and-server-api branch from fe7160b to 06ec79d Compare February 15, 2022 18:59
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from 08f6def to 43d6216 Compare February 15, 2022 19:02
@elBoberido elBoberido force-pushed the iox-#27-preparations-for-typed-client-and-server-api branch from 06ec79d to 7d1265d Compare February 15, 2022 19:47
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from 43d6216 to b74bb56 Compare February 15, 2022 19:48
budrus
budrus previously approved these changes Feb 21, 2022
@elBoberido elBoberido marked this pull request as ready for review February 21, 2022 13:32
template <typename Req, typename Res, typename BaseServerT = BaseServer<>>
class ServerImpl : public BaseServerT, public RpcInterface<Response<Res>>
{
static_assert(!std::is_void<Req>::value, "The type `Req` must not be void. Use the UntypedServer for void types.");
Copy link
Contributor

Choose a reason for hiding this comment

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

You have here and in ClientImpl some code duplication. What about introducing a HeaderConcept like:

template <typename T>
struct HeaderConcept {
    static_assert(!std::is_void<T>::value, "Must not be void");
    static_assert(!std::is_const<T>::value, "Must not be const");
    static_assert(!std::is_reference<T>::value, "Must not be a reference");
    static_assert(!std::is_pointer<T>::value, "Must not be a pointer");
    using Evaluate = void; // required and has to be used with typename HeaderConcept<int>::Evaluate otherwise the compiler ignores the static_assert's
};

And use it like:

template <typename Req, typename Res, typename BaseServerT = int,
          typename RequiresForRequest = typename HeaderConcept<Req>::Evaluate,
          typename RequiresForResponse = typename HeaderConcept<Res>::Evaluate>
class ServerImpl {};

Then one would see that a header concept is required (looks a bit like C++20), if something changes we have only one piece of code we have to adjust and not 4 different pieces.

Copy link
Contributor

@MatthiasKillat MatthiasKillat Feb 21, 2022

Choose a reason for hiding this comment

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

@elfenpiff Looks interesting. Can be extended with checks for specific members etc. in the concept should this be needed (with SFINAE). I just do not like the need to introduce artificial template args for this (as with other meta-programming e.g. enable_if) which are not really supposed to be used apart from the default values.

I think it is possible/better to transfer the aggregated condition value to some internal bool, i.e. basically create a type trait for headers. Then we can static_assert on this as before, like
static_assert(HeaderConcept<MyHeader>::value, "concept not satisfied");
I leave out the details, but its basically a constexpr bool value = ... on your conditions above.

Then we do not have artificial template args.

Copy link
Member Author

Choose a reason for hiding this comment

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

@elfenpiff this might be tricky since the asserts have subtle variations

Copy link
Member Author

Choose a reason for hiding this comment

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

@elfenpiff after a closer look, forget what I wrote

Copy link
Member Author

Choose a reason for hiding this comment

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

@elfenpiff I agree with @MatthiasKillat to not add additional template args so I adjusted your proposal a bit.

@elBoberido elBoberido force-pushed the iox-#27-preparations-for-typed-client-and-server-api branch from f29ff6d to 8a14544 Compare February 21, 2022 18:03
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch 2 times, most recently from 04cde7d to 128cb6f Compare February 21, 2022 18:07
@elBoberido elBoberido force-pushed the iox-#27-preparations-for-typed-client-and-server-api branch from 8a14544 to 2afc558 Compare February 21, 2022 20:07
@elBoberido elBoberido force-pushed the iox-#27-add-typed-client-and-server-api branch from 078ac6a to b02a50f Compare February 21, 2022 20:07
MatthiasKillat
MatthiasKillat previously approved these changes Feb 22, 2022
static_assert(!std::is_const<H>::value, "The user-header `H` must not be const.");
static_assert(!std::is_reference<H>::value, "The user-header `H` must not be a reference.");
static_assert(!std::is_pointer<H>::value, "The user-header must `H` not be a pointer.");
using DataTypeAssert = typename TypedPortApiTrait<T>::Assert;
Copy link
Contributor

Choose a reason for hiding this comment

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

This works too to avoid template args (and we keep the fine grained errors of the static asserts).

Base automatically changed from iox-#27-preparations-for-typed-client-and-server-api to master February 22, 2022 14:31
@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #1089 (a0310be) into master (26c7310) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1089      +/-   ##
==========================================
+ Coverage   76.19%   76.21%   +0.01%     
==========================================
  Files         346      346              
  Lines       13595    13595              
  Branches     1938     1938              
==========================================
+ Hits        10359    10361       +2     
+ Misses       2604     2602       -2     
  Partials      632      632              
Flag Coverage Δ
unittests 75.47% <ø> (+0.01%) ⬆️
unittests_timing 12.00% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...eoryx_posh/include/iceoryx_posh/popo/publisher.hpp 100.00% <ø> (ø)
...nternal/relocatable_pointer/pointer_repository.inl 86.36% <0.00%> (-2.28%) ⬇️
iceoryx_hoofs/source/concurrent/loffli.cpp 88.57% <0.00%> (+8.57%) ⬆️

@elBoberido elBoberido merged commit a1ed109 into master Feb 22, 2022
@elBoberido elBoberido deleted the iox-#27-add-typed-client-and-server-api branch February 22, 2022 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants