Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ratan Gupta | a45e086 | 2018-02-21 19:03:13 +0530 | [diff] [blame] | 3 | #include "data_types.hpp" |
| 4 | |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 5 | namespace phosphor |
| 6 | { |
| 7 | namespace dbus |
| 8 | { |
| 9 | namespace 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 Bishop | ce4fbe1 | 2017-06-06 23:58:09 -0400 | [diff] [blame] | 20 | * 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 Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 24 | */ |
| 25 | class 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 Bishop | ce4fbe1 | 2017-06-06 23:58:09 -0400 | [diff] [blame] | 37 | |
| 38 | /** @brief Invoke the callback associated with the watch. */ |
Ratan Gupta | a45e086 | 2018-02-21 19:03:13 +0530 | [diff] [blame] | 39 | virtual void callback(Context ctx) = 0; |
Brad Bishop | ce4fbe1 | 2017-06-06 23:58:09 -0400 | [diff] [blame] | 40 | |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | } // namespace monitoring |
| 44 | } // namespace dbus |
| 45 | } // namespace phosphor |