Belle II Software development
FunctionNode< AVariableManager > Class Template Reference

FunctionNode Node class for handling MetaVariables in cuts. More...

#include <CutNodes.h>

Inheritance diagram for FunctionNode< AVariableManager >:
AbstractExpressionNode< AVariableManager >

Public Member Functions

AVariableManager::VarVariant evaluate (const Object *p) const override
 evaluate m_var with p and return the result
 
void print () const override
 Print node.
 
std::string decompile () const override
 Decompile Node back to a string.
 
void processMetaVariable ()
 Get MetaVariable from AVariableManager.
 
 ~FunctionNode ()
 Destructor.
 

Private Types

typedef AVariableManager::Object Object
 Template argument dependent Particle type definition.
 
typedef AVariableManager::Var Var
 Template argument dependent Variable type definition.
 

Private Member Functions

 FunctionNode (const std::string &functionName, const std::vector< std::string > &functionArguments)
 Constructor.
 

Private Attributes

const std::string m_name
 Function name of the MetaVariable.
 
const std::vector< std::string > m_arguments
 vector of string arguments of the MetaVariable
 
const Varm_var
 set if there was a valid variable in this cut
 

Friends

class NodeFactory
 

Detailed Description

template<class AVariableManager>
class Belle2::FunctionNode< AVariableManager >

FunctionNode Node class for handling MetaVariables in cuts.

Definition at line 1013 of file CutNodes.h.

Member Typedef Documentation

◆ Object

typedef AVariableManager::Object Object
private

Template argument dependent Particle type definition.

Definition at line 1017 of file CutNodes.h.

◆ Var

typedef AVariableManager::Var Var
private

Template argument dependent Variable type definition.

Definition at line 1021 of file CutNodes.h.

Constructor & Destructor Documentation

◆ ~FunctionNode()

~FunctionNode ( )
inline

Destructor.

Definition at line 1068 of file CutNodes.h.

1068{}

◆ FunctionNode()

FunctionNode ( const std::string &  functionName,
const std::vector< std::string > &  functionArguments 
)
inlineexplicitprivate

Constructor.

Parameters
functionName(const std::string&): function name of the MetaVariable
functionArguments(const std::vector<std::string>&): function arguments of the MetaVariable

Definition at line 1077 of file CutNodes.h.

1077 : m_name{functionName},
1078 m_arguments{functionArguments}
const std::vector< std::string > m_arguments
vector of string arguments of the MetaVariable
Definition: CutNodes.h:1081
const std::string m_name
Function name of the MetaVariable.
Definition: CutNodes.h:1080
void processMetaVariable()
Get MetaVariable from AVariableManager.
Definition: CutNodes.h:1053

Member Function Documentation

◆ decompile()

std::string decompile ( ) const
inlineoverridevirtual

Decompile Node back to a string.

decompile(compile) should give the same result.

Implements AbstractExpressionNode< AVariableManager >.

Definition at line 1044 of file CutNodes.h.

1045 {
1046 std::string fullname = m_name + "(" + boost::algorithm::join(m_arguments, ", ") + ")";
1047 return fullname;
1048 }

◆ evaluate()

AVariableManager::VarVariant evaluate ( const Object p) const
inlineoverridevirtual

evaluate m_var with p and return the result

Parameters
ppointer to the object, for which m_var should be evaluated.

Implements AbstractExpressionNode< AVariableManager >.

Definition at line 1027 of file CutNodes.h.

1028 {
1029 return m_var->function(p);
1030 }
const Var * m_var
set if there was a valid variable in this cut
Definition: CutNodes.h:1082

◆ print()

void print ( ) const
inlineoverridevirtual

Print node.

Implements AbstractExpressionNode< AVariableManager >.

Definition at line 1034 of file CutNodes.h.

1035 {
1036 std::string fullname = m_name + "(" + boost::algorithm::join(m_arguments, ", ") + ")";
1037 std::cout << fullname;
1038 }

◆ processMetaVariable()

void processMetaVariable ( )
inline

Get MetaVariable from AVariableManager.

Definition at line 1053 of file CutNodes.h.

1054 {
1055 // Initialize Variable
1056 AVariableManager& manager = AVariableManager::Instance();
1057 m_var = manager.getVariable(m_name, m_arguments);
1058 if (m_var == nullptr) {
1059 auto fullname = m_name + "(" + boost::algorithm::join(m_arguments, ", ") + ")";
1060
1061 throw std::runtime_error(
1062 "Cut string has an invalid format: Metavariable not found: " + fullname);
1063 }
1064 }

Friends And Related Function Documentation

◆ NodeFactory

friend class NodeFactory
friend

Definition at line 1071 of file CutNodes.h.

Member Data Documentation

◆ m_arguments

const std::vector<std::string> m_arguments
private

vector of string arguments of the MetaVariable

Definition at line 1081 of file CutNodes.h.

◆ m_name

const std::string m_name
private

Function name of the MetaVariable.

Definition at line 1080 of file CutNodes.h.

◆ m_var

const Var* m_var
private

set if there was a valid variable in this cut

Definition at line 1082 of file CutNodes.h.


The documentation for this class was generated from the following file: