Stan  2.10.0
probability, sampling & optimization
valued_argument.hpp
Go to the documentation of this file.
1 #ifndef STAN_SERVICES_ARGUMENTS_VALUED_ARGUMENT_HPP
2 #define STAN_SERVICES_ARGUMENTS_VALUED_ARGUMENT_HPP
3 
5 #include <string>
6 
7 namespace stan {
8  namespace services {
9 
10  class valued_argument: public argument {
11  public:
13  const int depth,
14  const std::string& prefix) {
15  std::string indent(compute_indent(depth), ' ');
16 
17  std::string message = prefix + indent + _name + " = " + print_value();
18 
19  if (is_default())
20  message +=" (Default)";
21  w(message);
22  }
23 
25  const int depth,
26  const bool recurse = false) {
27  std::string indent(indent_width * depth, ' ');
28  std::string subindent(indent_width, ' ');
29 
30  w(indent + _name + "=<" + _value_type + ">");
31  w(indent + subindent + _description);
32  w(indent + subindent + "Valid values:" + print_valid());
33  w(indent + subindent + "Defaults to " + _default);
34  w();
35  }
36 
37  virtual std::string print_value() = 0;
38  virtual std::string print_valid() = 0;
39  virtual bool is_default() = 0;
40 
41  protected:
42  std::string _default;
43  std::string _value_type;
44  };
45 
46  } // services
47 } // stan
48 
49 #endif
virtual void print(interface_callbacks::writer::base_writer &w, const int depth, const std::string &prefix)
Probability, optimization and sampling library.
std::string _description
Definition: argument.hpp:84
virtual void print_help(interface_callbacks::writer::base_writer &w, const int depth, const bool recurse=false)
virtual std::string print_value()=0
int compute_indent(const int depth)
Definition: argument.hpp:78
base_writer is an abstract base class defining the interface for Stan writer callbacks.
Definition: base_writer.hpp:20
virtual std::string print_valid()=0

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