blob: 228aac35a27b15946c8edb8842073cba3626c8b4 [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>
Václav Kubernát19097f32020-10-05 10:08:29 +020012#include <set>
Václav Kubernát627f6152018-08-29 13:23:56 +020013
14struct enum_ {
15 enum_();
16 enum_(const std::string& value);
17 bool operator==(const enum_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010018 bool operator<(const enum_& b) const;
Václav Kubernát627f6152018-08-29 13:23:56 +020019 std::string m_value;
20};
21
Václav Kubernátab538992019-03-06 15:30:50 +010022struct binary_ {
23 binary_();
24 binary_(const std::string& value);
25 bool operator==(const binary_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010026 bool operator<(const binary_& b) const;
Václav Kubernátab538992019-03-06 15:30:50 +010027 std::string m_value;
28};
29
Jan Kundrát379bb572020-05-07 03:23:13 +020030struct empty_ {
31 empty_();
32 bool operator==(const empty_) const;
33 bool operator<(const empty_) const;
34};
35
Václav Kubernát19097f32020-10-05 10:08:29 +020036struct bits_ {
37 bool operator==(const bits_&) const;
38 bool operator<(const bits_&) const;
39 std::set<std::string> m_bits;
40};
41
Václav Kubernáteeb38842019-03-20 19:46:05 +010042struct module_ {
43 bool operator==(const module_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010044 bool operator<(const module_& b) const;
Václav Kubernáteeb38842019-03-20 19:46:05 +010045 std::string m_name;
46};
47
48struct identityRef_ {
49 identityRef_();
50 identityRef_(const std::string& module, const std::string& value);
51 identityRef_(const std::string& value);
52 bool operator==(const identityRef_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010053 bool operator<(const identityRef_& b) const;
Václav Kubernáteeb38842019-03-20 19:46:05 +010054 boost::optional<module_> m_prefix;
55 std::string m_value;
56};
57
Václav Kubernát144729d2020-01-08 15:20:35 +010058enum class SpecialValue {
59 List,
Václav Kubernát5b8a8f32020-05-20 00:57:22 +020060 LeafList,
Václav Kubernát144729d2020-01-08 15:20:35 +010061 Container,
62 PresenceContainer
63};
64
65struct special_ {
66 bool operator==(const special_& b) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010067 bool operator<(const special_& b) const;
Václav Kubernát144729d2020-01-08 15:20:35 +010068 SpecialValue m_value;
69};
70
71std::string specialValueToString(const special_& value);
72
Václav Kubernát627f6152018-08-29 13:23:56 +020073using leaf_data_ = boost::variant<enum_,
Václav Kubernátab538992019-03-06 15:30:50 +010074 binary_,
Jan Kundrát379bb572020-05-07 03:23:13 +020075 empty_,
Václav Kubernát19097f32020-10-05 10:08:29 +020076 bits_,
Václav Kubernáteeb38842019-03-20 19:46:05 +010077 identityRef_,
Václav Kubernát144729d2020-01-08 15:20:35 +010078 special_,
Václav Kubernát627f6152018-08-29 13:23:56 +020079 double,
80 bool,
Ivona Oboňová88c78ca2019-07-02 18:40:07 +020081 int8_t,
82 uint8_t,
83 int16_t,
84 uint16_t,
Václav Kubernát627f6152018-08-29 13:23:56 +020085 int32_t,
86 uint32_t,
Ivona Oboňová88c78ca2019-07-02 18:40:07 +020087 int64_t,
88 uint64_t,
Václav Kubernát627f6152018-08-29 13:23:56 +020089 std::string>;