Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 1 | /* |
| 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át | eeb3884 | 2019-03-20 19:46:05 +0100 | [diff] [blame] | 10 | #include <boost/optional.hpp> |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 11 | #include <boost/variant.hpp> |
Václav Kubernát | 19097f3 | 2020-10-05 10:08:29 +0200 | [diff] [blame] | 12 | #include <set> |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 13 | |
| 14 | struct enum_ { |
| 15 | enum_(); |
| 16 | enum_(const std::string& value); |
| 17 | bool operator==(const enum_& b) const; |
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 18 | bool operator<(const enum_& b) const; |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 19 | std::string m_value; |
| 20 | }; |
| 21 | |
Václav Kubernát | ab53899 | 2019-03-06 15:30:50 +0100 | [diff] [blame] | 22 | struct binary_ { |
| 23 | binary_(); |
| 24 | binary_(const std::string& value); |
| 25 | bool operator==(const binary_& b) const; |
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 26 | bool operator<(const binary_& b) const; |
Václav Kubernát | ab53899 | 2019-03-06 15:30:50 +0100 | [diff] [blame] | 27 | std::string m_value; |
| 28 | }; |
| 29 | |
Jan Kundrát | 379bb57 | 2020-05-07 03:23:13 +0200 | [diff] [blame] | 30 | struct empty_ { |
| 31 | empty_(); |
| 32 | bool operator==(const empty_) const; |
| 33 | bool operator<(const empty_) const; |
| 34 | }; |
| 35 | |
Václav Kubernát | 19097f3 | 2020-10-05 10:08:29 +0200 | [diff] [blame] | 36 | struct 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át | eeb3884 | 2019-03-20 19:46:05 +0100 | [diff] [blame] | 42 | struct module_ { |
| 43 | bool operator==(const module_& b) const; |
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 44 | bool operator<(const module_& b) const; |
Václav Kubernát | eeb3884 | 2019-03-20 19:46:05 +0100 | [diff] [blame] | 45 | std::string m_name; |
| 46 | }; |
| 47 | |
| 48 | struct 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át | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 53 | bool operator<(const identityRef_& b) const; |
Václav Kubernát | eeb3884 | 2019-03-20 19:46:05 +0100 | [diff] [blame] | 54 | boost::optional<module_> m_prefix; |
| 55 | std::string m_value; |
| 56 | }; |
| 57 | |
Václav Kubernát | 144729d | 2020-01-08 15:20:35 +0100 | [diff] [blame] | 58 | enum class SpecialValue { |
| 59 | List, |
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame] | 60 | LeafList, |
Václav Kubernát | 144729d | 2020-01-08 15:20:35 +0100 | [diff] [blame] | 61 | Container, |
| 62 | PresenceContainer |
| 63 | }; |
| 64 | |
| 65 | struct special_ { |
| 66 | bool operator==(const special_& b) const; |
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 67 | bool operator<(const special_& b) const; |
Václav Kubernát | 144729d | 2020-01-08 15:20:35 +0100 | [diff] [blame] | 68 | SpecialValue m_value; |
| 69 | }; |
| 70 | |
| 71 | std::string specialValueToString(const special_& value); |
| 72 | |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 73 | using leaf_data_ = boost::variant<enum_, |
Václav Kubernát | ab53899 | 2019-03-06 15:30:50 +0100 | [diff] [blame] | 74 | binary_, |
Jan Kundrát | 379bb57 | 2020-05-07 03:23:13 +0200 | [diff] [blame] | 75 | empty_, |
Václav Kubernát | 19097f3 | 2020-10-05 10:08:29 +0200 | [diff] [blame] | 76 | bits_, |
Václav Kubernát | eeb3884 | 2019-03-20 19:46:05 +0100 | [diff] [blame] | 77 | identityRef_, |
Václav Kubernát | 144729d | 2020-01-08 15:20:35 +0100 | [diff] [blame] | 78 | special_, |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 79 | double, |
| 80 | bool, |
Ivona Oboňová | 88c78ca | 2019-07-02 18:40:07 +0200 | [diff] [blame] | 81 | int8_t, |
| 82 | uint8_t, |
| 83 | int16_t, |
| 84 | uint16_t, |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 85 | int32_t, |
| 86 | uint32_t, |
Ivona Oboňová | 88c78ca | 2019-07-02 18:40:07 +0200 | [diff] [blame] | 87 | int64_t, |
| 88 | uint64_t, |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 89 | std::string>; |