blob: 42608f71b4a579d8a3698b7be5145dfd56582211 [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
Václav Kubernát144729d2020-01-08 15:20:35 +010057enum class SpecialValue {
58 List,
Václav Kubernát5b8a8f32020-05-20 00:57:22 +020059 LeafList,
Václav Kubernát144729d2020-01-08 15:20:35 +010060 Container,
61 PresenceContainer
62};
63
64struct special_ {
65 bool operator==(const special_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010066 bool operator<(const special_& b) const;
Václav Kubernát144729d2020-01-08 15:20:35 +010067 SpecialValue m_value;
68};
69
70std::string specialValueToString(const special_& value);
71
Václav Kubernát627f6152018-08-29 13:23:56 +020072using leaf_data_ = boost::variant<enum_,
Václav Kubernátab538992019-03-06 15:30:50 +010073 binary_,
Jan Kundrát379bb572020-05-07 03:23:13 +020074 empty_,
Václav Kubernát19097f32020-10-05 10:08:29 +020075 bits_,
Václav Kubernáteeb38842019-03-20 19:46:05 +010076 identityRef_,
Václav Kubernát144729d2020-01-08 15:20:35 +010077 special_,
Václav Kubernát627f6152018-08-29 13:23:56 +020078 double,
79 bool,
Ivona Oboňová88c78ca2019-07-02 18:40:07 +020080 int8_t,
81 uint8_t,
82 int16_t,
83 uint16_t,
Václav Kubernát627f6152018-08-29 13:23:56 +020084 int32_t,
85 uint32_t,
Ivona Oboňová88c78ca2019-07-02 18:40:07 +020086 int64_t,
87 uint64_t,
Václav Kubernát627f6152018-08-29 13:23:56 +020088 std::string>;