13 namespace FunctionTree {
    16     : OutputParameter(nullptr), HasChanged(true), Strat(strategy) {
    18     throw std::runtime_error(
"TreeNode::TreeNode() | No strategy given!");
    22                    std::shared_ptr<Strategy> strategy)
    25     throw std::runtime_error(
    26         "TreeNode::TreeNode() | No output parameter given!");
    35     x->removeExpiredParents();
    37   if (0 == ChildNodes.size()) { 
    44                                [](
auto x) { 
return x.expired(); }),
    49   node->addParent(shared_from_this());
    54   auto ThisNode = shared_from_this();
    55   for (
auto node : nodes) {
    56     node->addParent(ThisNode);
    73     throw std::runtime_error(
"TreeNode::parameter() | Caching is disabled but "    74                              "Node is a lead node!");
    95   std::shared_ptr<Parameter> result;
   101     auto p = ch->parameter();
   102     if (p->isParameter())
   108     Strat->execute(newVals, result);
   109   } 
catch (std::exception &ex) {
   110     LOG(INFO) << 
"TreeNode::Recalculate() | Strategy " << 
Strat   111               << 
" failed with input ParameterList:\n"   112               << newVals << 
": " << ex.what();
   121     ch->fillParameters(list);
   127   std::stringstream oss;
   133       oss << 
"[" << p->name() << 
"]";
   134     oss << 
" = " << p->val_to_str() << std::endl;
   136     oss << 
Strat->str() << 
" [";
   143       oss << 
" = " << p->val_to_str() << std::endl;
   151     oss << ch->print(level - 1, prefix + 
". ");
   157   auto leaf = std::make_shared<TreeNode>(
parameter);
   158   parameter->attach(leaf);
 virtual void addValue(std::shared_ptr< Parameter > value)
 
void fillParameters(ParameterList &list)
Fill ParameterList with parameters. 
 
bool HasChanged
Node has changed and needs to call recalculate() 
 
std::string print(int level=-1, std::string prefix="")
Print node and its child nodes to std::string. 
 
std::shared_ptr< Parameter > parameter()
Obtain parameter of node. 
 
TreeNode(std::shared_ptr< Strategy > strategy)
Constructor for tree using a strategy. 
 
virtual void addParameter(std::shared_ptr< Parameter > par)
 
std::shared_ptr< Strategy > Strat
Node strategy. 
 
void removeExpiredParents()
 
This file contains Functions implementing the Strategy interface so they can be used inside a node of...
 
std::shared_ptr< ComPWA::FunctionTree::Parameter > OutputParameter
(cached) node value 
 
void addNode(std::shared_ptr< TreeNode > node)
 
std::vector< std::weak_ptr< TreeNode > > Parents
List of parent nodes. 
 
std::shared_ptr< TreeNode > createLeaf(std::shared_ptr< Parameter > parameter)
 
void addParent(std::weak_ptr< TreeNode > node)
 
std::vector< std::shared_ptr< TreeNode > > ChildNodes
 
void addNodes(std::vector< std::shared_ptr< TreeNode >> nodes)
 
std::shared_ptr< ComPWA::FunctionTree::Parameter > recalculate()
Obtain parameter of node. 
 
This class provides a list of parameters and values of different types. 
 
void update()
Flags the node as modified. Should only be called from its child nodes.