Stan  2.14.0
probability, sampling & optimization
variable_map.hpp
Go to the documentation of this file.
1 #ifndef STAN_LANG_AST_VARIABLE_MAP_HPP
2 #define STAN_LANG_AST_VARIABLE_MAP_HPP
3 
6 #include <cstddef>
7 #include <map>
8 #include <string>
9 #include <utility>
10 
11 namespace stan {
12  namespace lang {
13 
18  struct variable_map {
22  typedef std::pair<base_var_decl, var_origin> range_t;
23 
31  bool exists(const std::string& name) const;
32 
41  base_var_decl get(const std::string& name) const;
42 
52  base_expr_type get_base_type(const std::string& name) const;
53 
63  std::size_t get_num_dims(const std::string& name) const;
64 
74  var_origin get_origin(const std::string& name) const;
75 
86  void add(const std::string& name,
87  const base_var_decl& base_decl,
88  const var_origin& vo);
89 
97  void remove(const std::string& name);
98 
103  std::map<std::string, range_t> map_;
104  };
105 
106  }
107 }
108 #endif
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.
A map from function names to their base declarations and their origin.
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.
Definition: var_origin.hpp:12
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.

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