34 #include <boost/shared_ptr.hpp>
35 #include <boost/log/trivial.hpp>
36 #include <boost/filesystem.hpp>
37 #include <boost/filesystem/fstream.hpp>
38 #include <unordered_map>
40 #define BOOST_ASSERT_MSG_OSTREAM std::cout
41 #include <boost/assert.hpp>
45 #if (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x500) || \
46 (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
47 #define QUOTED_STRING const char *
49 #define QUOTED_STRING char *
116 typedef boost::shared_ptr<class ConfigMap>
ConfigMapRef;
136 ConfigMap(
int argc,
char **argv,
bool exitOnUnrecognizedArgument);
141 bool readFile(
const std::string &filename);
145 std::istringstream is(str.c_str());
155 template <
class VALTYPE>
156 VALTYPE
get(std::string keyString,
const VALTYPE &defaultVal) {
158 std::string valString =
getValue(keyString);
165 BOOST_LOG_TRIVIAL(error) <<
"ConfigMap Error: cannot remap " << valString;
170 BOOST_LOG_TRIVIAL(error) <<
"ConfigMap Error: cannot find " << keyString;
179 BOOST_LOG_TRIVIAL(error) <<
"ConfigMap Warning: no mapping for '" << keyString <<
"'";
188 BOOST_LOG_TRIVIAL(error) <<
"ConfigMap Warning: no mapping for '" << keyString <<
"'";
197 BOOST_LOG_TRIVIAL(error) <<
"ConfigMap Warning: no mapping for '" << keyString <<
"'";
202 std::string
get(std::string keyString, std::string defaultVal) {
206 BOOST_LOG_TRIVIAL(error) <<
"ConfigMap Warning: no mapping for '" << keyString <<
"'";
212 std::string
getValue(
const std::string &keyString);
213 void set(
const std::string &key,
const std::string &value);
217 std::unordered_map<std::string, std::string> _map;