Skip to content

Instantly share code, notes, and snippets.

@omerbn
Created January 4, 2022 15:50
Show Gist options
  • Save omerbn/8e98d3858d13d5e36736304c6a081b77 to your computer and use it in GitHub Desktop.
Save omerbn/8e98d3858d13d5e36736304c6a081b77 to your computer and use it in GitHub Desktop.
class MockBuffer: SPSRingBuffer<uint_8> {
/*
*/
}
class Buffer {
SPSRingBuffer<uint_8> buffer;
public:
Buffer: buffer() {}
Buffer(SPSRingBuffer<uint_8>& buf): buffer(std::move(buffer)) {}
#ifdef IN_TESTS
/*
It's dangerous to use an external buffer, thus using this only in tests
*/
Buffer(SPSRingBuffer<uint_8>* buf): buffer(*buffer) {} // lo mumlatz
#endif
}
void main() {
MockBuffer myBuffer;
std::unique_ptr<Buffer> buf = std::make_unique<Buffer>(&myBuffer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment