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 * 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. 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; 35 36 /** @brief Invoke the callback associated with the watch. */ 37 virtual void callback() = 0; 38 39 }; 40 41 } // namespace monitoring 42 } // namespace dbus 43 } // namespace phosphor 44