| 12 | namespace tt::file { |
| 13 | |
| 14 | class ObjectFileReader { |
| 15 | |
| 16 | const std::string filePath; |
| 17 | const uint32_t recordSize = 0; |
| 18 | |
| 19 | std::unique_ptr<FILE, FileCloser> file; |
| 20 | uint32_t recordCount = 0; |
| 21 | uint32_t recordVersion = 0; |
| 22 | uint32_t recordsRead = 0; |
| 23 | |
| 24 | public: |
| 25 | |
| 26 | ObjectFileReader(std::string filePath, uint32_t recordSize) : |
| 27 | filePath(std::move(filePath)), |
| 28 | recordSize(recordSize) |
| 29 | {} |
| 30 | |
| 31 | bool open(); |
| 32 | void close(); |
| 33 | |
| 34 | bool hasNext() const { return recordsRead < recordCount; } |
| 35 | bool readNext(void* output); |
| 36 | |
| 37 | uint32_t getRecordCount() const { return recordCount; } |
| 38 | uint32_t getRecordSize() const { return recordSize; } |
| 39 | uint32_t getRecordVersion() const { return recordVersion; } |
| 40 | }; |
| 41 | |
| 42 | class ObjectFileWriter { |
| 43 |
no outgoing calls
no test coverage detected