From: Marcin Kalicinski (kalita_at_[hidden])
Date: 2006-04-24 18:03:08
> 1. Design the abstract interface
> 2. Code a small wrapper class that implements the interface with the aid
> of on aggreagated STL-compliant container, boost::mutex etc.
> When I sat down to do design such a wrapper for the property_tree, I
> realized I couldn't. Not because of a property_tree deficiency, so I
> think, but because of the very nature of the recursive tree structure: I
> can't have a single class instance with a property_tree at its core, but I
> would need an instance for every tree node/leaf. However, I have no idea
> how canI "inject" my own node type into the property_tree or conversely
> put a wrapper around every ptree?
If I understand your problem correctly, in order to satisfy your goals you
have to build a tree made of your own nodes, which contain, among other
things, a pointer to the parent and a mutex?
The only way I see property_tree could be stretched in the right direction
is to redefine data type to contain what you need, and provide your own
extractor/inserter. However, you have to ban some of the ptree interface
anyway, because it will not be able to preserve your node invariants (i.e.
update parent, lock mutex). Only data manipulation through
get/get_own/put/put_own goes through extractor/inserter. get_child/put_child
and std::container interface cannot be hooked this way, so you would have to
On the other hand, isn't what you need just a generic tree container?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk