diff options
author | bd <bdunahu@operationnull.com> | 2025-04-14 23:10:18 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-14 23:10:18 -0400 |
commit | 661ba30d5233e1b95ac312e88cd51380e664933b (patch) | |
tree | bc9bba3e3e87025eebf86e6b5013485088cf0ccf /src/storage.cc | |
parent | 432e6f63ab4742ebf34ba7d031e269af810aa93f (diff) |
Initial refactor of is_access_cleared
Diffstat (limited to 'src/storage.cc')
-rw-r--r-- | src/storage.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/storage.cc b/src/storage.cc index 4ad916b..b6be578 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -2,7 +2,8 @@ #include "definitions.h" #include <algorithm> -Storage::Storage(int delay) { +Storage::Storage(int delay) +{ this->data = new std::vector<std::array<signed int, LINE_SIZE>>; this->delay = delay; this->lower = nullptr; @@ -18,3 +19,20 @@ Storage::view(int base, int lines) const std::copy(this->data->begin() + base, this->data->begin() + base + lines, ret.begin()); return ret; } + +int +Storage::is_access_cleared() +{ + int r; + + r = 0; + if (this->wait_time == 0) { + this->current_request = nullptr; + this->wait_time = delay; + r = 1; + } else { + --this->wait_time; + } + + return r; +} |