FIFO is StaticFIFO now, new FIFO using vector #127

Merged
gaisser merged 21 commits from KSat/fsfw:mueller_FIFO_static_normal into master 2020-09-01 13:09:00 +02:00
3 changed files with 10 additions and 5 deletions
Showing only changes of commit 2fccc4fef7 - Show all commits

View File

@ -19,10 +19,8 @@ namespace fsfw {
template<typename T>
class FIFO: public FIFOBase<T> {
public:
FIFO(size_t maxCapacity): FIFOBase<T>(values.data(), maxCapacity) {
values.reserve(maxCapacity);
values.resize(maxCapacity);
};
FIFO(size_t maxCapacity): FIFOBase<T>(values.data(), maxCapacity),
values(maxCapacity) {};
private:
std::vector<T> values;

View File

@ -45,9 +45,11 @@ public:
bool full();
size_t size();
size_t getMaxCapacity() const;
private:
T* values;
size_t maxCapacity;
size_t maxCapacity = 0;
size_t readIndex = 0;
size_t writeIndex = 0;

View File

@ -73,4 +73,9 @@ inline size_t FIFOBase<T>::next(size_t current) {
return current;
}
template<typename T>
inline size_t FIFOBase<T>::getMaxCapacity() const {
return maxCapacity;
}
#endif