The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
|
Seralizer to read/write Dune objects from/into JSON/XML. More...
#include <serializer.h>
Public Member Functions | |
void | save (const tstring &filename) |
Save the current key-value's into a file specified by filename. | |
void | load (const tstring &filename) |
Load key-value pairs from a file specified by filename. | |
template<typename T > | |
T | get (const tstring &key) const |
Get a value from a specified key. More... | |
template<typename T > | |
void | put (const tstring &key, const T &value) |
Add a new key-value pair or overwrite an existing key with a new value. More... | |
Seralizer to read/write Dune objects from/into JSON/XML.
This class manages a map of key-value pairs of tstring objects and can read or write them to XML files. Keys can be structured into subkeys by dividing them with dots. For instace, the hierarchy
foo { bar { baz }, bar1 { baz } }
can be expressed with the following keys
foo.bar.baz
foo.bar1.baz
The serializer is used to save information about Dune objects into files. This enables loading program configurations.
|
inline |
Get a value from a specified key.
Fetch a value from the storage and return it as type T.
T | The type of the parameter. |
key | The key specifying the value. |
exception | The key does not exist. |
Referenced by dune::operator>>(), and operator>>().
|
inline |
Add a new key-value pair or overwrite an existing key with a new value.
Add a value of type T to the storage. If the key already exists, the value is simply replaced.
T | The type of the parameter. |
key | The key specifying the value. |
value | The value. |
Referenced by dune::operator<<(), and operator<<().