Stan  2.14.0
probability, sampling & optimization
Public Types | Public Member Functions | Public Attributes | List of all members
stan::lang::variable_map Struct Reference

A map from function names to their base declarations and their origin. More...

#include <variable_map.hpp>

Public Types

typedef std::pair< base_var_decl, var_originrange_t
 A variable type and the origin of its declaration. More...
 

Public Member Functions

bool exists (const std::string &name) const
 Return true if a variable has been declared with the specified name. More...
 
base_var_decl get (const std::string &name) const
 Return the type for the variable with the specified name. More...
 
base_expr_type get_base_type (const std::string &name) const
 Return the type declared for the variable with the specified name. More...
 
std::size_t get_num_dims (const std::string &name) const
 Return the number of dimensions declared for the variable with the specified name. More...
 
var_origin get_origin (const std::string &name) const
 Return the origin of the variable declaration for the variable with the specified name. More...
 
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 block. More...
 
void remove (const std::string &name)
 Remove the declaraiton for the variable with the specified name. More...
 

Public Attributes

std::map< std::string, range_tmap_
 The stored map from function names to their declarations and origins. More...
 

Detailed Description

A map from function names to their base declarations and their origin.

Definition at line 18 of file variable_map.hpp.

Member Typedef Documentation

§ range_t

A variable type and the origin of its declaration.

Definition at line 22 of file variable_map.hpp.

Member Function Documentation

§ add()

void stan::lang::variable_map::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 block.

Will destructively overwrite the declaration of an existing variable if called with a new declaration and origin.

Parameters
namevariable name
base_declvariable declaration
voorigin

Definition at line 34 of file variable_map_def.hpp.

§ exists()

bool stan::lang::variable_map::exists ( const std::string &  name) const

Return true if a variable has been declared with the specified name.

Parameters
namevariable name
Returns
true if the variable has been declared

Definition at line 10 of file variable_map_def.hpp.

§ get()

base_var_decl stan::lang::variable_map::get ( const std::string &  name) const

Return the type for the variable with the specified name.

Parameters
namevariable name
Returns
base declaration for variable with the specified name
Exceptions
std::invalid_argumentif the variable has not been declared

Definition at line 14 of file variable_map_def.hpp.

§ get_base_type()

base_expr_type stan::lang::variable_map::get_base_type ( const std::string &  name) const

Return the type declared for the variable with the specified name.

Parameters
namevariable name
Returns
base type
Exceptions
std::invalid_argumentif the variable has not been declared

Definition at line 20 of file variable_map_def.hpp.

§ get_num_dims()

size_t stan::lang::variable_map::get_num_dims ( const std::string &  name) const

Return the number of dimensions declared for the variable with the specified name.

Parameters
namevariable name
Returns
number of dimensions declared for variable
Exceptions
std::invalid_argumentif the variable has not been declared

Definition at line 24 of file variable_map_def.hpp.

§ get_origin()

var_origin stan::lang::variable_map::get_origin ( const std::string &  name) const

Return the origin of the variable declaration for the variable with the specified name.

Parameters
namevariable name
Returns
origin for the variable
Exceptions
std::invalid_argumentif the variable has not been declared

Definition at line 28 of file variable_map_def.hpp.

§ remove()

void stan::lang::variable_map::remove ( const std::string &  name)

Remove the declaraiton for the variable with the specified name.

If the variable had not already been declared, it the function exits silently.

Parameters
namename of variable to remove

Definition at line 40 of file variable_map_def.hpp.

Member Data Documentation

§ map_

std::map<std::string, range_t> stan::lang::variable_map::map_

The stored map from function names to their declarations and origins.

Definition at line 103 of file variable_map.hpp.


The documentation for this struct was generated from the following files:

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