From c84c62400b9bc12236556e45af7601553cc87286 Mon Sep 17 00:00:00 2001 From: shr3dd3r Date: Wed, 6 Sep 2023 06:11:26 +0300 Subject: [PATCH] Specs change - so implementation change --- src/Event.hpp | 10 +++------- src/EventQueue.hpp | 9 ++++----- src/KLDR.hpp | 2 +- src/test.cpp | 5 ----- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/Event.hpp b/src/Event.hpp index ad48b49..ed83261 100644 --- a/src/Event.hpp +++ b/src/Event.hpp @@ -16,19 +16,15 @@ namespace Stadium { namespace v1 { -template > // TODO: переделать через рантайм-дрисню class Event { - // TODO: add static assertion of PayloadT (???) - // P.S.: https://stackoverflow.com/questions/874298/c-templates-that-accept-only-certain-types - public: struct { - CategoryT Category; - SubcategoryT Subcategory; + uint8_t Category; + uint8_t Subcategory; } Type; // ??? uint32_t ServerSession; // TODO: payload hash - PayloadT Payload; + Base::KLDRArray<> Payload; }; } diff --git a/src/EventQueue.hpp b/src/EventQueue.hpp index 672dfe3..fde18c1 100644 --- a/src/EventQueue.hpp +++ b/src/EventQueue.hpp @@ -15,16 +15,15 @@ namespace Stadium { -namespace Base { +namespace v1 { -template > // TODO: переделать через рантайм-дрисню class EventQueue { protected: - std::vector Queue; + std::vector Array; public: - //void Add (EventT); - //EventT Get (); + //void Add (Event); + //Event Get (); }; } diff --git a/src/KLDR.hpp b/src/KLDR.hpp index 304dc8e..395ffa5 100644 --- a/src/KLDR.hpp +++ b/src/KLDR.hpp @@ -44,7 +44,7 @@ namespace Base { * KLDR stands for "Key-Length-Data-Repeat" * Schematically, binary array with KLDR-formatted data looks like this. * Single cell: - * [key: 1/2 bytes][length of data: 1/2/4 bytes][data: length of data bytes] + * [key: 1/2 bytes][length of data: 1/2/4 bytes][data: bytes] * Whole array: * [cell 1][cell 2]...[cell n] * diff --git a/src/test.cpp b/src/test.cpp index a480be8..f014ba3 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -15,14 +15,9 @@ int main () { arr.Add(0xF4, sizeof(str3), (void*)&str3); arr.Add(0x6a, sizeof(str4), (void*)&str4); arr.Add(Stadium::Base::KLDRDefaultKeys::SignedDataHash, sizeof(str5), (void*)&str5); - arr.Print(); std::cout << "Shuffling!" << std::endl; arr.Shuffle(); arr.Print(); - size_t arr_sz = arr.FlatSize(); - std::cout << "Calculated flat binary array size: " << arr_sz << std::endl; - std::cout << "Its contents:" << std::endl; - Stadium::Utils::PrintArray(arr.AsArray()); return 0; } \ No newline at end of file