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 /** @class Objects
16  *  @brief Fetch paths of settings d-bus objects of interest, upon construction
17  */
18 struct Objects
19 {
20   public:
21     /** @brief Constructor - fetch settings objects
22      *
23      * @param[in] bus - The Dbus bus object
24      * @param[in] filter - A vector of settings interfaces the caller is
25      *            interested in.
26      */
27     Objects(sdbusplus::bus_t& bus, const std::vector<Interface>& filter);
28     Objects(const Objects&) = default;
29     Objects& operator=(const Objects&) = default;
30     Objects(Objects&&) = delete;
31     Objects& operator=(Objects&&) = delete;
32     ~Objects() = default;
33 
34     /** @brief Fetch d-bus service, given a path and an interface. The
35      *         service can't be cached because mapper returns unique
36      *         service names.
37      *
38      * @param[in] path - The Dbus object
39      * @param[in] interface - The Dbus interface
40      *
41      * @return std::string - the dbus service
42      */
43     Service service(const Path& path, const Interface& interface) const;
44 
45     /** @brief map of settings objects */
46     std::map<Interface, std::vector<Path>> map;
47 
48     /** @brief The Dbus bus object */
49     sdbusplus::bus_t& bus;
50 };
51 
52 } // namespace settings
53