-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathleaf_data_type.cpp
More file actions
119 lines (118 loc) · 2.67 KB
/
leaf_data_type.cpp
File metadata and controls
119 lines (118 loc) · 2.67 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/
*
* Written by Václav Kubernát <[email protected]>
*
*/
#include "ast_values.hpp"
#include "leaf_data_type.hpp"
namespace yang {
bool TypeInfo::operator==(const TypeInfo& other) const
{
return std::tie(this->m_type, this->m_units, this->m_description) == std::tie(other.m_type, other.m_units, other.m_description);
}
TypeInfo::TypeInfo(const yang::LeafDataType& type, const std::optional<std::string> units, const std::optional<std::string> description)
: m_type(type)
, m_units(units)
, m_description(description)
{
}
Enum::Enum(std::set<enum_>&& values)
: m_allowedValues(std::move(values))
{
}
bool Enum::operator==(const Enum& other) const
{
return this->m_allowedValues == other.m_allowedValues;
}
IdentityRef::IdentityRef(std::set<identityRef_>&& values)
: m_allowedValues(std::move(values))
{
}
bool IdentityRef::operator==(const IdentityRef& other) const
{
return this->m_allowedValues == other.m_allowedValues;
}
// Copy constructor needed, because unique_ptr is not copy-constructible
LeafRef::LeafRef(const LeafRef& src)
: m_targetXPath(src.m_targetXPath)
, m_targetType(std::make_unique<TypeInfo>(*src.m_targetType))
{
}
LeafRef::LeafRef(const std::string& xpath, std::unique_ptr<TypeInfo>&& type)
: m_targetXPath(xpath)
, m_targetType(std::move(type))
{
}
bool LeafRef::operator==(const LeafRef& other) const
{
return this->m_targetXPath == other.m_targetXPath && *this->m_targetType == *other.m_targetType;
}
bool Union::operator==(const Union& other) const
{
return this->m_unionTypes == other.m_unionTypes;
}
bool String::operator==(const String&) const
{
return true;
}
bool Decimal::operator==(const Decimal&) const
{
return true;
}
bool Bool::operator==(const Bool&) const
{
return true;
}
bool Int8::operator==(const Int8&) const
{
return true;
}
bool Uint8::operator==(const Uint8&) const
{
return true;
}
bool Int16::operator==(const Int16&) const
{
return true;
}
bool Uint16::operator==(const Uint16&) const
{
return true;
}
bool Int32::operator==(const Int32&) const
{
return true;
}
bool Uint32::operator==(const Uint32&) const
{
return true;
}
bool Int64::operator==(const Int64&) const
{
return true;
}
bool Uint64::operator==(const Uint64&) const
{
return true;
}
bool Binary::operator==(const Binary&) const
{
return true;
}
bool Empty::operator==(const Empty&) const
{
return true;
}
bool Bits::operator==(const Bits& other) const
{
return this->m_allowedValues == other.m_allowedValues;
}
InstanceIdentifier::InstanceIdentifier()
{
}
bool InstanceIdentifier::operator==(const InstanceIdentifier&) const
{
return true;
}
}