Skip to main content

ReadBuffer.ixx File

Read-only buffer for the double-buffering pattern. More...

Included Headers

#include <span> #include <vector> #include <cstddef> #include <helios.engine.core.container.buffer:ReadWriteDoubleBufferFwd>

Namespaces Index

namespacehelios
namespaceengine
namespacecore
namespacecontainer
namespacebuffer

Classes Index

classReadBuffer<T>

Read-only buffer for consuming messages in a double-buffered system. More...

Description

Read-only buffer for the double-buffering pattern.

File Listing

The file content with the documentation metadata removed is:

5module;
6
7#include <span>
8#include <vector>
9#include <cstddef>
10
11export module helios.engine.core.container.buffer:ReadBuffer;
12
13import :ReadWriteDoubleBufferFwd;
14
16
30 template<typename T>
31 class ReadBuffer {
32
33 friend class ReadWriteDoubleBuffer<T>;
34
38 std::vector<T> bufferData_;
39
47 [[nodiscard]] std::vector<T>& bufferData() {
48 return bufferData_;
49 }
50
51 public:
52
58 std::span<const T> read() const noexcept {
59 return bufferData_;
60 }
61
69 ReadBuffer& reserve(size_t size) {
70 bufferData_.reserve(size);
71 return *this;
72 }
73
80 bufferData_.clear();
81 return *this;
82 }
83 };
84
85}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.