Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
BufferChopper.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdio>
4#include <limits>
5
6namespace sf
7{
8
13{
14 public:
19 explicit BufferChopper(size_t chopSize = 1024);
20
26 void assign(char* data, size_t sz);
27
33 [[nodiscard]] char* getChunkData();
34
39 [[nodiscard]] size_t getChunkSize() const;
40
45 bool moveNext();
46
51 [[nodiscard]] bool isDone() const;
52
53 private:
54 char* _data{nullptr};
55 size_t _size{0};
56 size_t _pos{0};
57 size_t _chopSize{0};
58
59};
60
61}
Chops a buffer up in to smaller pieces.
Definition BufferChopper.h:13
char * getChunkData()
Gets the pointer to the next chop of data. Each call moves the internal pointer up until no more data...
bool isDone() const
Get the status on the chopping being done or not.
bool moveNext()
Moves to the next chuck when available.
void assign(char *data, size_t sz)
Assigns the buffer to be chopped.
size_t getChunkSize() const
Gets the size of the chop pointed at by getChunkData().
BufferChopper(size_t chopSize=1024)
Constructor passing the chop size.
Definition Application.h:10