#include "settings.h" #include #include #include #include namespace settings { std::vector getLabels() { cfg_opt_t opts[] = { CFG_STR_LIST("labels", NULL, CFGF_NONE), CFG_END() }; cfg_t *cfg = cfg_init(opts, CFGF_IGNORE_UNKNOWN); if(cfg_parse(cfg, "annotator.conf") == CFG_PARSE_ERROR) { throw std::runtime_error("Configuration file annotator.conf could not be read: " + std::string(strerror(errno))); } try { std::vector ret; std::size_t i; for(i = 0; i < cfg_size(cfg, "labels"); i++) { ret.push_back(cfg_getnstr(cfg, "labels", i)); } return ret; } catch(std::exception& e) { throw std::runtime_error("Cannot find 'labels' in configuration file"); } } }