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