User Guide
param_assign.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 ///
9 /// THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
10 ///
11 
12 #pragma once
13 
14 /**
15  * \dir
16  * \brief Auto generated AST Implementations
17  *
18  * \file
19  * \brief Auto generated AST classes declaration
20  */
21 
22 #include "ast/ast_decl.hpp"
23 #include "ast/statement.hpp"
24 
25 namespace nmodl::ast {
26 
27 /**
28  * \addtogroup ast_class
29  * \ingroup ast
30  * \{
31  */
32 
33 /**
34  * \brief TODO
35  *
36  *
37 */
38 class ParamAssign : public Statement {
39  private:
40  /// TODO
41  std::shared_ptr<Identifier> name;
42  /// TODO
43  std::shared_ptr<Number> value;
44  /// TODO
45  std::shared_ptr<Unit> unit;
46  /// TODO
47  std::shared_ptr<Limits> limit;
48  /// token with location information
49  std::shared_ptr<ModToken> token;
50 
51  public:
52  /// \name Ctor & dtor
53  /// \{
55  explicit ParamAssign(std::shared_ptr<Identifier> name, std::shared_ptr<Number> value, std::shared_ptr<Unit> unit, std::shared_ptr<Limits> limit);
56  ParamAssign(const ParamAssign& obj);
57  virtual ~ParamAssign() = default;
58  /// \}
59 
60  /**
61  * \brief Check if the ast node is an instance of ast::ParamAssign
62  * \return true as object is of type ast::ParamAssign
63  */
64  bool is_param_assign () const noexcept override {
65  return true;
66  }
67 
68  /**
69  * \brief Return a copy of the current node
70  *
71  * Recursively make a new copy/clone of the current node including
72  * all members and return a pointer to the node. This is used for
73  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
74  * ast.
75  *
76  * \return pointer to the clone/copy of the current node
77  */
78  // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks)
79  ParamAssign* clone() const override {
80  return new ParamAssign(*this);
81  }
82  // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
83 
84  /// \name Getters
85  /// \{
86 
87  /**
88  * \brief Return type (ast::AstNodeType) of ast node
89  *
90  * Every node in the ast has a type defined in ast::AstNodeType and this
91  * function is used to retrieve the same.
92  *
93  * \return ast node type i.e. ast::AstNodeType::PARAM_ASSIGN
94  *
95  * \sa Ast::get_node_type_name
96  */
97  AstNodeType get_node_type() const noexcept override {
99  }
100 
101  /**
102  * \brief Return type (ast::AstNodeType) of ast node as std::string
103  *
104  * Every node in the ast has a type defined in ast::AstNodeType.
105  * This type name can be returned as a std::string for printing
106  * node to text/json form.
107  *
108  * \return name of the node type as a string i.e. "ParamAssign"
109  *
110  * \sa Ast::get_node_name
111  */
112  std::string get_node_type_name() const noexcept override {
113  return "ParamAssign";
114  }
115 
116 
117  /**
118  * \brief Get std::shared_ptr from `this` pointer of the current ast node
119  */
120  std::shared_ptr<Ast> get_shared_ptr() override {
121  return std::static_pointer_cast<ParamAssign>(shared_from_this());
122  }
123 
124  /**
125  * \brief Get std::shared_ptr from `this` pointer of the current ast node
126  */
127  std::shared_ptr<const Ast> get_shared_ptr() const override {
128  return std::static_pointer_cast<const ParamAssign>(shared_from_this());
129  }
130 
131  /**
132  * \brief Return associated token for the current ast node
133  *
134  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
135  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
136  * nullptr to store in the nmodl::symtab::SymbolTable.
137  *
138  * \return pointer to token if exist otherwise nullptr
139  */
140  const ModToken* get_token() const noexcept override {
141  return token.get();
142  }
143 
144 
145  /**
146  * \brief Return name of the node
147  *
148  * Some ast nodes have a member marked designated as node name. For example,
149  * in case of this ast::Identifier has name designated as a
150  * node name.
151  *
152  * \return name of the node as std::string
153  *
154  * \sa Ast::get_node_type_name
155  */
156  std::string get_node_name() const override;
157 
158  /**
159  * \brief Getter for member variable \ref ParamAssign.name
160  */
161  std::shared_ptr<Identifier> get_name() const noexcept {
162  return name;
163  }
164 
165 
166 
167  /**
168  * \brief Getter for member variable \ref ParamAssign.value
169  */
170  std::shared_ptr<Number> get_value() const noexcept {
171  return value;
172  }
173 
174 
175 
176  /**
177  * \brief Getter for member variable \ref ParamAssign.unit
178  */
179  std::shared_ptr<Unit> get_unit() const noexcept {
180  return unit;
181  }
182 
183 
184 
185  /**
186  * \brief Getter for member variable \ref ParamAssign.limit
187  */
188  std::shared_ptr<Limits> get_limit() const noexcept {
189  return limit;
190  }
191  /// \}
192 
193  /// \name Setters
194  /// \{
195  /**
196  * \brief Set token for the current ast node
197  */
198  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
199 
200  /**
201  * \brief Setter for member variable \ref ParamAssign.name (rvalue reference)
202  */
203  void set_name(std::shared_ptr<Identifier>&& name);
204 
205  /**
206  * \brief Setter for member variable \ref ParamAssign.name
207  */
208  void set_name(const std::shared_ptr<Identifier>& name);
209 
210 
211  /**
212  * \brief Setter for member variable \ref ParamAssign.value (rvalue reference)
213  */
214  void set_value(std::shared_ptr<Number>&& value);
215 
216  /**
217  * \brief Setter for member variable \ref ParamAssign.value
218  */
219  void set_value(const std::shared_ptr<Number>& value);
220 
221 
222  /**
223  * \brief Setter for member variable \ref ParamAssign.unit (rvalue reference)
224  */
225  void set_unit(std::shared_ptr<Unit>&& unit);
226 
227  /**
228  * \brief Setter for member variable \ref ParamAssign.unit
229  */
230  void set_unit(const std::shared_ptr<Unit>& unit);
231 
232 
233  /**
234  * \brief Setter for member variable \ref ParamAssign.limit (rvalue reference)
235  */
236  void set_limit(std::shared_ptr<Limits>&& limit);
237 
238  /**
239  * \brief Setter for member variable \ref ParamAssign.limit
240  */
241  void set_limit(const std::shared_ptr<Limits>& limit);
242 
243  /// \}
244 
245  /// \name Visitor
246  /// \{
247  /**
248  * \brief visit children i.e. member variables of current node using provided visitor
249  *
250  * Different nodes in the AST have different members (i.e. children). This method
251  * recursively visits children using provided visitor.
252  *
253  * \param v Concrete visitor that will be used to recursively visit children
254  *
255  * \sa Ast::visit_children for example.
256  */
257  void visit_children(visitor::Visitor& v) override;
258 
259  /**
260  * \brief visit children i.e. member variables of current node using provided visitor
261  *
262  * Different nodes in the AST have different members (i.e. children). This method
263  * recursively visits children using provided visitor.
264  *
265  * \param v Concrete constant visitor that will be used to recursively visit children
266  *
267  * \sa Ast::visit_children for example.
268  */
269  void visit_children(visitor::ConstVisitor& v) const override;
270 
271  /**
272  * \brief accept (or visit) the current AST node using provided visitor
273  *
274  * Instead of visiting children of AST node, like Ast::visit_children,
275  * accept allows to visit the current node itself using provided concrete
276  * visitor.
277  *
278  * \param v Concrete visitor that will be used to recursively visit node
279  *
280  * \sa Ast::accept for example.
281  */
282  void accept(visitor::Visitor& v) override;
283 
284  /**
285  * \copydoc accept(visitor::Visitor&)
286  */
287  void accept(visitor::ConstVisitor& v) const override;
288  /// \}
289 
290  private:
291  /**
292  * \brief Set this object as parent for all the children
293  *
294  * This should be called in every object (with children) constructor
295  * to set parents. Since it is called only in the constructors it
296  * should not be virtual to avoid ambiguities (issue #295).
297  */
298  void set_parent_in_children();
299 };
300 
301 /** \} */ // end of ast_class
302 
303 
304 
305 
306 
307 
308 } // namespace nmodl::ast
nmodl::visitor::ConstVisitor
Abstract base class for all constant visitors implementation.
Definition: visitor.hpp:302
nmodl::ast::ParamAssign
TODO.
Definition: param_assign.hpp:38
nmodl::ast::ParamAssign::set_token
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: param_assign.hpp:198
nmodl::ast::Unit
TODO.
Definition: unit.hpp:38
nmodl::ast::Identifier
Base class for all identifiers.
Definition: identifier.hpp:41
nmodl::ast::ParamAssign::set_name
void set_name(std::shared_ptr< Identifier > &&name)
Setter for member variable ParamAssign::name (rvalue reference)
Definition: ast.cpp:8521
nmodl::ast::ParamAssign::name
std::shared_ptr< Identifier > name
TODO.
Definition: param_assign.hpp:41
ast_decl.hpp
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::ast::ParamAssign::get_name
std::shared_ptr< Identifier > get_name() const noexcept
Getter for member variable ParamAssign::name.
Definition: param_assign.hpp:161
nmodl::ast::AstNodeType::PARAM_ASSIGN
@ PARAM_ASSIGN
type of ast::ParamAssign
nmodl::ast
Abstract Syntax Tree (AST) related implementations.
Definition: ast_common.hpp:29
nmodl::ast::ParamAssign::unit
std::shared_ptr< Unit > unit
TODO.
Definition: param_assign.hpp:45
nmodl::ast::ParamAssign::visit_children
void visit_children(visitor::Visitor &v) override
visit children i.e.
Definition: ast.cpp:8409
nmodl::ast::ParamAssign::set_parent_in_children
void set_parent_in_children()
Set this object as parent for all the children.
Definition: ast.cpp:8498
nmodl::ast::ParamAssign::set_value
void set_value(std::shared_ptr< Number > &&value)
Setter for member variable ParamAssign::value (rvalue reference)
Definition: ast.cpp:8538
nmodl::ast::AstNodeType
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:166
statement.hpp
Auto generated AST classes declaration.
nmodl::ast::ParamAssign::get_node_name
std::string get_node_name() const override
Return name of the node.
Definition: ast.cpp:8396
nmodl::ast::ParamAssign::get_node_type
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: param_assign.hpp:97
nmodl::ast::ParamAssign::accept
void accept(visitor::Visitor &v) override
accept (or visit) the current AST node using provided visitor
Definition: ast.cpp:8451
nmodl::ast::ParamAssign::get_node_type_name
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: param_assign.hpp:112
nmodl::ast::ParamAssign::get_unit
std::shared_ptr< Unit > get_unit() const noexcept
Getter for member variable ParamAssign::unit.
Definition: param_assign.hpp:179
nmodl::visitor::Visitor
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
nmodl::ast::ParamAssign::set_limit
void set_limit(std::shared_ptr< Limits > &&limit)
Setter for member variable ParamAssign::limit (rvalue reference)
Definition: ast.cpp:8572
nmodl::ast::ParamAssign::~ParamAssign
virtual ~ParamAssign()=default
nmodl::ast::ParamAssign::value
std::shared_ptr< Number > value
TODO.
Definition: param_assign.hpp:43
nmodl::ast::ParamAssign::get_shared_ptr
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: param_assign.hpp:120
nmodl::ast::Statement
TODO.
Definition: statement.hpp:38
nmodl::ast::ParamAssign::limit
std::shared_ptr< Limits > limit
TODO.
Definition: param_assign.hpp:47
nmodl::ast::ParamAssign::is_param_assign
bool is_param_assign() const noexcept override
Check if the ast node is an instance of ast::ParamAssign.
Definition: param_assign.hpp:64
nmodl::ast::ParamAssign::get_limit
std::shared_ptr< Limits > get_limit() const noexcept
Getter for member variable ParamAssign::limit.
Definition: param_assign.hpp:188
nmodl::ast::ParamAssign::token
std::shared_ptr< ModToken > token
token with location information
Definition: param_assign.hpp:49
nmodl::ast::ParamAssign::get_token
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: param_assign.hpp:140
nmodl::ast::Number
Base class for all numbers.
Definition: number.hpp:39
nmodl::ast::ParamAssign::ParamAssign
ParamAssign(Identifier *name, Number *value, Unit *unit, Limits *limit)
Definition: ast.cpp:8460
nmodl::ast::ParamAssign::get_shared_ptr
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: param_assign.hpp:127
nmodl::ModToken
Represent token returned by scanner.
Definition: modtoken.hpp:50
nmodl::ast::Limits
TODO.
Definition: limits.hpp:38
nmodl::ast::ParamAssign::set_unit
void set_unit(std::shared_ptr< Unit > &&unit)
Setter for member variable ParamAssign::unit (rvalue reference)
Definition: ast.cpp:8555
nmodl::ast::ParamAssign::clone
ParamAssign * clone() const override
Return a copy of the current node.
Definition: param_assign.hpp:79
nmodl::ast::ParamAssign::get_value
std::shared_ptr< Number > get_value() const noexcept
Getter for member variable ParamAssign::value.
Definition: param_assign.hpp:170