#ifndef _RECEIVER_HPP #define _RECEIVER_HPP #include "Runtime.hpp" #include "AsyncManager.hpp" #include #include #include "basic-coro/AwaitableTask.hpp" namespace Receiver { class Simple { Runtime& runtime; AsyncManager &aMan; protected: int fd; public: Simple(AsyncManager& asyncManager, int fd) : runtime(asyncManager.getRuntime()), aMan(asyncManager), fd(fd) {} // Reads the exact amount of bytes given basiccoro::AwaitableTask read(size_t amount); basiccoro::AwaitableTask read(std::byte *buffer, size_t size); // Reads at max. the amount of bytes given basiccoro::AwaitableTask readSome(size_t max); // Reads an object of type T template auto readObject(T& o) { return read(reinterpret_cast(&o), sizeof(o)); } }; } #endif