Specs change - so implementation change
This commit is contained in:
parent
ef784580b4
commit
c84c62400b
@ -16,19 +16,15 @@
|
||||
namespace Stadium {
|
||||
namespace v1 {
|
||||
|
||||
template <typename CategoryT = uint8_t, typename SubcategoryT = uint8_t, typename PayloadT = KLDRArray<>> // 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -15,16 +15,15 @@
|
||||
|
||||
|
||||
namespace Stadium {
|
||||
namespace Base {
|
||||
namespace v1 {
|
||||
|
||||
template <typename EventT = Event<>> // TODO: переделать через рантайм-дрисню
|
||||
class EventQueue {
|
||||
protected:
|
||||
std::vector<EventT> Queue;
|
||||
std::vector<Event> Array;
|
||||
|
||||
public:
|
||||
//void Add (EventT);
|
||||
//EventT Get ();
|
||||
//void Add (Event);
|
||||
//Event Get ();
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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: <length of data> bytes]
|
||||
* Whole array:
|
||||
* [cell 1][cell 2]...[cell n]
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user