2013-10-24 17:08:58 +02:00
|
|
|
#include <sstream>
|
|
|
|
#include "concordia/concordia_config.hpp"
|
|
|
|
#include "concordia/common/logging.hpp"
|
|
|
|
|
|
|
|
#define PUDDLE_TAGSET_PARAM "puddle_tagset_path"
|
2013-11-28 16:47:57 +01:00
|
|
|
#define WORD_MAP_PARAM "word_map_path"
|
|
|
|
#define HASHED_INDEX_PARAM "hashed_index_path"
|
2014-02-20 10:49:17 +01:00
|
|
|
#define MARKERS_PARAM "markers_path"
|
2013-11-28 16:47:57 +01:00
|
|
|
#define SUFFIX_ARRAY_PARAM "suffix_array_path"
|
2013-10-24 17:08:58 +02:00
|
|
|
|
|
|
|
ConcordiaConfig::ConcordiaConfig(const string & configFilePath)
|
|
|
|
throw(ConcordiaException) {
|
|
|
|
try {
|
|
|
|
_config.readFile(configFilePath.c_str());
|
|
|
|
} catch(ParseException & e) {
|
|
|
|
throw ConcordiaException("Error parsing config file: "+configFilePath);
|
|
|
|
} catch(FileIOException & e) {
|
|
|
|
throw ConcordiaException("I/O error reading config file: "
|
|
|
|
+configFilePath);
|
|
|
|
}
|
|
|
|
|
|
|
|
_puddleTagsetFilePath =
|
|
|
|
ConcordiaConfig::_readConfigParameterStr(PUDDLE_TAGSET_PARAM);
|
2013-11-28 16:47:57 +01:00
|
|
|
_wordMapFilePath =
|
|
|
|
ConcordiaConfig::_readConfigParameterStr(WORD_MAP_PARAM);
|
|
|
|
_hashedIndexFilePath =
|
|
|
|
ConcordiaConfig::_readConfigParameterStr(HASHED_INDEX_PARAM);
|
2014-02-20 10:49:17 +01:00
|
|
|
_markersFilePath =
|
|
|
|
ConcordiaConfig::_readConfigParameterStr(MARKERS_PARAM);
|
2013-11-28 16:47:57 +01:00
|
|
|
_suffixArrayFilePath =
|
|
|
|
ConcordiaConfig::_readConfigParameterStr(SUFFIX_ARRAY_PARAM);
|
2013-10-24 17:08:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ConcordiaConfig::~ConcordiaConfig() {
|
|
|
|
}
|
|
|
|
|
|
|
|
string ConcordiaConfig::_readConfigParameterStr(const string & name)
|
|
|
|
throw(ConcordiaException) {
|
|
|
|
if (!_config.exists(name)) {
|
|
|
|
throw ConcordiaException("Config error: "+name+" setting not found");
|
|
|
|
} else {
|
|
|
|
return _config.lookup(name);
|
|
|
|
}
|
|
|
|
}
|