mirror of
https://gitlab.com/niansa/llama_any.git
synced 2025-03-06 20:48:27 +01:00
25 lines
513 B
C++
25 lines
513 B
C++
#ifndef _SENDER_HPP
|
|
#define _SENDER_HPP
|
|
#include <string_view>
|
|
#include <vector>
|
|
#include <cstddef>
|
|
|
|
|
|
namespace Sender {
|
|
class Simple {
|
|
protected:
|
|
int fd;
|
|
|
|
public:
|
|
Simple(int fd) : fd(fd) {}
|
|
|
|
void write(std::string_view, bool moreData = false);
|
|
void write(const std::byte *data, size_t, bool moreData = false);
|
|
|
|
template<typename T>
|
|
auto writeObject(const T& o, bool moreData = false) {
|
|
return write(reinterpret_cast<const std::byte *>(&o), sizeof(o), moreData);
|
|
}
|
|
};
|
|
}
|
|
#endif
|