#include "i2-icinga.h" using namespace icinga; map CheckTask::m_Types; void CheckTask::RegisterType(string type, Factory factory) { m_Types[type] = factory; } CheckTask::Ptr CheckTask::CreateTask(const Service& service) { map::iterator it; it = m_Types.find(service.GetCheckType()); if (it == m_Types.end()) throw runtime_error("Invalid check type specified for service '" + service.GetName() + "'"); return it->second(service); }