1 #ifndef STAN_LANG_AST_VARIABLE_MAP_DEF_HPP 2 #define STAN_LANG_AST_VARIABLE_MAP_DEF_HPP 11 return map_.find(name) !=
map_.end();
16 throw std::invalid_argument(
"variable does not exist");
17 return map_.find(name)->second.first;
21 return get(name).base_type_;
25 return get(name).dims_.size();
30 throw std::invalid_argument(
"variable does not exist");
31 return map_.find(name)->second.second;
Probability, optimization and sampling library.
std::pair< base_var_decl, var_origin > range_t
A variable type and the origin of its declaration.
void add(const std::string &name, const base_var_decl &base_decl, const var_origin &vo)
Add the specified declaration for a variable with the specified name originating in the specified blo...
int base_expr_type
The type of a base expression.
void remove(const std::string &name)
Remove the declaraiton for the variable with the specified name.
bool exists(const std::string &name) const
Return true if a variable has been declared with the specified name.
std::size_t get_num_dims(const std::string &name) const
Return the number of dimensions declared for the variable with the specified name.
var_origin get_origin(const std::string &name) const
Return the origin of the variable declaration for the variable with the specified name...
int var_origin
The type of a variable indicating where a variable was declared.
AST base class for variable declarations, which share most of their structure.
std::map< std::string, range_t > map_
The stored map from function names to their declarations and origins.
base_expr_type get_base_type(const std::string &name) const
Return the type declared for the variable with the specified name.
base_var_decl get(const std::string &name) const
Return the type for the variable with the specified name.