User Guide
indexedname_visitor.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Blue Brain Project, EPFL.
3  * See the top-level LICENSE file for details.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #pragma once
9 
10 /**
11  * \file
12  * \brief \copybrief nmodl::visitor::IndexedNameVisitor
13  */
14 
15 #include <string>
16 #include <unordered_set>
17 
19 #include "ast/indexed_name.hpp"
20 #include "ast/program.hpp"
21 #include "visitors/ast_visitor.hpp"
22 
23 namespace nmodl {
24 namespace visitor {
25 
26 /**
27  * \addtogroup visitor_classes
28  * \{
29  */
30 
31 /**
32  * \class IndexedNameVisitor
33  * \brief Get node name with indexed for the IndexedName node and
34  * the dependencies of DiffEqExpression node
35  */
37  private:
38  std::string indexed_name;
39  std::pair<std::string, std::unordered_set<std::string>> dependencies;
40 
41  public:
42  /// \name Ctor & dtor
43  /// \{
44 
45  /// Default constructor
46  IndexedNameVisitor() = default;
47 
48  /// \}
49 
50  /// Get node name with index for the IndexedName node
51  void visit_indexed_name(ast::IndexedName& node) override;
52 
53  /// Get dependencies for the DiffEqExpression node
55 
56  void visit_program(ast::Program& node) override;
57 
58  /// get the attribute indexed_name
59  std::string get_indexed_name();
60 
61  /// get the attribute dependencies
62  std::pair<std::string, std::unordered_set<std::string>> get_dependencies();
63 };
64 
65 /** \} */ // end of visitor_classes
66 
67 } // namespace visitor
68 } // namespace nmodl
nmodl::visitor::IndexedNameVisitor::get_indexed_name
std::string get_indexed_name()
get the attribute indexed_name
Definition: indexedname_visitor.cpp:33
indexed_name.hpp
Auto generated AST classes declaration.
nmodl::visitor::IndexedNameVisitor::visit_indexed_name
void visit_indexed_name(ast::IndexedName &node) override
Get node name with index for the IndexedName node.
Definition: indexedname_visitor.cpp:15
nmodl::ast::DiffEqExpression
Represents differential equation in DERIVATIVE block.
Definition: diff_eq_expression.hpp:38
nmodl
encapsulates code generation backend implementations
Definition: ast_common.hpp:26
nmodl::visitor::IndexedNameVisitor::visit_program
void visit_program(ast::Program &node) override
visit node of type ast::Program
Definition: indexedname_visitor.cpp:27
diff_eq_expression.hpp
Auto generated AST classes declaration.
nmodl::visitor::IndexedNameVisitor::indexed_name
std::string indexed_name
Definition: indexedname_visitor.hpp:38
program.hpp
Auto generated AST classes declaration.
nmodl::ast::IndexedName
Represents specific element of an array variable.
Definition: indexed_name.hpp:48
nmodl::visitor::IndexedNameVisitor::get_dependencies
std::pair< std::string, std::unordered_set< std::string > > get_dependencies()
get the attribute dependencies
Definition: indexedname_visitor.cpp:30
nmodl::visitor::AstVisitor
Concrete visitor for all AST classes.
Definition: ast_visitor.hpp:37
nmodl::visitor::IndexedNameVisitor::IndexedNameVisitor
IndexedNameVisitor()=default
Default constructor.
nmodl::visitor::IndexedNameVisitor
Get node name with indexed for the IndexedName node and the dependencies of DiffEqExpression node.
Definition: indexedname_visitor.hpp:36
nmodl::visitor::IndexedNameVisitor::dependencies
std::pair< std::string, std::unordered_set< std::string > > dependencies
Definition: indexedname_visitor.hpp:39
nmodl::ast::Program
Represents top level AST node for whole NMODL input.
Definition: program.hpp:39
nmodl::visitor::IndexedNameVisitor::visit_diff_eq_expression
void visit_diff_eq_expression(ast::DiffEqExpression &node) override
Get dependencies for the DiffEqExpression node.
Definition: indexedname_visitor.cpp:19
ast_visitor.hpp
Concrete visitor for all AST classes.