I'd like to use Boost/Property Tree as a sort of synchronization with my application. To do this I'd planned to use Zeroc/ICE for state-synchronization (using an Observe pattern and bidirectional connections).
However, to do this in an efficient way I need to somehow specify the I/O of the application (obviously).
This works nicely for importing values into the tree (since I can use InputStream to convert to any primitive type and catch occuring errors) but it hampers when I want to export values.
With the functions exposed in the documentation I do not see any way to retrieve the actual type of an element
boost::property_tree::ptree Tree;
// Import
Ice::CommunicatorPtr communicator = current.adapter->getCommunicator();
Ice::InputStreamPtr in = Ice::createInputStream(communicator, item.data);
switch (item.type) {
case BOOLVAL:
double boolval;
in->read(boolval);
Tree.put(item.path, boolval);
break;
}
// Export
// This is not possible since I cannot retrieve or compare the type
Ice::CommunicatorPtr communicator = current.adapter->getCommunicator();
Ice::OutputStreamPtr out = Ice::createOutputStream(communicator);
auto data = Tree.get<TYPE>(path);
out->write(data);