Initial version
This commit is contained in:
commit
04b878f078
28 changed files with 1771 additions and 0 deletions
31
example/include/process/process_checker.hpp
Normal file
31
example/include/process/process_checker.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef PROCESS_LIBPROCESS_EXT_INCLUDE_PROCESS_CHECKER_HPP
|
||||
#define PROCESS_LIBPROCESS_EXT_INCLUDE_PROCESS_CHECKER_HPP
|
||||
|
||||
#include <process/watchdog.hpp>
|
||||
#include "process_statistic.hpp"
|
||||
#include "process_status.hpp"
|
||||
|
||||
namespace process::controller {
|
||||
class ProcessCheckerCallback {
|
||||
public:
|
||||
virtual void on_process_status_changed(const ProcessStatus& ps) = 0;
|
||||
|
||||
virtual void on_process_statistic_changed(const ProcessStatistic& ps) = 0;
|
||||
};
|
||||
|
||||
class ProcessChecker : public WatchdogChecker<ProcessCheckerCallback> {
|
||||
public:
|
||||
ProcessChecker(std::shared_ptr<ProcessCollection> collection, std::shared_ptr<ProcessCheckerCallback> cb);
|
||||
|
||||
void check() override;
|
||||
|
||||
private:
|
||||
void check_process(const std::shared_ptr<Process>& process);
|
||||
|
||||
using ProcessDataMap = std::map<std::string, std::pair<ProcessStatus, ProcessStatistic>>;
|
||||
ProcessDataMap m_process_data;
|
||||
const std::shared_ptr<ProcessCollection> m_collection;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue