blob: d4204581596468b1e50bb0f2b568b822659ccc43 [file] [log] [blame]
Brad Bishop4b916f12017-05-23 18:06:38 -04001#pragma once
2
Ratan Guptaa45e0862018-02-21 19:03:13 +05303#include "data_types.hpp"
4
Brad Bishop4b916f12017-05-23 18:06:38 -04005namespace phosphor
6{
7namespace dbus
8{
9namespace monitoring
10{
11
12/** @class Watch
13 * @brief Watch interface.
14 *
15 * The start method is invoked by main() on all watches of any type
16 * at application startup, to allow watches to perform custom setup
17 * or initialization. Typical implementations might register dbus
18 * callbacks or perform queries.
19 *
Brad Bishopce4fbe12017-06-06 23:58:09 -040020 * The callback method is invoked by main() on all watches of any
21 * type at application startup, after all watches have performed
22 * their setup. Typical implementations will forward the call
23 * to their associated callback.
Brad Bishop4b916f12017-05-23 18:06:38 -040024 */
25class Watch
26{
27 public:
28 Watch() = default;
29 Watch(const Watch&) = default;
30 Watch(Watch&&) = default;
31 Watch& operator=(const Watch&) = default;
32 Watch& operator=(Watch&&) = default;
33 virtual ~Watch() = default;
34
35 /** @brief Start the watch. */
36 virtual void start() = 0;
Brad Bishopce4fbe12017-06-06 23:58:09 -040037
38 /** @brief Invoke the callback associated with the watch. */
Ratan Guptaa45e0862018-02-21 19:03:13 +053039 virtual void callback(Context ctx) = 0;
Brad Bishopce4fbe12017-06-06 23:58:09 -040040
Brad Bishop4b916f12017-05-23 18:06:38 -040041};
42
43} // namespace monitoring
44} // namespace dbus
45} // namespace phosphor