-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLink.h
63 lines (52 loc) · 1.44 KB
/
Link.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**************************************************************************
* @file: Link.h
* @brief:
*
* Copyright (c) 2022 O-Net Communications Inc.
* All rights reserved.
*************************************************************************/
#pragma once
#include <common/Uuid.h>
namespace cppbase { namespace sequence {
struct Link
{
explicit Link(uuids::uuid src, uuids::uuid dst, uint32_t src_id = 0, uint32_t dst_id = 0)
: m_src(src), m_dst(dst), m_src_id(src_id), m_dst_id(dst_id)
{}
Link() = default;
~Link() = default;
Link(const Link& other)
{
m_src = other.m_src;
m_dst = other.m_dst;
m_src_id = other.m_src_id;
m_dst_id = other.m_dst_id;
}
Link& operator=(const Link& other)
{
m_src = other.m_src;
m_dst = other.m_dst;
m_src_id = other.m_src_id;
m_dst_id = other.m_dst_id;
return *this;
}
bool operator==(const Link& other)
{
return (m_src == other.m_src && m_dst == other.m_dst &&
m_src_id == other.m_src_id && m_dst_id == other.m_dst_id);
}
bool operator!=(const Link& other)
{
return !(*this == other);
}
uuids::uuid m_src;
uuids::uuid m_dst;
uint32_t m_src_id{0};
uint32_t m_dst_id{0};
template<class Archive>
void serialize(Archive& archive, const uint32_t)
{
archive(m_src, m_dst, m_src_id, m_dst_id);
}
};
}} // namespaces