Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
BufferStitcher.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdlib>
4namespace sf
5{
6
11{
12 public:
13 BufferStitcher() = default;
14
21 void assign(char* data, size_t sz);
22
26 [[nodiscard]] char* getWritePointer() const;
27
31 [[nodiscard]] size_t getWriteSize() const;
32
38 bool movePosition(size_t sz);
39
45 bool isDone();
46
47 private:
48 // Holds the pointer to the data.
49 char* _data{nullptr};
50 // Holds the size of the buffer.
51 size_t _size{0};
52 // Holds the position where to write into the buffer.
53 size_t _pos{0};
54};
55
56}// namespace sf
Stitches a buffer from a multiple of writes.
Definition BufferStitcher.h:11
char * getWritePointer() const
Gets the pointer into the buffer to write next.
size_t getWriteSize() const
Gets the size that still needs to be written/stitched.
bool movePosition(size_t sz)
Moves the write position up for the next write.
bool isDone()
Gets the status of whether all data has been stitched together. When not initialized.
BufferStitcher()=default
void assign(char *data, size_t sz)
assign the destination buffer and the size expected.
Definition Application.h:10