blob: ec1d9131a78dc42c603491c88c9dc44f9628cb25 [file] [log] [blame]
Deepak Kodihalli18aa0442017-07-21 07:07:09 -05001#pragma once
2
3#include <string>
4#include <sdbusplus/bus.hpp>
5
6namespace settings
7{
8
9using Path = std::string;
10using Service = std::string;
11using Interface = std::string;
12
13constexpr auto root = "/";
14
15/** @class Objects
16 * @brief Fetch paths of settings d-bus objects of interest, upon construction
17 */
18struct 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
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050045 /** @brief map of settings objects */
Deepak Kodihallie6027092017-08-27 08:13:37 -050046 std::map<Interface, std::vector<Path>> map;
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050047
48 /** @brief The Dbus bus object */
49 sdbusplus::bus::bus& bus;
50};
51
52} // namespace settings