Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <functional> |
Brad Bishop | 186aa67 | 2017-05-15 22:27:57 -0400 | [diff] [blame] | 4 | #include <experimental/any> |
Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 5 | #include <sdbusplus/bus.hpp> |
| 6 | #include <sdbusplus/message.hpp> |
Brad Bishop | 186aa67 | 2017-05-15 22:27:57 -0400 | [diff] [blame] | 7 | #include "tupleref.hpp" |
| 8 | |
| 9 | namespace any_ns = std::experimental; |
Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 10 | |
| 11 | namespace phosphor |
| 12 | { |
| 13 | namespace dbus |
| 14 | { |
| 15 | namespace monitoring |
| 16 | { |
| 17 | |
| 18 | class Monitor; |
| 19 | |
Matthew Barth | c573643 | 2017-04-17 12:22:50 -0500 | [diff] [blame] | 20 | /** @brief The possible item value types */ |
Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 21 | using Value = int64_t; |
| 22 | |
Matthew Barth | c573643 | 2017-04-17 12:22:50 -0500 | [diff] [blame] | 23 | /** @brief A list of what constructs a unique item and its value */ |
Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 24 | using Group = std::vector<std::tuple<std::string, Value>>; |
| 25 | |
Matthew Barth | c573643 | 2017-04-17 12:22:50 -0500 | [diff] [blame] | 26 | /** @brief A conditional function type for item(s) conditions */ |
Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 27 | using Condition = std::function<bool(sdbusplus::bus::bus&, |
| 28 | sdbusplus::message::message&, |
| 29 | Monitor&)>; |
| 30 | |
Matthew Barth | c573643 | 2017-04-17 12:22:50 -0500 | [diff] [blame] | 31 | /** @brief A void function type for actions based condition(s) */ |
Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 32 | using Action = std::function<void(sdbusplus::bus::bus&, |
| 33 | Monitor&)>; |
| 34 | |
Brad Bishop | 186aa67 | 2017-05-15 22:27:57 -0400 | [diff] [blame] | 35 | /** @brief A map with references as keys. */ |
| 36 | template <typename Key, typename Value> |
| 37 | using RefKeyMap = std::map<std::reference_wrapper<Key>, Value, std::less<Key>>; |
| 38 | |
| 39 | /** @brief A map with a tuple of references as keys. */ |
| 40 | template <typename Value, typename ...Keys> |
| 41 | using TupleRefMap = std::map<TupleOfRefs<Keys...>, Value, TupleOfRefsLess>; |
| 42 | |
| 43 | /** @brief A vector of references. */ |
| 44 | template <typename T> |
| 45 | using RefVector = std::vector<std::reference_wrapper<T>>; |
| 46 | |
| 47 | /** @brief |
| 48 | * |
| 49 | * The mapper has a defect such that it provides strings |
| 50 | * rather than object paths. Use an alias for easy refactoring |
| 51 | * when the mapper is fixed. |
| 52 | */ |
| 53 | using MapperPath = std::string; |
| 54 | |
| 55 | /** @brief ObjectManager.InterfacesAdded signal signature alias. */ |
| 56 | template <typename T> |
| 57 | using InterfacesAdded = std::map < |
| 58 | std::string, |
| 59 | std::map < |
| 60 | std::string, |
| 61 | sdbusplus::message::variant<T >>>; |
| 62 | |
| 63 | /** @brief ObjectMapper.GetObject response signature alias. */ |
| 64 | using GetObject = std::map<MapperPath, std::vector<std::string>>; |
| 65 | |
| 66 | /** @brief Properties.GetAll response signature alias. */ |
| 67 | template <typename T> |
| 68 | using PropertiesChanged = std::map < |
| 69 | std::string, |
| 70 | sdbusplus::message::variant<T >>; |
| 71 | |
Matthew Barth | b86374d | 2017-04-12 10:57:19 -0500 | [diff] [blame] | 72 | } // namespace monitoring |
| 73 | } // namespace dbus |
| 74 | } // namespace phosphor |