diff options
Diffstat (limited to 'src/data_types.hpp')
-rw-r--r-- | src/data_types.hpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/data_types.hpp b/src/data_types.hpp index cbe6faf..653b7c3 100644 --- a/src/data_types.hpp +++ b/src/data_types.hpp @@ -1,8 +1,12 @@ #pragma once #include <functional> +#include <experimental/any> #include <sdbusplus/bus.hpp> #include <sdbusplus/message.hpp> +#include "tupleref.hpp" + +namespace any_ns = std::experimental; namespace phosphor { @@ -28,6 +32,43 @@ using Condition = std::function<bool(sdbusplus::bus::bus&, using Action = std::function<void(sdbusplus::bus::bus&, Monitor&)>; +/** @brief A map with references as keys. */ +template <typename Key, typename Value> +using RefKeyMap = std::map<std::reference_wrapper<Key>, Value, std::less<Key>>; + +/** @brief A map with a tuple of references as keys. */ +template <typename Value, typename ...Keys> +using TupleRefMap = std::map<TupleOfRefs<Keys...>, Value, TupleOfRefsLess>; + +/** @brief A vector of references. */ +template <typename T> +using RefVector = std::vector<std::reference_wrapper<T>>; + +/** @brief + * + * The mapper has a defect such that it provides strings + * rather than object paths. Use an alias for easy refactoring + * when the mapper is fixed. + */ +using MapperPath = std::string; + +/** @brief ObjectManager.InterfacesAdded signal signature alias. */ +template <typename T> +using InterfacesAdded = std::map < + std::string, + std::map < + std::string, + sdbusplus::message::variant<T >>>; + +/** @brief ObjectMapper.GetObject response signature alias. */ +using GetObject = std::map<MapperPath, std::vector<std::string>>; + +/** @brief Properties.GetAll response signature alias. */ +template <typename T> +using PropertiesChanged = std::map < + std::string, + sdbusplus::message::variant<T >>; + } // namespace monitoring } // namespace dbus } // namespace phosphor |