NEURON
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
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
Concrete visitor for all AST classes.
Represents differential equation in DERIVATIVE block.
Represents specific element of an array variable.
Represents top level AST node for whole NMODL input.
Definition: program.hpp:39
Concrete visitor for all AST classes.
Definition: ast_visitor.hpp:37
Get node name with indexed for the IndexedName node and the dependencies of DiffEqExpression node.
IndexedNameVisitor()=default
Default constructor.
void visit_program(ast::Program &node) override
visit node of type ast::Program
void visit_indexed_name(ast::IndexedName &node) override
Get node name with index for the IndexedName node.
std::pair< std::string, std::unordered_set< std::string > > get_dependencies()
get the attribute dependencies
std::string get_indexed_name()
get the attribute indexed_name
void visit_diff_eq_expression(ast::DiffEqExpression &node) override
Get dependencies for the DiffEqExpression node.
std::pair< std::string, std::unordered_set< std::string > > dependencies
Auto generated AST classes declaration.
Auto generated AST classes declaration.
encapsulates code generation backend implementations
Definition: ast_common.hpp:26
static Node * node(Object *)
Definition: netcvode.cpp:291
Auto generated AST classes declaration.