xref: /openbmc/phosphor-inventory-manager/types.hpp (revision 2b522fe00d2098c9794ede8c98a90039c617415e)
1 #pragma once
2 
3 #include <sdbusplus/message/types.hpp>
4 
5 #include <cstdint>
6 #include <functional>
7 #include <map>
8 #include <string>
9 
10 namespace sdbusplus
11 {
12 namespace message
13 {
14 class message;
15 }
16 namespace bus
17 {
18 class bus;
19 }
20 } // namespace sdbusplus
21 
22 namespace phosphor
23 {
24 namespace inventory
25 {
26 namespace manager
27 {
28 
29 class Manager;
30 
31 /** @brief Inventory manager supported property types. */
32 using InterfaceVariantType =
33     std::variant<bool, size_t, int64_t, std::string, std::vector<uint8_t>>;
34 
35 template <typename T>
36 using InterfaceType = std::map<std::string, T>;
37 
38 template <typename T>
39 using ObjectType = std::map<std::string, InterfaceType<T>>;
40 
41 using Interface = InterfaceType<InterfaceVariantType>;
42 using Object = ObjectType<InterfaceVariantType>;
43 
44 using Action = std::function<void(sdbusplus::bus::bus&, Manager&)>;
45 using Filter = std::function<bool(sdbusplus::bus::bus&,
46                                   sdbusplus::message::message&, Manager&)>;
47 using PathCondition =
48     std::function<bool(const std::string&, sdbusplus::bus::bus&, Manager&)>;
49 template <typename T>
50 using GetProperty = std::function<T(Manager&)>;
51 } // namespace manager
52 } // namespace inventory
53 } // namespace phosphor
54 
55 // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
56