User Guide
mutex_unlock.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 Represent MUTEXUNLOCK statement in NMODL
35  *
36  *
37 */
38 class MutexUnlock : public Statement {
39  private:
40  /// token with location information
41  std::shared_ptr<ModToken> token;
42 
43  public:
44  /// \name Ctor & dtor
45  /// \{
46  virtual ~MutexUnlock() = default;
47  /// \}
48 
49  /**
50  * \brief Check if the ast node is an instance of ast::MutexUnlock
51  * \return true as object is of type ast::MutexUnlock
52  */
53  bool is_mutex_unlock () const noexcept override {
54  return true;
55  }
56 
57  /**
58  * \brief Return a copy of the current node
59  *
60  * Recursively make a new copy/clone of the current node including
61  * all members and return a pointer to the node. This is used for
62  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
63  * ast.
64  *
65  * \return pointer to the clone/copy of the current node
66  */
67  // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks)
68  MutexUnlock* clone() const override {
69  return new MutexUnlock(*this);
70  }
71  // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
72 
73  /// \name Getters
74  /// \{
75 
76  /**
77  * \brief Return type (ast::AstNodeType) of ast node
78  *
79  * Every node in the ast has a type defined in ast::AstNodeType and this
80  * function is used to retrieve the same.
81  *
82  * \return ast node type i.e. ast::AstNodeType::MUTEX_UNLOCK
83  *
84  * \sa Ast::get_node_type_name
85  */
86  AstNodeType get_node_type() const noexcept override {
88  }
89 
90  /**
91  * \brief Return type (ast::AstNodeType) of ast node as std::string
92  *
93  * Every node in the ast has a type defined in ast::AstNodeType.
94  * This type name can be returned as a std::string for printing
95  * node to text/json form.
96  *
97  * \return name of the node type as a string i.e. "MutexUnlock"
98  *
99  * \sa Ast::get_node_name
100  */
101  std::string get_node_type_name() const noexcept override {
102  return "MutexUnlock";
103  }
104 
105  /**
106  * \brief Return NMODL statement of ast node as std::string
107  *
108  * Every node is related to a special statement in the NMODL. This
109  * statement can be returned as a std::string for printing to
110  * text/json form.
111  *
112  * \return name of the statement as a string i.e. "MUTEXUNLOCK"
113  *
114  * \sa Ast::get_nmodl_name
115  */
116  std::string get_nmodl_name() const noexcept override {
117  return "MUTEXUNLOCK";
118  }
119 
120  /**
121  * \brief Get std::shared_ptr from `this` pointer of the current ast node
122  */
123  std::shared_ptr<Ast> get_shared_ptr() override {
124  return std::static_pointer_cast<MutexUnlock>(shared_from_this());
125  }
126 
127  /**
128  * \brief Get std::shared_ptr from `this` pointer of the current ast node
129  */
130  std::shared_ptr<const Ast> get_shared_ptr() const override {
131  return std::static_pointer_cast<const MutexUnlock>(shared_from_this());
132  }
133 
134  /**
135  * \brief Return associated token for the current ast node
136  *
137  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
138  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
139  * nullptr to store in the nmodl::symtab::SymbolTable.
140  *
141  * \return pointer to token if exist otherwise nullptr
142  */
143  const ModToken* get_token() const noexcept override {
144  return token.get();
145  }
146  /// \}
147 
148  /// \name Setters
149  /// \{
150  /**
151  * \brief Set token for the current ast node
152  */
153  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
154  /// \}
155 
156  /// \name Visitor
157  /// \{
158  /**
159  * \brief visit children i.e. member variables of current node using provided visitor
160  *
161  * Different nodes in the AST have different members (i.e. children). This method
162  * recursively visits children using provided visitor.
163  *
164  * \param v Concrete visitor that will be used to recursively visit children
165  *
166  * \sa Ast::visit_children for example.
167  */
168  void visit_children(visitor::Visitor& v) override;
169 
170  /**
171  * \brief visit children i.e. member variables of current node using provided visitor
172  *
173  * Different nodes in the AST have different members (i.e. children). This method
174  * recursively visits children using provided visitor.
175  *
176  * \param v Concrete constant visitor that will be used to recursively visit children
177  *
178  * \sa Ast::visit_children for example.
179  */
180  void visit_children(visitor::ConstVisitor& v) const override;
181 
182  /**
183  * \brief accept (or visit) the current AST node using provided visitor
184  *
185  * Instead of visiting children of AST node, like Ast::visit_children,
186  * accept allows to visit the current node itself using provided concrete
187  * visitor.
188  *
189  * \param v Concrete visitor that will be used to recursively visit node
190  *
191  * \sa Ast::accept for example.
192  */
193  void accept(visitor::Visitor& v) override;
194 
195  /**
196  * \copydoc accept(visitor::Visitor&)
197  */
198  void accept(visitor::ConstVisitor& v) const override;
199  /// \}
200 
201 };
202 
203 /** \} */ // end of ast_class
204 
205 
206 } // namespace nmodl::ast
nmodl::visitor::ConstVisitor
Abstract base class for all constant visitors implementation.
Definition: visitor.hpp:298
nmodl::ast::AstNodeType::MUTEX_UNLOCK
@ MUTEX_UNLOCK
type of ast::MutexUnlock
nmodl::ast::MutexUnlock::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: mutex_unlock.hpp:130
nmodl::ast::MutexUnlock::get_shared_ptr
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: mutex_unlock.hpp:123
ast_decl.hpp
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::ast
Abstract Syntax Tree (AST) related implementations.
Definition: ast_common.hpp:29
nmodl::ast::MutexUnlock::get_node_type_name
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: mutex_unlock.hpp:101
nmodl::ast::AstNodeType
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:164
statement.hpp
Auto generated AST classes declaration.
nmodl::ast::MutexUnlock::accept
void accept(visitor::Visitor &v) override
accept (or visit) the current AST node using provided visitor
Definition: ast.cpp:10135
nmodl::ast::MutexUnlock::is_mutex_unlock
bool is_mutex_unlock() const noexcept override
Check if the ast node is an instance of ast::MutexUnlock.
Definition: mutex_unlock.hpp:53
nmodl::visitor::Visitor
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
nmodl::ast::MutexUnlock
Represent MUTEXUNLOCK statement in NMODL.
Definition: mutex_unlock.hpp:38
nmodl::ast::MutexUnlock::visit_children
void visit_children(visitor::Visitor &v) override
visit children i.e.
Definition: ast.cpp:10129
nmodl::ast::MutexUnlock::set_token
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: mutex_unlock.hpp:153
nmodl::ast::MutexUnlock::~MutexUnlock
virtual ~MutexUnlock()=default
nmodl::ast::MutexUnlock::get_node_type
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: mutex_unlock.hpp:86
nmodl::ast::MutexUnlock::clone
MutexUnlock * clone() const override
Return a copy of the current node.
Definition: mutex_unlock.hpp:68
nmodl::ast::Statement
TODO.
Definition: statement.hpp:38
nmodl::ast::MutexUnlock::get_token
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: mutex_unlock.hpp:143
nmodl::ast::MutexUnlock::get_nmodl_name
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: mutex_unlock.hpp:116
nmodl::ast::MutexUnlock::token
std::shared_ptr< ModToken > token
token with location information
Definition: mutex_unlock.hpp:41
nmodl::ModToken
Represent token returned by scanner.
Definition: modtoken.hpp:50