diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gras/element.hpp | 31 | ||||
-rw-r--r-- | include/gras/hier_block.hpp | 9 |
2 files changed, 31 insertions, 9 deletions
diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 3211ac3..13ebb7c 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -19,6 +19,8 @@ struct ElementImpl; typedef boost::shared_ptr<ElementImpl> ElementBase; +struct Block; + struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> { @@ -42,6 +44,35 @@ struct GRAS_API Element : ElementBase, boost::enable_shared_from_this<Element> std::string to_string(void) const; /******************************************************************* + * element tree interface + ******************************************************************/ + + /*! + * Adopt an element as a child under the given name. + * + * This API allows the user to structure a hierarchy of elements. + * This element will become the parent of the child element. + * + * \param name the name of the child node + * \param child an element to be adopted + */ + void adopt_element(const std::string &name, const Element &child); + + /*! + * Lookup a block in the element tree hierarchy. + * + * Paths are unix style, absolte and relatives paths are possible. + * This call throws an invalid argument when bad paths are given. + * + * Example path: /my_hier_block/my_block0 + * Example path: ../my_block1 + * + * \param path a path to a block (leaf) in the tree + * \return a pointer to the block + */ + Block *lookup_block(const std::string &path); + + /******************************************************************* * Compatibility for dealing with shared ptrs of Elements ******************************************************************/ /*! diff --git a/include/gras/hier_block.hpp b/include/gras/hier_block.hpp index 25c1424..398024e 100644 --- a/include/gras/hier_block.hpp +++ b/include/gras/hier_block.hpp @@ -44,15 +44,6 @@ struct GRAS_API HierBlock : Element */ virtual void commit(void); - /******************************************************************* - * property tree interface - ******************************************************************/ - - /*! - * Register a subelement's properties into this element. - */ - void register_subelement(const std::string &node, const Element &subelem); - }; } //namespace gras |