blob: e36af9c4faf04bdf0dc439765a60b52c488cd0a0 [file] [log] [blame]
Brad Bishop4b916f12017-05-23 18:06:38 -04001#pragma once
2
3namespace phosphor
4{
5namespace dbus
6{
7namespace monitoring
8{
9
10/** @class Watch
11 * @brief Watch interface.
12 *
13 * The start method is invoked by main() on all watches of any type
14 * at application startup, to allow watches to perform custom setup
15 * or initialization. Typical implementations might register dbus
16 * callbacks or perform queries.
17 *
Brad Bishopce4fbe12017-06-06 23:58:09 -040018 * The callback method is invoked by main() on all watches of any
19 * type at application startup, after all watches have performed
20 * their setup. Typical implementations will forward the call
21 * to their associated callback.
Brad Bishop4b916f12017-05-23 18:06:38 -040022 */
23class Watch
24{
25 public:
26 Watch() = default;
27 Watch(const Watch&) = default;
28 Watch(Watch&&) = default;
29 Watch& operator=(const Watch&) = default;
30 Watch& operator=(Watch&&) = default;
31 virtual ~Watch() = default;
32
33 /** @brief Start the watch. */
34 virtual void start() = 0;
Brad Bishopce4fbe12017-06-06 23:58:09 -040035
36 /** @brief Invoke the callback associated with the watch. */
37 virtual void callback() = 0;
38
Brad Bishop4b916f12017-05-23 18:06:38 -040039};
40
41} // namespace monitoring
42} // namespace dbus
43} // namespace phosphor