prototyping protocol stuff

This commit is contained in:
2022-04-23 03:04:41 +02:00
parent cc029ba804
commit a3901029a4
5 changed files with 221 additions and 7 deletions

View File

@@ -1,15 +1,27 @@
#include <iostream>
#include <boost/asio.hpp>
#include "crow.h"
#include "protocol.hpp"
int main()
{
crow::SimpleApp app;
using namespace commons::protocol;
auto draw_msg = draw_rectangle{};
CROW_ROUTE(app, "/")([]() {
return "Hello World";
});
for(int i = 0; i < 3; ++i)
{
std::cout << "Size of " << i << " is " << get_size(static_cast<Type>(i)) << "\n";
}
auto rectangle = std::make_unique<draw_pixel>();
void* void_ptr = reinterpret_cast<void*>(rectangle.get());
generic_message_base* rectangle_ptr = reinterpret_cast<generic_message_base*>(void_ptr);
std::cout << "Type: " << static_cast<int>(rectangle_ptr->get_type()) << "\n";
std::cout << "Size: " << static_cast<int>(rectangle_ptr->get_size()) << "\n";
auto* final_msg = get_object(rectangle_ptr->get_type(), rectangle_ptr);
app.port(18080).run();
return 0;
}