empty_var_context.hpp
Go to the documentation of this file.
1 #ifndef STAN_IO_EMPTY_VAR_CONTEXT_HPP
2 #define STAN_IO_EMPTY_VAR_CONTEXT_HPP
3 
5 #include <string>
6 #include <vector>
7 
8 namespace stan {
9  namespace io {
10 
11  /**
12  * This is an implementation of a var_context that doesn't contain
13  * any variables.
14  */
15  class empty_var_context : public var_context {
16  public:
17  /**
18  * Destructor
19  */
20  virtual ~empty_var_context() {}
21 
22  /**
23  * Return <code>true</code> if the specified variable name is
24  * defined. Always returns <code>false</code>.
25  *
26  * @param name Name of variable.
27  * @return <code>false</code>
28  */
29  bool contains_r(const std::string& name) const {
30  return false;
31  }
32 
33  /**
34  * Always returns an empty vector.
35  *
36  * @param name Name of variable.
37  * @return empty vector
38  */
39  std::vector<double> vals_r(const std::string& name) const {
40  return std::vector<double>();
41  }
42 
43  /**
44  * Always returns an empty vector.
45  *
46  * @param name Name of variable.
47  * @return empty vector
48  */
49  std::vector<size_t> dims_r(const std::string& name) const {
50  return std::vector<size_t>();
51  }
52 
53  /**
54  * Return <code>true</code> if the specified variable name has
55  * integer values. Always returns <code>false</code>.
56  *
57  * @param name Name of variable.
58  * @return false
59  */
60  bool contains_i(const std::string& name) const {
61  return false;
62  }
63 
64  /**
65  * Returns an empty vector.
66  *
67  * @param name Name of variable.
68  * @return empty vector
69  */
70  std::vector<int> vals_i(const std::string& name) const {
71  return std::vector<int>();
72  }
73 
74  /**
75  * Return the dimensions of the specified floating point variable.
76  * Returns an empty vector.
77  *
78  * @param name Name of variable.
79  * @return empty vector
80  */
81  std::vector<size_t> dims_i(const std::string& name) const {
82  return std::vector<size_t>();
83  }
84 
85  /**
86  * Fill a list of the names of the floating point variables in
87  * the context. This context has no variables.
88  *
89  * @param names Vector to store the list of names in.
90  */
91  void names_r(std::vector<std::string>& names) const {
92  names.clear();
93  }
94 
95  /**
96  * Fill a list of the names of the integer variables in
97  * the context. This context has no variables.
98  *
99  * @param names Vector to store the list of names in.
100  */
101  void names_i(std::vector<std::string>& names) const {
102  names.clear();
103  }
104  };
105 
106  }
107 }
108 #endif
const XML_Char * name
Definition: expat.h:151
std::vector< size_t > dims_i(const std::string &name) const
void names_i(std::vector< std::string > &names) const
bool contains_i(const std::string &name) const
std::vector< size_t > dims_r(const std::string &name) const
std::vector< double > vals_r(const std::string &name) const
std::vector< int > vals_i(const std::string &name) const
void names_r(std::vector< std::string > &names) const
bool contains_r(const std::string &name) const
enum BeamMode string