monitor * monitor_factory::create_monitor_by_name(const std::string& name, std::vector<std::string> paths, FSW_EVENT_CALLBACK * callback, void * context) { auto i = type_by_string().find(name); if (i == type_by_string().end()) return nullptr; else return monitor::create_monitor(i->second, paths, callback, context); }
vector<string> monitor_factory::get_types() { vector<string> types; for (auto & i : type_by_string()) { types.push_back(i.first); } return types; }
static const gsl_cqpminimizer_type* get_type(VALUE t) { switch (TYPE(t)) { case T_STRING: return type_by_string(t); break; default: rb_raise(rb_eTypeError, "Wrong argument type %s.", rb_class2name(CLASS_OF(t))); } }
void monitor_factory::register_type(const std::string& name, fsw_monitor_type type) { type_by_string()[name] = type; }
bool monitor_factory::exists_type(const std::string& name) { auto i = type_by_string().find(name); return (i != type_by_string().end()); }