|
type & | getOrCreateChildByName (std::string const &name) |
| Get the named child, creating it if it doesn't exist.
|
|
type const & | getChildByName (std::string const &name) const |
| Get the named child, throwing NoSuchChild if it doesn't exist. More...
|
|
std::string const & | getName () const |
| Gets the name of the current node. More...
|
|
bool | isRoot () const |
| Is the current node a root node?
|
|
parent_ptr_type | getParent () const |
| Gets the node's parent, or nullptr if no parent (root node)
|
|
bool | hasChildren () const |
| Does the node have any children? More...
|
|
size_t | numChildren () const |
| How many children does the node have?
|
|
value_type & | value () |
| Reference accessor for contained value.
|
|
value_type const & | value () const |
| Const reference accessor for contained value.
|
|
template<typename F > |
void | visitChildren (F &visitor) |
| Generic visitation method that calls a functor on each of the children in an undefined order. More...
|
|
template<typename F > |
void | visitConstChildren (F &visitor) const |
| Generic constant visitation method that calls a functor on each of the children (as const) in an undefined order. More...
|
|
template<typename F > |
void | visitChildren (F &visitor) const |
| Generic constant visitation method that calls a functor on each of the children in an undefined order. More...
|
|
bool | operator== (const type &x) const |
| Equality comparison operator - tests object identity.
|
|
template<typename ValueType>
class osvr::util::tree::TreeNode< ValueType >
A node in a generic tree, which can contain an object by value.
- Template Parameters
-
ValueType | The contained value type: must be default-constructible. |
Key features:
- All non-root nodes are named, and children may only be created attached to a parent.
- All children of a given node are uniquely named.
- Node names are immutable.
- Contained values are mutable.
- Traversal is provided for by templated visit methods that accept a functor.
- A "get or create" method is provided that guarantees the return a child of the given name (default-constructing one if it doesn't exist)
- Todo:
- methods to remove a child (by pointer and by name)