Refactor BinaryTable file handling to use C-style file operations and improve memory management

This commit is contained in:
ImBenji
2025-10-12 16:04:23 +01:00
parent b15d11a5a4
commit 75d682a41d
6 changed files with 421 additions and 626 deletions

View File

@@ -29,6 +29,18 @@ This file is part of the SweepStore (formerly Binary Table) package for C++.
#include <stdexcept>
#include <type_traits>
#include <functional>
#include <iostream>
// Debug control - comment out this line to disable all debug output
// #define ENABLE_DEBUG 1
#ifdef ENABLE_DEBUG
#define DEBUG_PRINT(x) std::cout << x
#define DEBUG_PRINTLN(x) std::cout << x << std::endl
#else
#define DEBUG_PRINT(x)
#define DEBUG_PRINTLN(x)
#endif
namespace bt {
@@ -164,13 +176,14 @@ public:
// Main BinaryTable class
class BinaryTable {
private:
std::fstream file_;
FILE* file_;
std::string filePath_;
// Free list management
bool freeListLifted_;
std::vector<BT_FreeListEntry> freeListCache_;
// Internal methods
std::unordered_map<int64_t, BT_Pointer> getAddressTable();
void setAddressTable(const std::unordered_map<int64_t, BT_Pointer>& table);