From 1fb7a9bd5eb41e87871bcbb3423caaabdd8ce1d9 Mon Sep 17 00:00:00 2001 From: bd Date: Fri, 11 Apr 2025 21:22:18 -0400 Subject: First part of storage rework (see description) - Removed response enum. - Removed messy ostream override, and cli.cc test class - Removed accessor enum, and instead used unique pointer to identify accessor. - Simplified storage by removing is_waiting variables. - Rewrote DRAM and Cache to use Storage constructor. --- src/storage.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/storage.cc') diff --git a/src/storage.cc b/src/storage.cc index fed607b..4ad916b 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -2,15 +2,19 @@ #include "definitions.h" #include +Storage::Storage(int delay) { + this->data = new std::vector>; + this->delay = delay; + this->lower = nullptr; + this->current_request = nullptr; + this->wait_time = this->delay; +} + std::vector> Storage::view(int base, int lines) const { base = (base / LINE_SIZE) * LINE_SIZE; std::vector> ret(lines + 1); - std::copy( - this->data->begin() + base, this->data->begin() + base + lines, - ret.begin()); + std::copy(this->data->begin() + base, this->data->begin() + base + lines, ret.begin()); return ret; } - -Storage *Storage::get_lower() { return this->lower; } -- cgit v1.2.3