-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathframework.cpp
More file actions
33 lines (26 loc) · 735 Bytes
/
framework.cpp
File metadata and controls
33 lines (26 loc) · 735 Bytes
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
#include "framework.h"
using namespace std;
DATA_BYTES Serializable::SerializeToBuffer() const
{
DATA_BYTES buffer;
buffer.resize(GetLength());
char *d = buffer.data();
Serialize(d);
return buffer;
}
void Serializable::Parse(const char *data, int data_len) { ParseRef(data, data_len); }
void Serializable::Parse(DATA_BYTES data_b) { Parse(data_b.data(), data_b.size()); }
DATA_BYTES Serializable::AllocateBuffer()
{
DATA_BYTES buffer;
buffer.resize(GetLength());
return buffer;
}
void DataLayer::send_data(DATA_BYTES data) { send_data(data.data(), data.size()); }
DATA_BYTES DataLayer::receive_data(int len)
{
DATA_BYTES b;
b.resize(len);
receive_data(b.data(), len);
return b;
}