add new data wrapper helper type #668
Labels
No Label
API Change
Breaking API Change
bug
build
cosmetics
Documentation
duplicate
feature
help wanted
hotfix
invalid
question
Refactor
Tests
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: fsfw/fsfw#668
Loading…
Reference in New Issue
No description provided.
Delete Branch "mueller/data-wrapper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Helper class using a tagged union to wrap user data.
Right now, two formats are supported:
const uint8_t*
and size pairSerializeIF
As said in #669, I would think of C style
const uint8_t*
and size pairs as a subset ofSerializeIF
viaSerialBufferAdapter
.This is a feature I have already used it inside the CFDP stack implementation and for packaging TM replies directly inside Device Handler Base. Having used it at two places inside our code, I considered this useful enough to make it generic and create a PR for it.
I can look into using
SerialBufferAdapter
for those cases..Alright, I actually created this union type to have a helper which would wrap both
SerializeIF
and the raw pointer / size combination.When I see an API taking a SerializeIF, it takes implicit knowledge and requires cognitive overhead to remember that the serial buffer adapter can be used for this purpose.
In my opinion, there should be the following 2 functions available
when providing an API that takes user data. The first way is a very common way for C++ containers to provide initial data. It's easy to grasp for beginners as well.
The class above could be used to avoid having 2 APIs for the same purpose.. Another solution would be to always expose the 2 functions mentioned above at all places where I used this new data wrapper and forward the first variant to the second using
SerialBufferAdapter
.However, considering a configuration struct like this
this would require two additional functions to expose this API.
Solved like #671 now. This class is not necessary anymore
Pull request closed