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>
4
5namespace sf
6{
7
12{
13 public:
14 BufferStitcher() = default;
15
22 void assign(char* data, size_t sz);
23
27 [[nodiscard]] char* getWritePointer() const;
28
32 [[nodiscard]] size_t getWriteSize() const;
33
39 bool movePosition(size_t sz);
40
46 bool isDone();
47
48 private:
49 // Holds the pointer to the data.
50 char* _data{nullptr};
51 // Holds the size of the buffer.
52 size_t _size{0};
53 // Holds the position where to write into the buffer.
54 size_t _pos{0};
55};
56
57}// namespace sf
Stitches a buffer from a multiple of writes.
Definition BufferStitcher.h:12
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