Skip to main content

WriteBuffer.ixx File

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

Included Headers

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

Namespaces Index

namespacehelios
namespaceengine
namespacecore
namespacecontainer
namespacebuffer

Classes Index

classWriteBuffer<T>

Write-only buffer for accumulating messages in a double-buffered system. More...

Description

Write-only buffer for the double-buffering pattern.

File Listing

The file content with the documentation metadata removed is:

5module;
6
7#include <vector>
8#include <cstddef>
9
10export module helios.engine.core.container.buffer:WriteBuffer;
11
12import :ReadWriteDoubleBufferFwd;
13import :ReadBuffer;
14
15
17
31 template<typename T>
32 class WriteBuffer {
33
34 friend class ReadWriteDoubleBuffer<T>;
35
39 std::vector<T> bufferData_;
40
48 [[nodiscard]] std::vector<T>& bufferData() {
49 return bufferData_;
50 }
51
52 public:
53
63 template<typename... Args>
65 bufferData_.emplace_back(std::forward<Args>(args)...);
66 return *this;
67 }
68
76 WriteBuffer& reserve(size_t size) {
77 bufferData_.reserve(size);
78 return *this;
79 }
80
87 bufferData_.clear();
88 return *this;
89 }
90 };
91
92}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.