A node in a parameter tree storing a Counter object aliased by a name. More...
#include <Node.h>

Public Member Functions | |
| ~Node ()=default | |
| Node (Node< Counter > &&) noexcept=default | |
| Node< Counter > & | operator= (Node< Counter > &&) noexcept=default |
| Node (const Node< Counter > &)=delete | |
| Node< Counter > & | operator= (const Node< Counter > &)=delete |
| template<typename ForwardIt > | |
| std::shared_ptr< Node< Counter > > | walk (ForwardIt start_name, ForwardIt end_name) |
| Recursively walks down a single branch described by node names. More... | |
| std::shared_ptr< Node< Counter > > | walk (const std::list< std::string > &path_to_node) |
| std::shared_ptr< Node< Counter > > | child (const std::string &child_name) |
| Returns a child node, same as calling walk with one element. More... | |
| std::shared_ptr< Node< Counter > > | find_parent (const std::string &parent_name) |
| Searches from current parent up to the root returning a node with specified name. More... | |
| std::shared_ptr< Node< Counter > > | walk_up (int n) |
| Walks up n levels by following the parent nodes. More... | |
| size_t | count_nodes () const |
| Get total number of nodes in a tree. More... | |
Static Public Member Functions | |
| static std::shared_ptr< Node< Counter > > | make_root (const std::string &name, const Counter &counter) |
| Builds the root tree whose parent is nullptr. More... | |
| static std::shared_ptr< Node< Counter > > | add_child (const std::string &child_name, const Counter &child_counter, const std::shared_ptr< Node< Counter >> &parent) |
| Adds a child to the current node. Overwrites any children with child_name that already exist. More... | |
| static std::shared_ptr< Node< Counter > > | deep_copy (const std::shared_ptr< Node< Counter >> &subtree, std::shared_ptr< Node< Counter >> parent) |
| Creates a deep copy of the subtree with copies of Counter objects. More... | |
Public Attributes | |
| std::string | name |
| name of the node. This is a duplicate, same name is stored in parent's map of children. More... | |
| Counter | counter |
| std::shared_ptr< Node< Counter > > | parent = nullptr |
| resource counter More... | |
| std::map< std::string, std::shared_ptr< Node< Counter > > > | children |
| child nodes More... | |
A node in a parameter tree storing a Counter object aliased by a name.
|
default |
|
defaultnoexcept |
|
delete |
|
inlinestatic |
Adds a child to the current node. Overwrites any children with child_name that already exist.
|
inline |
Returns a child node, same as calling walk with one element.
| child_name | name of the child node |
|
inline |
Get total number of nodes in a tree.
|
inlinestatic |
Creates a deep copy of the subtree with copies of Counter objects.
|
inline |
Searches from current parent up to the root returning a node with specified name.
| parent_name | name of the node that needs to be returned |
|
inlinestatic |
Builds the root tree whose parent is nullptr.
|
delete |
|
defaultnoexcept |
|
inline |
|
inline |
Recursively walks down a single branch described by node names.
Consider a single branch root->A->B->C, the path can be stored as std::list<std::string> path{"A","B","C"} and calling root.walk(path.begin, path.end) returns the node C.
| ForwardIt | forward iterator for a container of strings |
| start_name | name for a child of the current node |
| end_name | indicates end of the path |
|
inline |
Walks up n levels by following the parent nodes.
| n | number of levels to walk up ( n > 0) |
| std::map<std::string, std::shared_ptr<Node<Counter> > > molpro::profiler::Node< Counter >::children |
child nodes
| Counter molpro::profiler::Node< Counter >::counter |
| std::string molpro::profiler::Node< Counter >::name |
name of the node. This is a duplicate, same name is stored in parent's map of children.
| std::shared_ptr<Node<Counter> > molpro::profiler::Node< Counter >::parent = nullptr |
resource counter
parent node