Stan  2.10.0
probability, sampling & optimization
unvalued_argument.hpp
Go to the documentation of this file.
1 #ifndef STAN_SERVICES_ARGUMENTS_UNVALUED_ARGUMENT_HPP
2 #define STAN_SERVICES_ARGUMENTS_UNVALUED_ARGUMENT_HPP
3 
5 #include <iostream>
6 #include <string>
7 #include <vector>
8 
9 namespace stan {
10  namespace services {
11 
12  class unvalued_argument: public argument {
13  public:
15  : _is_present(false) {}
16 
18  const int depth,
19  const std::string& prefix) {}
20 
22  const int depth,
23  const bool recurse = false) {
24  std::string indent(indent_width * depth, ' ');
25  std::string subindent(indent_width, ' ');
26 
27  w(indent + _name);
28  w(indent + subindent + _description);
29  w();
30  }
31 
32  bool parse_args(std::vector<std::string>& args,
35  bool& help_flag) {
36  if (args.size() == 0)
37  return true;
38 
39  if ((args.back() == "help") || (args.back() == "help-all")) {
40  print_help(info, 0);
41  help_flag |= true;
42  args.clear();
43  return true;
44  }
45 
46  _is_present = true;
47  return true;
48  }
49 
50  bool is_present() {
51  return _is_present;
52  }
53 
54  protected:
56  };
57 
58  } // services
59 } // stan
60 
61 #endif
Probability, optimization and sampling library.
bool parse_args(std::vector< std::string > &args, interface_callbacks::writer::base_writer &info, interface_callbacks::writer::base_writer &err, bool &help_flag)
void print_help(interface_callbacks::writer::base_writer &w, const int depth, const bool recurse=false)
std::string _description
Definition: argument.hpp:84
base_writer is an abstract base class defining the interface for Stan writer callbacks.
Definition: base_writer.hpp:20
void print(interface_callbacks::writer::base_writer &w, const int depth, const std::string &prefix)

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