Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Sequential_File.h
Go to the documentation of this file.
1#ifndef joedb_Sequential_File_declared
2#define joedb_Sequential_File_declared
3
5
6namespace joedb
7{
8 /// @ingroup journal
10 {
11 private:
12 int64_t position = 0;
13
14 public:
15 void sequential_seek(int64_t new_position)
16 {
17 position = new_position;
18 }
19
20 size_t sequential_read(char *data, size_t size)
21 {
22 const size_t result = pread(data, size, position);
23 position += result;
24 return result;
25 }
26
27 void sequential_write(const char *data, size_t size)
28 {
29 pwrite(data, size, position);
30 position += size;
31 }
32
33 int64_t get_position() const {return position;}
34 };
35}
36
37#endif
virtual void pwrite(const char *data, size_t size, int64_t offset)
virtual size_t pread(char *data, size_t size, int64_t offset) const
size_t sequential_read(char *data, size_t size)
void sequential_write(const char *data, size_t size)
void sequential_seek(int64_t new_position)
int64_t get_position() const
Definition Blob.h:7