StaticFIFO and normal FIFO #126
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: fsfw/fsfw#126
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
I renamed the older FIFO to StaticFIFO (second template argument is the capacity).
The new FIFO takes the capacity as a ctor argument (so size can be determined at compile time and "optional" FIFO members are possible).
Both FIFOs are based on the FIFOBase, which simply takes a pointer to the first element and the maximum capacitry. FIFOBase also exposes the interface.
I split up FIFOBase in FIFOBase.tpp und FIFOBase.h und separate interface from implementation.
Idea: In most implementations, FIFO is actually named Queue. Maybe renamed FIFO / StaticFIFO to Queue and StaticQueue ? It Propably would be a good idea to also put them in a namespace then (e.g. fsfw) because Queue is quite a generic name.
I put the FIFOs in a fsfw namespace now.
As discussed, FIFOs not in namespace anymore, StaticFIFO is FIFO and new FIFO is DynamicFIFO.
There are actually some more containers which allocate dynamically (e.g. RingBuffer)
There was actually a super evil bug in the new DynamicFIFO implementation which lead to undefined behaviour. I was looking 2h, first checking DHB changes, then checking CSB changes, then checking the polling task until I found out the issue was cause by the new DynamicFIFO.
Previous implementation:
Calling .data() on the unconstructed vector is undefined behaviour. Very evil bug because it was hard to track down and (at least for me personally) very hard to spot.
The fix was to expose a setter function in FIFOBase for the internal data pointer and set that pointer AFTER the vector was constructed.