icinga2/icinga/checktask.h

54 lines
1.1 KiB
C
Raw Normal View History

#ifndef CHECKTASK_H
#define CHECKTASK_H
namespace icinga
{
struct CheckTaskType;
class I2_ICINGA_API CheckTask : public Object
{
public:
typedef shared_ptr<CheckTask> Ptr;
typedef weak_ptr<CheckTask> WeakPtr;
typedef function<CheckTask::Ptr(const Service&)> Factory;
typedef function<void()> QueueFlusher;
2012-06-27 23:38:50 +02:00
Service& GetService(void);
CheckResult& GetResult(void);
virtual void Enqueue(void) = 0;
static void RegisterType(string type, Factory factory, QueueFlusher qflusher);
static CheckTask::Ptr CreateTask(const Service& service);
static void Enqueue(const CheckTask::Ptr& task);
static void FlushQueue(void);
2012-06-28 15:43:49 +02:00
static int GetTaskHistogramSlots(void);
static void FinishTask(const CheckTask::Ptr& task);
2012-06-19 09:38:20 +02:00
static vector<CheckTask::Ptr> GetFinishedTasks(void);
protected:
CheckTask(const Service& service);
private:
Service m_Service;
2012-06-27 23:38:50 +02:00
CheckResult m_Result;
static map<string, CheckTaskType> m_Types;
static vector<CheckTask::Ptr> m_FinishedTasks;
static mutex m_FinishedTasksMutex;
};
struct CheckTaskType
{
CheckTask::Factory Factory;
CheckTask::QueueFlusher QueueFlusher;
};
}
#endif /* CHECKTASK_H */