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