summaryrefslogtreecommitdiffstats
path: root/src/data_types.hpp
blob: af0ef68dc6658bc3ba6841078532315cdea278aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#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
{
namespace dbus
{
namespace monitoring
{

class Monitor;

/** @brief The possible item value types */
using Value = int64_t;

/** @brief A list of what constructs a unique item and its value */
using Group = std::vector<std::tuple<std::string, Value>>;

/** @brief A conditional function type for item(s) conditions */
using Condition = std::function<bool(sdbusplus::bus::bus&,
                                     sdbusplus::message::message&,
                                     Monitor&)>;

/** @brief A void function type for actions based condition(s) */
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 >>;

/** @brief Lookup index for properties . */
// *INDENT-OFF*
using PropertyIndex = TupleRefMap <
        TupleOfRefs<
            const std::string,
            const std::string,
            any_ns::any>,
        const std::string,
        const std::string,
        const std::string >;
// *INDENT-ON*
} // namespace monitoring
} // namespace dbus
} // namespace phosphor
OpenPOWER on IntegriCloud