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