Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | namespace phosphor |
| 4 | { |
| 5 | namespace dbus |
| 6 | { |
| 7 | namespace 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 Bishop | ce4fbe1 | 2017-06-06 23:58:09 -0400 | [diff] [blame] | 18 | * 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 Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 22 | */ |
| 23 | class 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 Bishop | ce4fbe1 | 2017-06-06 23:58:09 -0400 | [diff] [blame] | 35 | |
| 36 | /** @brief Invoke the callback associated with the watch. */ |
| 37 | virtual void callback() = 0; |
| 38 | |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | } // namespace monitoring |
| 42 | } // namespace dbus |
| 43 | } // namespace phosphor |