26 #include "antares/expressions/visitors/NodeVisitor.h"
28 namespace Antares::Expressions::Visitors
92 static void NewTreeGraph(std::ostream& os,
const std::string& tree_name =
"ExpressionTree");
108 std::string
name()
const override;
122 void visit(
const Nodes::SumNode* node, std::ostream& os)
override;
141 void computeNumberNodesPerType();
142 void makeLegend(std::ostream& os);
165 static void emitNode(
unsigned int id,
166 const std::string& label,
182 const std::string& label,
191 std::map<const Nodes::Node*, unsigned int> nodeIds_;
198 std::map<std::string, unsigned int> nbNodesPerType_;
205 unsigned int nodeCount_ = 0;
Represents a AllTimeSumNode node in a syntax tree.
Definition: AllTimeSumNode.h:31
Represents a division node in a syntax tree.
Definition: DivisionNode.h:31
Represents an equality comparison node in a syntax tree.
Definition: EqualNode.h:31
AST node representing a function expression (max, min, pow, ...).
Definition: FunctionNode.h:63
Represents a greater than or equal comparison node in a syntax tree.
Definition: GreaterThanOrEqualNode.h:31
Represents a less than or equal comparison node in a syntax tree.
Definition: LessThanOrEqualNode.h:31
Represents a literal node in a syntax tree, storing a double value.
Definition: LiteralNode.h:11
Represents a multiplication node in a syntax tree.
Definition: MultiplicationNode.h:31
Represents a negation node in a syntax tree.
Definition: NegationNode.h:31
Base class for nodes in a syntax tree.
Definition: Node.h:30
Represents a parameter node in a syntax tree, storing a string value.
Definition: ParameterNode.h:14
Definition: ParentNode.h:41
Represents a port field node in a syntax tree.
Definition: PortFieldNode.h:32
Represents a port field node where the expression is a sum.
Definition: PortFieldSumNode.h:32
Represents a subtraction node in a syntax tree.
Definition: SubtractionNode.h:31
Definition: TimeIndexNode.h:28
Definition: TimeShiftNode.h:29
Definition: TimeSumNode.h:28
Represents a variable node in a syntax tree, storing a string value.
Definition: VariableNode.h:20
A visitor class for generating DOT style output for ASTs (Abstract Syntax Trees).
Definition: AstDOTStyleVisitor.h:77
AstDOTStyleVisitor()=default
Default constructor.
void EndTreeGraph(std::ostream &os)
Ends the current tree graph.
Definition: AstDOTStyleVisitor.cpp:244
static void NewTreeGraph(std::ostream &os, const std::string &tree_name="ExpressionTree")
Begins a new tree graph.
Definition: AstDOTStyleVisitor.cpp:238
std::string name() const override
Returns the name of this visitor.
Definition: AstDOTStyleVisitor.cpp:189
void operator()(std::ostream &os, const Nodes::Node *root)
Outputs the DOT representation of a node to a stream.
Definition: AstDOTStyleVisitor.cpp:261
Definition: NodeVisitor.h:76
Represents the style attributes for a box in a graph.
Definition: AstDOTStyleVisitor.h:38
std::string_view style
The style of the box.
Definition: AstDOTStyleVisitor.h:61
std::string_view shape
The shape of the box.
Definition: AstDOTStyleVisitor.h:53
std::string_view color
The color of the box.
Definition: AstDOTStyleVisitor.h:45