Belle II Software development
AbstractNodes.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <framework/utilities/AbstractNodes.h>
10
11namespace Belle2 {
17 void injectBooleanOperatorToStream(std::ostream& stream, const BooleanOperator& boperator)
18 {
19 switch (boperator) {
20 case BooleanOperator::AND:
21 stream << " and ";
22 break;
23 case BooleanOperator::OR:
24 stream << " or ";
25 break;
26 default:
27 throw std::runtime_error("Invalid BooleanOperator provided to injectBooleanOperatorToStream.");
28 }
29 }
30
31 void injectComparisonOperatorToStream(std::ostream& stream, const ComparisonOperator& coperator)
32 {
33 switch (coperator) {
34 case ComparisonOperator::EQUALEQUAL:
35 stream << " == ";
36 break;
37 case ComparisonOperator::GREATEREQUAL:
38 stream << " >= ";
39 break;
40 case ComparisonOperator::LESSEQUAL:
41 stream << " <= ";
42 break;
43 case ComparisonOperator::GREATER:
44 stream << " > ";
45 break;
46 case ComparisonOperator::LESS:
47 stream << " < ";
48 break;
49 case ComparisonOperator::NOTEQUAL:
50 stream << " != ";
51 break;
52 default:
53 throw std::runtime_error("Invalid ComparisonOperator provided to injectComparisonOperatorToStream.");
54 }
55 }
56
57 void injectArithmeticOperatorToStream(std::ostream& stream, const ArithmeticOperation& aoperation)
58 {
59 switch (aoperation) {
60 case ArithmeticOperation::PLUS:
61 stream << " + ";
62 break;
63 case ArithmeticOperation::MINUS:
64 stream << " - ";
65 break;
66 case ArithmeticOperation::PRODUCT:
67 stream << " * ";
68 break;
69 case ArithmeticOperation::DIVISION:
70 stream << " / ";
71 break;
72 case ArithmeticOperation::POWER:
73 stream << " ** ";
74 break;
75 default:
76 throw std::runtime_error("Invalid ArithmeticOperator provided to injectArithmeticOperatorToStream.");
77 }
78 }
80}
void injectArithmeticOperatorToStream(std::ostream &stream, const ArithmeticOperation &aoperation)
Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members S...
void injectComparisonOperatorToStream(std::ostream &stream, const ComparisonOperator &coperator)
Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members S...
void injectBooleanOperatorToStream(std::ostream &stream, const BooleanOperator &boperator)
Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members S...
ComparisonOperator
Enum for decoding the comparison operator type.
BooleanOperator
Enum for decoding the boolean operator type.
ArithmeticOperation
Enum for decoding the comparison operator type.
Abstract base class for different kinds of events.