User Guide
longitudinal_diffusion_block.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/block.hpp"
24 
25 namespace nmodl::ast {
26 
27 /**
28  * \addtogroup ast_class
29  * \ingroup ast
30  * \{
31  */
32 
33 /**
34  * \brief Extracts information required for LONGITUDINAL_DIFFUSION for each KINETIC block.
35  *
36  *
37 */
39  private:
40  /// Name of the longitudinal diffusion block
41  std::shared_ptr<Name> name;
42  /// All LONGITUDINAL_DIFFUSION statements in the KINETIC block.
43  std::shared_ptr<StatementBlock> longitudinal_diffusion_statements;
44  /// All (required) COMPARTMENT statements in the KINETIC block.
45  std::shared_ptr<StatementBlock> compartment_statements;
46  /// token with location information
47  std::shared_ptr<ModToken> token;
48  /// symbol table for a block
50 
51  public:
52  /// \name Ctor & dtor
53  /// \{
55  explicit LongitudinalDiffusionBlock(std::shared_ptr<Name> name, std::shared_ptr<StatementBlock> longitudinal_diffusion_statements, std::shared_ptr<StatementBlock> compartment_statements);
57  virtual ~LongitudinalDiffusionBlock() = default;
58  /// \}
59 
60  /**
61  * \brief Check if the ast node is an instance of ast::LongitudinalDiffusionBlock
62  * \return true as object is of type ast::LongitudinalDiffusionBlock
63  */
64  bool is_longitudinal_diffusion_block () 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  LongitudinalDiffusionBlock* clone() const override {
80  return new LongitudinalDiffusionBlock(*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::LONGITUDINAL_DIFFUSION_BLOCK
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. "LongitudinalDiffusionBlock"
109  *
110  * \sa Ast::get_node_name
111  */
112  std::string get_node_type_name() const noexcept override {
113  return "LongitudinalDiffusionBlock";
114  }
115 
116  /**
117  * \brief Return NMODL statement of ast node as std::string
118  *
119  * Every node is related to a special statement in the NMODL. This
120  * statement can be returned as a std::string for printing to
121  * text/json form.
122  *
123  * \return name of the statement as a string i.e. "LONGITUDINAL_DIFFUSION_BLOCK"
124  *
125  * \sa Ast::get_nmodl_name
126  */
127  std::string get_nmodl_name() const noexcept override {
128  return "LONGITUDINAL_DIFFUSION_BLOCK";
129  }
130 
131  /**
132  * \brief Get std::shared_ptr from `this` pointer of the current ast node
133  */
134  std::shared_ptr<Ast> get_shared_ptr() override {
135  return std::static_pointer_cast<LongitudinalDiffusionBlock>(shared_from_this());
136  }
137 
138  /**
139  * \brief Get std::shared_ptr from `this` pointer of the current ast node
140  */
141  std::shared_ptr<const Ast> get_shared_ptr() const override {
142  return std::static_pointer_cast<const LongitudinalDiffusionBlock>(shared_from_this());
143  }
144 
145  /**
146  * \brief Return associated token for the current ast node
147  *
148  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
149  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
150  * nullptr to store in the nmodl::symtab::SymbolTable.
151  *
152  * \return pointer to token if exist otherwise nullptr
153  */
154  const ModToken* get_token() const noexcept override {
155  return token.get();
156  }
157  /**
158  * \brief Return associated symbol table for the current ast node
159  *
160  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
161  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
162  * and it can be accessed using this method.
163  *
164  * \return pointer to the symbol table
165  *
166  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
167  */
169  return symtab;
170  }
171 
172 
173  /**
174  * \brief Return name of the node
175  *
176  * Some ast nodes have a member marked designated as node name. For example,
177  * in case of this ast::Name has name designated as a
178  * node name.
179  *
180  * \return name of the node as std::string
181  *
182  * \sa Ast::get_node_type_name
183  */
184  std::string get_node_name() const override;
185 
186  /**
187  * \brief Getter for member variable \ref LongitudinalDiffusionBlock.name
188  */
189  std::shared_ptr<Name> get_name() const noexcept {
190  return name;
191  }
192 
193 
194 
195  /**
196  * \brief Getter for member variable \ref LongitudinalDiffusionBlock.longitudinal_diffusion_statements
197  */
198  std::shared_ptr<StatementBlock> get_longitudinal_diffusion_statements() const noexcept {
200  }
201 
202 
203 
204  /**
205  * \brief Getter for member variable \ref LongitudinalDiffusionBlock.compartment_statements
206  */
207  std::shared_ptr<StatementBlock> get_compartment_statements() const noexcept {
208  return compartment_statements;
209  }
210  /// \}
211 
212  /// \name Setters
213  /// \{
214  /**
215  * \brief Set token for the current ast node
216  */
217  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
218  /**
219  * \brief Set symbol table for the current ast node
220  *
221  * Top level, block scoped nodes store symbol table in the ast node.
222  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
223  * for every node in the ast.
224  *
225  * \sa nmodl::visitor::SymtabVisitor
226  */
227  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
228  symtab = newsymtab;
229  }
230 
231  /**
232  * \brief Setter for member variable \ref LongitudinalDiffusionBlock.name (rvalue reference)
233  */
234  void set_name(std::shared_ptr<Name>&& name);
235 
236  /**
237  * \brief Setter for member variable \ref LongitudinalDiffusionBlock.name
238  */
239  void set_name(const std::shared_ptr<Name>& name);
240 
241 
242  /**
243  * \brief Setter for member variable \ref LongitudinalDiffusionBlock.longitudinal_diffusion_statements (rvalue reference)
244  */
245  void set_longitudinal_diffusion_statements(std::shared_ptr<StatementBlock>&& longitudinal_diffusion_statements);
246 
247  /**
248  * \brief Setter for member variable \ref LongitudinalDiffusionBlock.longitudinal_diffusion_statements
249  */
250  void set_longitudinal_diffusion_statements(const std::shared_ptr<StatementBlock>& longitudinal_diffusion_statements);
251 
252 
253  /**
254  * \brief Setter for member variable \ref LongitudinalDiffusionBlock.compartment_statements (rvalue reference)
255  */
256  void set_compartment_statements(std::shared_ptr<StatementBlock>&& compartment_statements);
257 
258  /**
259  * \brief Setter for member variable \ref LongitudinalDiffusionBlock.compartment_statements
260  */
261  void set_compartment_statements(const std::shared_ptr<StatementBlock>& compartment_statements);
262 
263  /// \}
264 
265  /// \name Visitor
266  /// \{
267  /**
268  * \brief visit children i.e. member variables of current node using provided visitor
269  *
270  * Different nodes in the AST have different members (i.e. children). This method
271  * recursively visits children using provided visitor.
272  *
273  * \param v Concrete visitor that will be used to recursively visit children
274  *
275  * \sa Ast::visit_children for example.
276  */
277  void visit_children(visitor::Visitor& v) override;
278 
279  /**
280  * \brief visit children i.e. member variables of current node using provided visitor
281  *
282  * Different nodes in the AST have different members (i.e. children). This method
283  * recursively visits children using provided visitor.
284  *
285  * \param v Concrete constant visitor that will be used to recursively visit children
286  *
287  * \sa Ast::visit_children for example.
288  */
289  void visit_children(visitor::ConstVisitor& v) const override;
290 
291  /**
292  * \brief accept (or visit) the current AST node using provided visitor
293  *
294  * Instead of visiting children of AST node, like Ast::visit_children,
295  * accept allows to visit the current node itself using provided concrete
296  * visitor.
297  *
298  * \param v Concrete visitor that will be used to recursively visit node
299  *
300  * \sa Ast::accept for example.
301  */
302  void accept(visitor::Visitor& v) override;
303 
304  /**
305  * \copydoc accept(visitor::Visitor&)
306  */
307  void accept(visitor::ConstVisitor& v) const override;
308  /// \}
309 
310  private:
311  /**
312  * \brief Set this object as parent for all the children
313  *
314  * This should be called in every object (with children) constructor
315  * to set parents. Since it is called only in the constructors it
316  * should not be virtual to avoid ambiguities (issue #295).
317  */
318  void set_parent_in_children();
319 };
320 
321 /** \} */ // end of ast_class
322 
323 
324 
325 
326 
327 } // namespace nmodl::ast
nmodl::visitor::ConstVisitor
Abstract base class for all constant visitors implementation.
Definition: visitor.hpp:302
nmodl::ast::LongitudinalDiffusionBlock::set_name
void set_name(std::shared_ptr< Name > &&name)
Setter for member variable LongitudinalDiffusionBlock::name (rvalue reference)
Definition: ast.cpp:13902
nmodl::ast::LongitudinalDiffusionBlock::get_name
std::shared_ptr< Name > get_name() const noexcept
Getter for member variable LongitudinalDiffusionBlock::name.
Definition: longitudinal_diffusion_block.hpp:189
nmodl::ast::LongitudinalDiffusionBlock::longitudinal_diffusion_statements
std::shared_ptr< StatementBlock > longitudinal_diffusion_statements
All LONGITUDINAL_DIFFUSION statements in the KINETIC block.
Definition: longitudinal_diffusion_block.hpp:43
nmodl::ast::LongitudinalDiffusionBlock::LongitudinalDiffusionBlock
LongitudinalDiffusionBlock(Name *name, StatementBlock *longitudinal_diffusion_statements, StatementBlock *compartment_statements)
Definition: ast.cpp:13849
nmodl::ast::LongitudinalDiffusionBlock::token
std::shared_ptr< ModToken > token
token with location information
Definition: longitudinal_diffusion_block.hpp:47
nmodl::ast::LongitudinalDiffusionBlock::get_longitudinal_diffusion_statements
std::shared_ptr< StatementBlock > get_longitudinal_diffusion_statements() const noexcept
Getter for member variable LongitudinalDiffusionBlock::longitudinal_diffusion_statements.
Definition: longitudinal_diffusion_block.hpp:198
ast_decl.hpp
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::ast::LongitudinalDiffusionBlock::get_shared_ptr
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: longitudinal_diffusion_block.hpp:134
block.hpp
Auto generated AST classes declaration.
nmodl::ast
Abstract Syntax Tree (AST) related implementations.
Definition: ast_common.hpp:29
nmodl::ast::LongitudinalDiffusionBlock::name
std::shared_ptr< Name > name
Name of the longitudinal diffusion block.
Definition: longitudinal_diffusion_block.hpp:41
nmodl::ast::AstNodeType
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:166
nmodl::ast::LongitudinalDiffusionBlock::is_longitudinal_diffusion_block
bool is_longitudinal_diffusion_block() const noexcept override
Check if the ast node is an instance of ast::LongitudinalDiffusionBlock.
Definition: longitudinal_diffusion_block.hpp:64
nmodl::ast::LongitudinalDiffusionBlock::accept
void accept(visitor::Visitor &v) override
accept (or visit) the current AST node using provided visitor
Definition: ast.cpp:13840
nmodl::ast::Block
Base class for all block scoped nodes.
Definition: block.hpp:41
nmodl::visitor::Visitor
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
nmodl::ast::LongitudinalDiffusionBlock::set_token
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: longitudinal_diffusion_block.hpp:217
nmodl::ast::LongitudinalDiffusionBlock::get_symbol_table
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: longitudinal_diffusion_block.hpp:168
nmodl::ast::LongitudinalDiffusionBlock
Extracts information required for LONGITUDINAL_DIFFUSION for each KINETIC block.
Definition: longitudinal_diffusion_block.hpp:38
nmodl::ast::LongitudinalDiffusionBlock::get_node_name
std::string get_node_name() const override
Return name of the node.
Definition: ast.cpp:13806
nmodl::ast::LongitudinalDiffusionBlock::clone
LongitudinalDiffusionBlock * clone() const override
Return a copy of the current node.
Definition: longitudinal_diffusion_block.hpp:79
nmodl::ast::LongitudinalDiffusionBlock::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: longitudinal_diffusion_block.hpp:141
nmodl::ast::LongitudinalDiffusionBlock::~LongitudinalDiffusionBlock
virtual ~LongitudinalDiffusionBlock()=default
nmodl::ast::LongitudinalDiffusionBlock::set_longitudinal_diffusion_statements
void set_longitudinal_diffusion_statements(std::shared_ptr< StatementBlock > &&longitudinal_diffusion_statements)
Setter for member variable LongitudinalDiffusionBlock::longitudinal_diffusion_statements (rvalue refe...
Definition: ast.cpp:13919
nmodl::ast::LongitudinalDiffusionBlock::get_node_type
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: longitudinal_diffusion_block.hpp:97
nmodl::symtab::SymbolTable
Represent symbol table for a NMODL block.
Definition: symbol_table.hpp:57
nmodl::ast::AstNodeType::LONGITUDINAL_DIFFUSION_BLOCK
@ LONGITUDINAL_DIFFUSION_BLOCK
type of ast::LongitudinalDiffusionBlock
nmodl::ast::LongitudinalDiffusionBlock::set_parent_in_children
void set_parent_in_children()
Set this object as parent for all the children.
Definition: ast.cpp:13883
nmodl::ast::LongitudinalDiffusionBlock::visit_children
void visit_children(visitor::Visitor &v) override
visit children i.e.
Definition: ast.cpp:13816
nmodl::ast::LongitudinalDiffusionBlock::set_symbol_table
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: longitudinal_diffusion_block.hpp:227
nmodl::ast::StatementBlock
Represents block encapsulating list of statements.
Definition: statement_block.hpp:53
nmodl::ast::LongitudinalDiffusionBlock::get_token
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: longitudinal_diffusion_block.hpp:154
nmodl::ast::LongitudinalDiffusionBlock::symtab
symtab::SymbolTable * symtab
symbol table for a block
Definition: longitudinal_diffusion_block.hpp:49
nmodl::ast::LongitudinalDiffusionBlock::get_compartment_statements
std::shared_ptr< StatementBlock > get_compartment_statements() const noexcept
Getter for member variable LongitudinalDiffusionBlock::compartment_statements.
Definition: longitudinal_diffusion_block.hpp:207
nmodl::ast::Name
Represents a name.
Definition: name.hpp:44
nmodl::ast::LongitudinalDiffusionBlock::compartment_statements
std::shared_ptr< StatementBlock > compartment_statements
All (required) COMPARTMENT statements in the KINETIC block.
Definition: longitudinal_diffusion_block.hpp:45
nmodl::ast::LongitudinalDiffusionBlock::get_nmodl_name
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: longitudinal_diffusion_block.hpp:127
nmodl::ast::LongitudinalDiffusionBlock::set_compartment_statements
void set_compartment_statements(std::shared_ptr< StatementBlock > &&compartment_statements)
Setter for member variable LongitudinalDiffusionBlock::compartment_statements (rvalue reference)
Definition: ast.cpp:13936
nmodl::ast::LongitudinalDiffusionBlock::get_node_type_name
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: longitudinal_diffusion_block.hpp:112
nmodl::ModToken
Represent token returned by scanner.
Definition: modtoken.hpp:50