1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 
5 #include <string>
6 #include <tuple>
7 
8 namespace settings
9 {
10 
11 using Path = std::string;
12 using Service = std::string;
13 using Interface = std::string;
14 
15 constexpr auto root = "/";
16 
17 /** @class Objects
18  *  @brief Fetch paths of settings d-bus objects of interest, upon construction
19  */
20 struct Objects
21 {
22   public:
23     /** @brief Constructor - fetch settings objects
24      *
25      * @param[in] bus - The Dbus bus object
26      * @param[in] filter - A vector of settings interfaces the caller is
27      *            interested in.
28      */
29     Objects(sdbusplus::bus_t& bus, const std::vector<Interface>& filter);
30     Objects(const Objects&) = default;
31     Objects& operator=(const Objects&) = default;
32     Objects(Objects&&) = delete;
33     Objects& operator=(Objects&&) = delete;
34     ~Objects() = default;
35 
36     /** @brief Fetch d-bus service, given a path and an interface. The
37      *         service can't be cached because mapper returns unique
38      *         service names.
39      *
40      * @param[in] path - The Dbus object
41      * @param[in] interface - The Dbus interface
42      *
43      * @return std::string - the dbus service
44      */
45     Service service(const Path& path, const Interface& interface) const;
46 
47     /** @brief map of settings objects */
48     std::map<Interface, std::vector<Path>> map;
49 
50     /** @brief The Dbus bus object */
51     sdbusplus::bus_t& bus;
52 };
53 
54 } // namespace settings
55