Antares Simulator
Power System Simulator
|
A visitor class for generating DOT style output for ASTs (Abstract Syntax Trees). More...
#include <AstDOTStyleVisitor.h>
Public Member Functions | |
AstDOTStyleVisitor ()=default | |
Default constructor. | |
void | NewTreeGraph (std::ostream &os, const std::string &tree_name="ExpressionTree") |
Begins a new tree graph. | |
void | EndTreeGraph (std::ostream &os) |
Ends the current tree graph. | |
std::string | name () const override |
Returns the name of this visitor. | |
void | operator() (std::ostream &os, const Nodes::Node *root) |
Outputs the DOT representation of a node to a stream. | |
![]() | |
void | dispatch (const Nodes::Node *node, Args... args) |
virtual void | visit (const Nodes::SumNode *, Args... args)=0 |
Visits a SumNode and processes its children. | |
virtual void | visit (const Nodes::SubtractionNode *, Args... args)=0 |
Visits a SubtractionNode and processes its children. | |
virtual void | visit (const Nodes::MultiplicationNode *, Args... args)=0 |
Visits a MultiplicationNode and processes its children. | |
virtual void | visit (const Nodes::DivisionNode *, Args... args)=0 |
Visits a DivisionNode and processes its children. | |
virtual void | visit (const Nodes::EqualNode *, Args... args)=0 |
Visits an EqualNode and processes its children. | |
virtual void | visit (const Nodes::LessThanOrEqualNode *, Args... args)=0 |
Visits a LessThanOrEqualNode and processes its children. | |
virtual void | visit (const Nodes::GreaterThanOrEqualNode *, Args... args)=0 |
Visits a GreaterThanOrEqualNode and processes its children. | |
virtual void | visit (const Nodes::NegationNode *, Args... args)=0 |
Visits a NegationNode and processes its child. | |
virtual void | visit (const Nodes::LiteralNode *, Args... args)=0 |
Visits a LiteralNode. | |
virtual void | visit (const Nodes::VariableNode *, Args... args)=0 |
Visits a VariableNode. | |
virtual void | visit (const Nodes::ParameterNode *, Args... args)=0 |
Visits a ParameterNode. | |
virtual void | visit (const Nodes::PortFieldNode *, Args... args)=0 |
Visits a PortFieldNode. | |
virtual void | visit (const Nodes::PortFieldSumNode *, Args... args)=0 |
Visits a PortFieldSumNode. | |
virtual void | visit (const Nodes::ComponentVariableNode *, Args... args)=0 |
Visits a ComponentVariableNode. | |
virtual void | visit (const Nodes::ComponentParameterNode *, Args... args)=0 |
Visits a ComponentParameterNode. | |
![]() | |
bool | operator== (const IName &other) const =default |
A visitor class for generating DOT style output for ASTs (Abstract Syntax Trees).
This class extends the NodeVisitor
template class to produce a DOT representation of a given AST. The DOT format is commonly used for graph visualization tools, such as Graphviz. The visitor generates the graph structure, including nodes and edges, and outputs it to a stream.
NodeVisitor | A base class template for visiting nodes. |
std::ostream& | The type of the output stream where the DOT representation is written. |
void Antares::Expressions::Visitors::AstDOTStyleVisitor::EndTreeGraph | ( | std::ostream & | os | ) |
Ends the current tree graph.
Finalizes the DOT graph representation.
os | The output stream to which the DOT representation is written. |
|
overridevirtual |
Returns the name of this visitor.
Implements Antares::Expressions::IName.
void Antares::Expressions::Visitors::AstDOTStyleVisitor::NewTreeGraph | ( | std::ostream & | os, |
const std::string & | tree_name = "ExpressionTree" ) |
Begins a new tree graph.
Initializes the DOT graph representation and sets the tree name.
os | The output stream to which the DOT representation is written. |
tree_name | The name of the tree graph. Defaults to "ExpressionTree". |
void Antares::Expressions::Visitors::AstDOTStyleVisitor::operator() | ( | std::ostream & | os, |
const Nodes::Node * | root ) |
Outputs the DOT representation of a node to a stream.
This operator overload facilitates the use of the AstDOTStyleVisitor
with a node for direct streaming of the DOT representation.
os | The output stream to which the DOT representation is written. |
root | The root of the expression to be output. |