/* */ #ifndef D_NOTIFIER_H #define D_NOTIFIER_H #include "common.h" #include #include #include namespace aria2 { class RequestGroup; struct DownloadEventListener { virtual ~DownloadEventListener() {} virtual void onEvent(DownloadEvent event, const RequestGroup* group) = 0; }; class Notifier { public: Notifier(); ~Notifier(); void addDownloadEventListener(DownloadEventListener* listener); // Notifies the download event to all listeners. void notifyDownloadEvent(DownloadEvent event, const RequestGroup* group); void notifyDownloadEvent(DownloadEvent event, const std::shared_ptr& group) { notifyDownloadEvent(event, group.get()); } private: std::vector listeners_; }; } // namespace aria2 #endif // D_NOTIFIER_H