Refactor BinaryTable file handling to use C-style file operations and improve memory management
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user