Stan  2.14.0
probability, sampling & optimization
var_occurs_vis.hpp
Go to the documentation of this file.
1 #ifndef STAN_LANG_AST_FUN_VAR_OCCURS_VIS_HPP
2 #define STAN_LANG_AST_FUN_VAR_OCCURS_VIS_HPP
3 
4 #include <boost/variant/static_visitor.hpp>
5 #include <string>
6 
7 namespace stan {
8  namespace lang {
9 
10  struct nil;
11  struct int_literal;
12  struct double_literal;
13  struct array_expr;
14  struct variable;
15  struct fun;
16  struct integrate_ode;
17  struct integrate_ode_control;
18  struct index_op;
19  struct index_op_sliced;
20  struct conditional_op;
21  struct binary_op;
22  struct unary_op;
23 
24  struct var_occurs_vis : public boost::static_visitor<bool> {
31  explicit var_occurs_vis(const variable& e);
32 
40  bool operator()(const nil& e) const;
41 
49  bool operator()(const int_literal& e) const;
50 
58  bool operator()(const double_literal& e) const;
59 
68  bool operator()(const array_expr& e) const;
69 
77  bool operator()(const variable& e) const;
78 
86  bool operator()(const fun& e) const;
87 
95  bool operator()(const integrate_ode& e) const;
96 
104  bool operator()(const integrate_ode_control& e) const;
105 
114  bool operator()(const index_op& e) const;
115 
124  bool operator()(const index_op_sliced& e) const;
125 
134  bool operator()(const conditional_op& e) const;
135 
143  bool operator()(const binary_op& e) const;
144 
152  bool operator()(const unary_op& e) const;
153 
157  const std::string var_name_;
158  };
159 
160  }
161 }
162 #endif
var_occurs_vis(const variable &e)
Construct a visitor to detect whether the specified variable occurs in a statement.
Node for holding a double literal.
Probability, optimization and sampling library.
Structure to hold an array expression.
Definition: array_expr.hpp:17
Structure for an indexed expression.
Definition: index_op.hpp:14
Structure for function application.
Definition: fun.hpp:17
Structure for integrate diff eq statement.
bool operator()(const nil &e) const
Return true if the variable occurs in the specified expression.
const std::string var_name_
The name of the variable for which to search.
AST structure for holding an expression with a sequence of indexes.
Structure for the conditional operator.
Structure to hold a variable.
Definition: variable.hpp:14
AST structure for unary operations consisting of an operation and argument.
Definition: unary_op.hpp:14
Node for storing binary operations consisting of an operation and left and right arguments.
Definition: binary_op.hpp:15
The nil structure used as a placeholder for undefined or empty values in several structures.
Definition: nil.hpp:11
Structure for a diff eq integration statement with control parameters for the integrator.

     [ Stan Home Page ] © 2011–2016, Stan Development Team.