21 #include "regexConfProvider.hpp" 60 string confInSameDir(identity +
".conf");
62 string confRelativeToTestDir(
"../../agent/" + identity +
".conf");
65 + identity +
"/agent/" + identity +
".conf");
73 return confRelativeToTestDir;
77 return confInInstallDir;
85 : _isVerbosityDebug(isVerbosityDebug) {}
99 cout <<
"try to open conf: " << confFile << endl;
100 stream.open(confFile.c_str());
102 return stream.is_open();
113 if (rmm.find(identity) == rmm.end())
115 #pragma omp critical(rmm) 117 if (rmm.find(identity) == rmm.end())
127 cout <<
"cannot open regex definitions in conf: " <<
getRegexConfFile(identity) << endl;
132 cout <<
"the identity " << identity <<
" is already loaded" << endl;
143 istringstream& stream)
146 if (rmm.find(identity) == rmm.end())
148 #pragma omp critical(rmm) 150 if (rmm.find(identity) == rmm.end())
156 cout <<
"the identity " << identity <<
" is already loaded" << endl;
172 #pragma omp critical(rmm) 176 return (*rv).c_str();
RegexMap readConfStreamToMap(std::istringstream &stream, const bool isVerbosityDebug)
Read a string stream and crate a RegexMap.
RegexConfProvider(const bool isVerbosityDebug=false)
Constructor to set verbosity level.
static std::map< std::string, RegexMap > _regexMapMap
Map to store RegexMap with a string key.
const char * getRegexValue(const std::string &name, const std::string &key)
Get the regex as string from the RegexMap.
bool testIfFileExists(const string &filename)
Check if a given file exists.
string getRegexConfFile(const string &identity)
Get the regex conf file.
bool getRegexConfStream(const std::string &identity, std::ifstream &stream)
Get file stream for regex conf file.
int exists
Default not exists.
void maybeLoad(const std::string &identity)
Check if identity already loaded in RegexMap, if not load them.