Tom Joseph | 19b4f40 | 2017-08-02 17:59:30 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <string> |
| 4 | #include <sdbusplus/bus.hpp> |
| 5 | |
| 6 | namespace settings |
| 7 | { |
| 8 | |
| 9 | using Path = std::string; |
| 10 | using Service = std::string; |
| 11 | using Interface = std::string; |
| 12 | |
| 13 | constexpr auto root = "/"; |
| 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::bus& 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 | |
Tom Joseph | 19b4f40 | 2017-08-02 17:59:30 +0530 | [diff] [blame] | 45 | /** @brief map of settings objects */ |
Tom Joseph | 7c78adf | 2017-09-11 12:52:56 +0530 | [diff] [blame] | 46 | std::map<Interface, std::vector<Path>> map; |
Tom Joseph | 19b4f40 | 2017-08-02 17:59:30 +0530 | [diff] [blame] | 47 | |
| 48 | /** @brief The Dbus bus object */ |
| 49 | sdbusplus::bus::bus& bus; |
| 50 | }; |
| 51 | |
| 52 | } // namespace settings |