-
Notifications
You must be signed in to change notification settings - Fork 403
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 #14 custom header for untyped C++ and C API #649
Iox #14 custom header for untyped C++ and C API #649
Conversation
Codecov Report
@@ Coverage Diff @@
## master #649 +/- ##
==========================================
- Coverage 73.90% 73.89% -0.02%
==========================================
Files 318 318
Lines 11077 11106 +29
Branches 1950 1955 +5
==========================================
+ Hits 8187 8207 +20
- Misses 2127 2130 +3
- Partials 763 769 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
template <typename base_publisher_t> | ||
inline UntypedPublisherImpl<base_publisher_t>::UntypedPublisherImpl(const capro::ServiceDescription& service, | ||
const PublisherOptions& publisherOptions) | ||
template <typename H, typename base_publisher_t> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HeaderType
or Header_t
? I think we're really inconsistent with naming template params, makes reading harder 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just H
to be consistent with the typed API. There was already a T
template parameter and then I added the H
one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the template param in the typed API, too. Same goes for the base_publisher_t
. I think in iceoryx most of the time we use FooType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change base_publisher_t
(in a separate PR together with the typed API) but would keep the H
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for short dummy variables in the inl, they do not have to be the same as in the hpp (readability). In fact, if they are not used even typename is enough. We need a convention for those _t suffixes but IMO they should not be used in template parameters.
@@ -273,7 +273,8 @@ class MyChunkHeaderHook : public ChunkHeaderHook | |||
auto customHeaderHook = MyChunkHeaderHook<MyHeader>(); | |||
auto pub = iox::popo::Publisher<MyPayload>(serviceDescription, customHeaderHook); | |||
``` | |||
- it has to be decided if it's a good idea to give the user easy write access to the `ChunkHeader` or just to the `CustomHeader` | |||
- alternatively, instead of the ChunkHeaderHook class, the publisher could have a method `registerDeliveryHook(std::function<void(ChunkHeader&)>)` | |||
- allow the user only read access to the `ChunkHeader` and write access to the `CustomHeader` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to think about the access options for the header, true. std::function cannot be used in the long run, however. Maybe cxx::function will be sufficient but it is a bit problematic for unrestricted user callbacks due to its size bound.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an option would be plain C function pointer but then we would make it harder to use. I also thought about cxx::function
, which would replace the std::function
when it's ready. The API with the std::function would be marked as deprecated.
iceoryx_binding_c/include/iceoryx_binding_c/internal/cpp2c_publisher.hpp
Show resolved
Hide resolved
template <typename base_publisher_t> | ||
inline UntypedPublisherImpl<base_publisher_t>::UntypedPublisherImpl(const capro::ServiceDescription& service, | ||
const PublisherOptions& publisherOptions) | ||
template <typename H, typename base_publisher_t> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for short dummy variables in the inl, they do not have to be the same as in the hpp (readability). In fact, if they are not used even typename is enough. We need a convention for those _t suffixes but IMO they should not be used in template parameters.
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
2c0371e
to
67716d3
Compare
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
Signed-off-by: Mathias Kraus <[email protected]>
…der-for-untyped-API Iox eclipse-iceoryx#14 custom header for untyped C++ and C API
Pre-Review Checklist for the PR Author
iox-#123-this-is-a-branch
)iox-#123 commit text
)git commit -s
)task-list-completed
)Notes for Reviewer
This PR adds the custom header support to the C++ an C API and refactors the c++2c enum translation tests in order to discover missing enum values on the C side more easily.
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References