diff options
author | bd <bdunahu@operationnull.com> | 2025-04-14 23:40:25 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-14 23:40:25 -0400 |
commit | a7620015acc2401165b4587cbb6c9a118d944493 (patch) | |
tree | 5bbe698fe42a7d32578df6170e464508a78a8e50 /src/storage.cc | |
parent | 2140a23041d3920e001457f2c2acb0853094963d (diff) |
Add preprocess method to storage, removing nearly all duplication
Diffstat (limited to 'src/storage.cc')
-rw-r--r-- | src/storage.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/storage.cc b/src/storage.cc index 17c902d..ee2e7e7 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -1,6 +1,7 @@ #include "storage.h" #include "definitions.h" #include <algorithm> +#include <stdexcept> Storage::Storage(int delay) { @@ -21,6 +22,18 @@ Storage::view(int base, int lines) const } int +Storage::preprocess(void *id) +{ + if (id == nullptr) + throw std::invalid_argument("Accessor cannot be nullptr."); + + if (this->current_request == nullptr) + this->current_request = id; + + return this->current_request == id; +} + +int Storage::is_data_ready() { int r; |