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; |
| 17 | std::string m_value; |
| 18 | }; |
| 19 | |
Václav Kubernát | ab53899 | 2019-03-06 15:30:50 +0100 | [diff] [blame] | 20 | struct binary_ { |
| 21 | binary_(); |
| 22 | binary_(const std::string& value); |
| 23 | bool operator==(const binary_& b) const; |
| 24 | std::string m_value; |
| 25 | }; |
| 26 | |
Václav Kubernát | eeb3884 | 2019-03-20 19:46:05 +0100 | [diff] [blame] | 27 | struct module_ { |
| 28 | bool operator==(const module_& b) const; |
| 29 | std::string m_name; |
| 30 | }; |
| 31 | |
| 32 | struct identityRef_ { |
| 33 | identityRef_(); |
| 34 | identityRef_(const std::string& module, const std::string& value); |
| 35 | identityRef_(const std::string& value); |
| 36 | bool operator==(const identityRef_& b) const; |
| 37 | boost::optional<module_> m_prefix; |
| 38 | std::string m_value; |
| 39 | }; |
| 40 | |
Václav Kubernát | 144729d | 2020-01-08 15:20:35 +0100 | [diff] [blame] | 41 | enum class SpecialValue { |
| 42 | List, |
| 43 | Container, |
| 44 | PresenceContainer |
| 45 | }; |
| 46 | |
| 47 | struct special_ { |
| 48 | bool operator==(const special_& b) const; |
| 49 | SpecialValue m_value; |
| 50 | }; |
| 51 | |
| 52 | std::string specialValueToString(const special_& value); |
| 53 | |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 54 | using leaf_data_ = boost::variant<enum_, |
Václav Kubernát | ab53899 | 2019-03-06 15:30:50 +0100 | [diff] [blame] | 55 | binary_, |
Václav Kubernát | eeb3884 | 2019-03-20 19:46:05 +0100 | [diff] [blame] | 56 | identityRef_, |
Václav Kubernát | 144729d | 2020-01-08 15:20:35 +0100 | [diff] [blame] | 57 | special_, |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 58 | double, |
| 59 | bool, |
Ivona Oboňová | 88c78ca | 2019-07-02 18:40:07 +0200 | [diff] [blame] | 60 | int8_t, |
| 61 | uint8_t, |
| 62 | int16_t, |
| 63 | uint16_t, |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 64 | int32_t, |
| 65 | uint32_t, |
Ivona Oboňová | 88c78ca | 2019-07-02 18:40:07 +0200 | [diff] [blame] | 66 | int64_t, |
| 67 | uint64_t, |
Václav Kubernát | 627f615 | 2018-08-29 13:23:56 +0200 | [diff] [blame] | 68 | std::string>; |