blob: 208028b1222fd244be6e5c2e690bab4f54cbb86a [file] [log] [blame]
Václav Kubernát627f6152018-08-29 13:23:56 +02001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
8#pragma once
9
Václav Kubernáteeb38842019-03-20 19:46:05 +010010#include <boost/optional.hpp>
Václav Kubernát627f6152018-08-29 13:23:56 +020011#include <boost/variant.hpp>
12
13struct enum_ {
14 enum_();
15 enum_(const std::string& value);
16 bool operator==(const enum_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010017 bool operator<(const enum_& b) const;
Václav Kubernát627f6152018-08-29 13:23:56 +020018 std::string m_value;
19};
20
Václav Kubernátab538992019-03-06 15:30:50 +010021struct binary_ {
22 binary_();
23 binary_(const std::string& value);
24 bool operator==(const binary_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010025 bool operator<(const binary_& b) const;
Václav Kubernátab538992019-03-06 15:30:50 +010026 std::string m_value;
27};
28
Jan Kundrát379bb572020-05-07 03:23:13 +020029struct empty_ {
30 empty_();
31 bool operator==(const empty_) const;
32 bool operator<(const empty_) const;
33};
34
Václav Kubernát19097f32020-10-05 10:08:29 +020035struct bits_ {
36 bool operator==(const bits_&) const;
37 bool operator<(const bits_&) const;
Václav Kubernát909d9662020-10-30 00:06:34 +010038 std::vector<std::string> m_bits;
Václav Kubernát19097f32020-10-05 10:08:29 +020039};
40
Václav Kubernáteeb38842019-03-20 19:46:05 +010041struct module_ {
42 bool operator==(const module_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010043 bool operator<(const module_& b) const;
Václav Kubernáteeb38842019-03-20 19:46:05 +010044 std::string m_name;
45};
46
47struct identityRef_ {
48 identityRef_();
49 identityRef_(const std::string& module, const std::string& value);
50 identityRef_(const std::string& value);
51 bool operator==(const identityRef_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010052 bool operator<(const identityRef_& b) const;
Václav Kubernáteeb38842019-03-20 19:46:05 +010053 boost::optional<module_> m_prefix;
54 std::string m_value;
55};
56
Jan Kundrátbb7aa852023-08-30 11:51:43 +020057struct instanceIdentifier_ {
58 instanceIdentifier_(const std::string& xpath);
59 bool operator==(const instanceIdentifier_& b) const;
60 bool operator<(const instanceIdentifier_& b) const;
61 std::string m_xpath;
62};
63
Václav Kubernát144729d2020-01-08 15:20:35 +010064enum class SpecialValue {
65 List,
Václav Kubernát5b8a8f32020-05-20 00:57:22 +020066 LeafList,
Václav Kubernát144729d2020-01-08 15:20:35 +010067 Container,
68 PresenceContainer
69};
70
71struct special_ {
72 bool operator==(const special_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010073 bool operator<(const special_& b) const;
Václav Kubernát144729d2020-01-08 15:20:35 +010074 SpecialValue m_value;
75};
76
77std::string specialValueToString(const special_& value);
78
Václav Kubernát627f6152018-08-29 13:23:56 +020079using leaf_data_ = boost::variant<enum_,
Václav Kubernátab538992019-03-06 15:30:50 +010080 binary_,
Jan Kundrát379bb572020-05-07 03:23:13 +020081 empty_,
Václav Kubernát19097f32020-10-05 10:08:29 +020082 bits_,
Václav Kubernáteeb38842019-03-20 19:46:05 +010083 identityRef_,
Jan Kundrátbb7aa852023-08-30 11:51:43 +020084 instanceIdentifier_,
Václav Kubernát144729d2020-01-08 15:20:35 +010085 special_,
Václav Kubernát627f6152018-08-29 13:23:56 +020086 double,
87 bool,
Ivona Oboňová88c78ca2019-07-02 18:40:07 +020088 int8_t,
89 uint8_t,
90 int16_t,
91 uint16_t,
Václav Kubernát627f6152018-08-29 13:23:56 +020092 int32_t,
93 uint32_t,
Ivona Oboňová88c78ca2019-07-02 18:40:07 +020094 int64_t,
95 uint64_t,
Václav Kubernát627f6152018-08-29 13:23:56 +020096 std::string>;