From 186aa674239777bfba4d4fdf0b5974f40aaff081 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Mon, 15 May 2017 22:27:57 -0400 Subject: Add C++ type aliases Add convenience type aliases for working with references: RefKeyMap: A map with references as keys. TupleRefMap: A map with a tuple of references as keys. RefVector: A vector or references. TupleOfRefs: A tuple of references. Add DBus related convenience type aliases: MapperPath: The Phosphor mapper currently uses a std::string for object paths. This is a bug and will someday be switched to sdbusplus::message::object_path. Add an alias for easy refactoring. InterfacesAdded: The C++ type for the org.freedesktop.DBus.ObjectManager.InterfacesAdded signal argument. PropertiesChanged: The C++ type for the org.freedesktop.DBus.Properties.PropertiesChanged signal argument. GetObject: The C++ type for the xyz.openbmc_project.ObjectMapper.GetMethod method response. Change-Id: I719aa7c610b3312ce8e52825cb07b33a348bf896 Signed-off-by: Brad Bishop --- src/data_types.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/data_types.hpp') 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 +#include #include #include +#include "tupleref.hpp" + +namespace any_ns = std::experimental; namespace phosphor { @@ -28,6 +32,43 @@ using Condition = std::function; +/** @brief A map with references as keys. */ +template +using RefKeyMap = std::map, Value, std::less>; + +/** @brief A map with a tuple of references as keys. */ +template +using TupleRefMap = std::map, Value, TupleOfRefsLess>; + +/** @brief A vector of references. */ +template +using RefVector = std::vector>; + +/** @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 +using InterfacesAdded = std::map < + std::string, + std::map < + std::string, + sdbusplus::message::variant>>; + +/** @brief ObjectMapper.GetObject response signature alias. */ +using GetObject = std::map>; + +/** @brief Properties.GetAll response signature alias. */ +template +using PropertiesChanged = std::map < + std::string, + sdbusplus::message::variant>; + } // namespace monitoring } // namespace dbus } // namespace phosphor -- cgit v1.2.1