43 std::map<std::string, std::map<std::string, std::string> > params;
46 std::string saved_filename;
47 std::string current_section;
50 void printToStream(std::ostream &os);
51 string decodeString(
string str);
52 string encodeString(
string str);
60 void load(
const char *filename);
62 void save(
const char *filename);
72 void add(std::string param,
const T& value, std::string section=
"")
75 section = current_section;
77 boost::archive::text_oarchive oa(os);
80 params[section][param] = os.str();
84 void add(
const char *param,
const T& value, std::string section=
"")
86 add(
string(param),value,section);
91 Session & operator()(std::string param,
const T& value)
93 this->add(param, value);
99 Session & operator()(
const char *param,
const T& value)
101 this->add(param, value);
117 bool exists(std::string param, std::string section =
"");
120 template <
typename T>
121 T
get(std::string param, std::string section =
"")
124 section = current_section;
126 std::stringstream is;
127 is << params[section][param];
128 boost::archive::text_iarchive ia(is);
135 template <
typename T>
136 void get(std::string param, T *v, std::string section =
"")
139 section = current_section;
141 std::stringstream is;
142 is << params[section][param];
143 boost::archive::text_iarchive ia(is);