Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
valued_argument.hpp
Go to the documentation of this file.
1 #ifndef STAN__GM__ARGUMENTS__VALUED__ARGUMENT__BETA
2 #define STAN__GM__ARGUMENTS__VALUED__ARGUMENT__BETA
3 
5 
6 namespace stan {
7 
8  namespace gm {
9 
10  class valued_argument: public argument {
11 
12  public:
13 
14  virtual void print(std::ostream* s, const int depth, const std::string prefix) {
15  if (!s)
16  return;
17 
18  std::string indent(compute_indent(depth), ' ');
19 
20  *s << prefix << indent << _name << " = " << print_value();
21  if(is_default())
22  *s << " (Default)";
23  *s << std::endl;
24  }
25 
26  virtual void print_help(std::ostream* s, const int depth, const bool recurse = false) {
27  if (!s)
28  return;
29 
30  std::string indent(indent_width * depth, ' ');
31  std::string subindent(indent_width, ' ');
32 
33  *s << indent << _name << "=<" << _value_type << ">" << std::endl;
34  *s << indent << subindent << _description << std::endl;
35  *s << indent << subindent << "Valid values:" << print_valid() << std::endl;
36  *s << indent << subindent << "Defaults to " << _default << std::endl;
37  *s << std::endl;
38 
39  }
40 
41  virtual std::string print_value() = 0;
42  virtual std::string print_valid() = 0;
43  virtual bool is_default() = 0;
44 
45  protected:
46 
47  std::string _default;
48  std::string _value_type;
49 
50  };
51 
52  } // gm
53 } // stan
54 #endif
virtual void print_help(std::ostream *s, const int depth, const bool recurse=false)
virtual std::string print_valid()=0
int compute_indent(const int depth)
Definition: argument.hpp:71
virtual bool is_default()=0
std::string _name
Definition: argument.hpp:76
virtual void print(std::ostream *s, const int depth, const std::string prefix)
virtual std::string print_value()=0
std::string _description
Definition: argument.hpp:77

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