9 #ifndef DUNE_SERIALIZER
10 #define DUNE_SERIALIZER
14 #include <boost/any.hpp>
44 std::map<tstring, tstring> properties_;
48 void save(
const tstring& filename);
51 void load(
const tstring& filename);
64 T
get(
const tstring& key)
const
66 auto i = properties_.find(key);
68 if (i == properties_.end())
72 tstringstream ss(i->second);
74 ss >> std::boolalpha >> value;
89 void put(
const tstring& key,
const T& value)
93 properties_[key] = ss.str();
98 void put(
const tstring& key,
const BOOL& value)
104 ss << std::boolalpha <<
false;
106 ss << std::boolalpha <<
true;
110 properties_[key] = ss.str();
void save(const tstring &filename)
Save the current key-value's into a file specified by filename.
Definition: serializer.cpp:59
Exception class.
Definition: exception.h:25
Seralizer to read/write Dune objects from/into JSON/XML.
Definition: serializer.h:41
void put(const tstring &key, const T &value)
Add a new key-value pair or overwrite an existing key with a new value.
Definition: serializer.h:89
void load(const tstring &filename)
Load key-value pairs from a file specified by filename.
Definition: serializer.cpp:51