mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2026-02-09 14:00:04 +00:00
Use FE2CL_..._AROUND, _AROUND_DEL packets (#295)
* Use FE2CL_..._AROUND, _AROUND_DEL packets * Use increased buffer size for 728 and 1013 protocols
This commit is contained in:
40
src/Bucket.hpp
Normal file
40
src/Bucket.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <optional>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
template<class T, size_t N>
|
||||
class Bucket {
|
||||
std::array<T, N> buf;
|
||||
size_t sz;
|
||||
public:
|
||||
Bucket() {
|
||||
sz = 0;
|
||||
}
|
||||
|
||||
void add(const T& item) {
|
||||
assert(sz < N);
|
||||
buf[sz++] = item;
|
||||
}
|
||||
|
||||
std::optional<T> get(size_t idx) const {
|
||||
if (idx < sz) {
|
||||
return buf[idx];
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
return sz;
|
||||
}
|
||||
|
||||
bool isFull() const {
|
||||
return sz == N;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
sz = 0;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user