-
Notifications
You must be signed in to change notification settings - Fork 4
/
cli_test.cpp
54 lines (41 loc) · 1.08 KB
/
cli_test.cpp
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "cli_test.h"
using namespace RoseCommon;
using namespace RoseCommon::Packet;
CliTest::CliTest() : CRosePacket(CliTest::PACKET_ID) {
}
CliTest::CliTest(CRoseReader reader) : CRosePacket(reader) {
if (!reader.get_uint8_t(test)) {
return;
}
}
CliTest& CliTest::set_test(const uint8_t test) {
this->test = test;
return *this;
}
uint8_t CliTest::get_test() const {
return test;
}
CliTest CliTest::create(const uint8_t& test) {
CliTest packet;
packet.set_test(test);
return packet;
}
CliTest CliTest::create(const uint8_t* buffer) {
CRoseReader reader(buffer, CRosePacket::size(buffer));
return CliTest(reader);
}
std::unique_ptr<CliTest> CliTest::allocate(const uint8_t* buffer) {
CRoseReader reader(buffer, CRosePacket::size(buffer));
return std::make_unique<CliTest>(reader);
}
bool CliTest::pack(CRoseBasePolicy& writer) const {
if (!writer.set_uint8_t(test)) {
return false;
}
return true;
}
constexpr size_t CliTest::size() {
size_t size = 0;
size += sizeof(uint8_t); // test
return size;
}