diff options
| author | Christian Krinitsin <mail@krinitsin.com> | 2025-03-20 17:35:29 +0100 |
|---|---|---|
| committer | Christian Krinitsin <mail@krinitsin.com> | 2025-03-20 17:35:29 +0100 |
| commit | 75390f5097cb3116de20663bc5fb7490b6a0c1b3 (patch) | |
| tree | 5330cd226e75d0877559c6357511cbe7c501d871 /src/server/main.cpp | |
| parent | 1784e4a2a938bdef104135bfbf03f7b47ca0b507 (diff) | |
| download | BT-Programming-Assignment-75390f5097cb3116de20663bc5fb7490b6a0c1b3.tar.gz BT-Programming-Assignment-75390f5097cb3116de20663bc5fb7490b6a0c1b3.zip | |
server: implement a SharedMemoryServer with (de)initilization of the memory buffer
Diffstat (limited to 'src/server/main.cpp')
| -rw-r--r-- | src/server/main.cpp | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/server/main.cpp b/src/server/main.cpp index b2f8bed..4dd7761 100644 --- a/src/server/main.cpp +++ b/src/server/main.cpp @@ -1,8 +1,9 @@ #include <cstdint> +#include <iostream> #include <stdexcept> #include <string> -#include "hashtable.h" +#include "shared_memory_server.h" int main(int argc, char* argv[]) { @@ -18,29 +19,8 @@ int main(int argc, char* argv[]) std::cout << "Invalid argument" << '\n'; return 1; } - - HashTable<int, std::string> hash_table { size }; - std::cout << "Add various kv-pairs" << '\n'; - hash_table.insert(1, "1"); - hash_table.insert(2, "2"); - hash_table.insert(3, "3"); - hash_table.insert(4, "4"); - hash_table.insert(5, "5"); - hash_table.insert(6, "6"); - hash_table.insert(7, "7"); - - hash_table.print(); - - std::cout << '\n'; - - std::cout << "Value for key 8: " << hash_table.get(8).value_or("Key not found!") << '\n'; - std::cout << "Value for key 4: " << hash_table.get(4).value_or("Key not found!") << '\n'; - - std::cout << '\n'; - std::cout << "Remove pair with key 5" << '\n'; - hash_table.remove(5); - hash_table.print(); + SharedMemoryServer<int, std::string> shm(size); return 0; } |