blob: 66cd3ae8b315ccf559fdb9efa924caf2afafe6e7 [file] [log] [blame]
Deepak Kodihalli18aa0442017-07-21 07:07:09 -05001#pragma once
2
Patrick Venture0b02be92018-08-31 11:55:55 -07003#include <sdbusplus/bus.hpp>
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -05004
Deepak Kodihalli18aa0442017-07-21 07:07:09 -05005#include <string>
Deepak Kodihalli13791bd2017-08-28 06:50:51 -05006#include <tuple>
Deepak Kodihalli18aa0442017-07-21 07:07:09 -05007
8namespace settings
9{
10
11using Path = std::string;
12using Service = std::string;
13using Interface = std::string;
14
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050015/** @class Objects
16 * @brief Fetch paths of settings d-bus objects of interest, upon construction
17 */
18struct Objects
19{
Patrick Venture0b02be92018-08-31 11:55:55 -070020 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 */
Patrick Williams5d82f472022-07-22 19:26:53 -050027 Objects(sdbusplus::bus_t& bus, const std::vector<Interface>& filter);
Patrick Venture0b02be92018-08-31 11:55:55 -070028 Objects(const Objects&) = default;
29 Objects& operator=(const Objects&) = default;
30 Objects(Objects&&) = delete;
31 Objects& operator=(Objects&&) = delete;
32 ~Objects() = default;
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050033
Patrick Venture0b02be92018-08-31 11:55:55 -070034 /** @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;
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050044
Patrick Venture0b02be92018-08-31 11:55:55 -070045 /** @brief map of settings objects */
46 std::map<Interface, std::vector<Path>> map;
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050047
Patrick Venture0b02be92018-08-31 11:55:55 -070048 /** @brief The Dbus bus object */
Patrick Williams5d82f472022-07-22 19:26:53 -050049 sdbusplus::bus_t& bus;
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050050};
51
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050052} // namespace settings