Pass-by-reference instead of pointer.
This commit is contained in:
@@ -35,11 +35,11 @@ class ProcessMemoryDataFacade final : public ContiguousInternalMemoryDataFacadeB
|
||||
|
||||
// Calculate the layout/size of the memory block
|
||||
internal_layout = std::make_unique<storage::DataLayout>();
|
||||
storage.LoadLayout(internal_layout.get());
|
||||
storage.PopulateLayout(*internal_layout);
|
||||
|
||||
// Allocate the memory block, then load data from files into it
|
||||
internal_memory = std::make_unique<char[]>(internal_layout->GetSizeOfLayout());
|
||||
storage.LoadData(internal_layout.get(), internal_memory.get());
|
||||
storage.PopulateData(*internal_layout, internal_memory.get());
|
||||
|
||||
// Adjust all the private m_* members to point to the right places
|
||||
Init(internal_layout.get(), internal_memory.get());
|
||||
|
||||
@@ -122,7 +122,6 @@ class FileReader
|
||||
{
|
||||
while (std::getline(input_stream, thisline))
|
||||
{
|
||||
std::clog << "Read " << thisline << std::endl;
|
||||
result.push_back(thisline);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ struct DataLayout
|
||||
}
|
||||
|
||||
template <typename T, bool WRITE_CANARY = false>
|
||||
inline T *GetBlockPtr(char *shared_memory, BlockID bid)
|
||||
inline T *GetBlockPtr(char *shared_memory, BlockID bid) const
|
||||
{
|
||||
T *ptr = (T *)(shared_memory + GetBlockOffset(bid));
|
||||
if (WRITE_CANARY)
|
||||
|
||||
@@ -53,8 +53,8 @@ class Storage
|
||||
|
||||
ReturnCode Run(int max_wait);
|
||||
|
||||
void LoadLayout(DataLayout *layout);
|
||||
void LoadData(DataLayout *layout_ptr, char *memory_ptr);
|
||||
void PopulateLayout(DataLayout &layout);
|
||||
void PopulateData(const DataLayout &layout, char *memory_ptr);
|
||||
|
||||
private:
|
||||
StorageConfig config;
|
||||
|
||||
Reference in New Issue
Block a user