-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
com.h
38 lines (28 loc) · 722 Bytes
/
com.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <atomic>
#include <cstdint>
#include <cstdlib>
#include <string>
class com_client
{
protected:
std::atomic_bool *const stop { nullptr };
public:
com_client(std::atomic_bool *const stop);
virtual ~com_client();
virtual std::string get_local_address() const = 0;
virtual std::string get_endpoint_name() const = 0;
virtual bool recv(uint8_t *const to, const size_t n) = 0;
virtual bool send(const uint8_t *const from, const size_t n) = 0;
};
class com
{
protected:
std::atomic_bool *const stop { nullptr };
public:
com(std::atomic_bool *const stop);
virtual ~com();
virtual bool begin() = 0;
virtual std::string get_local_address() const = 0;
virtual com_client *accept() = 0;
};