Initial version

This commit is contained in:
Alexander Kobjolke 2022-02-26 00:23:43 +01:00
commit 04b878f078
28 changed files with 1771 additions and 0 deletions

View 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