vdj_pipe
pipeline for processing DNA sequence data
command_line_options.hpp
Go to the documentation of this file.
1 
6 #ifndef COMMAND_LINE_OPTIONS_HPP_
7 #define COMMAND_LINE_OPTIONS_HPP_
8 #include <iosfwd>
9 #include <string>
10 #include "boost/program_options/options_description.hpp"
11 #include "boost/program_options/variables_map.hpp"
12 #include "boost/property_tree/ptree.hpp"
13 #include "vdj_pipe/config.hpp"
14 #include "vdj_pipe/exception.hpp"
15 
16 namespace vdj_pipe{
17 
20 class VDJ_PIPE_DECL Command_line_options {
21  BOOST_STATIC_CONSTANT(std::size_t, unset = static_cast<std::size_t>(-1));
22 public:
23  struct Err : public base_exception {};
24 
25  static std::ostream& print_version(std::ostream& os);
26  static std::ostream& print_info(std::ostream& os);
27  static std::ostream& print_usage(std::ostream& os);
28 
30  : help_(),
31  max_reads_(unset),
32  max_file_reads_(unset),
33  version_(false),
34  no_stamp_(false),
35  args_provided_(false)
36  {
37  init_options();
38  }
39 
40  Command_line_options(int argc, char* argv[]);
41  bool is_help() const {return help_.size();}
42  std::string const& help_opt() const {return help_;}
43  bool version() const {return version_;}
44  bool args_provided() const {return args_provided_;}
45  std::ostream& print_help(std::ostream& os) const;
46  std::size_t max_reads() const {return max_reads_;}
47  std::size_t max_file_reads() const {return max_file_reads_;}
48  boost::property_tree::ptree tree() const;
49  std::vector<std::string> const& config_files() const {return config_fn_;}
50 
51  void add_config_file(std::string const& config_fn) {
52  config_fn_.push_back(config_fn);
53  }
54 
55  void set_path_input(std::string const& in_path) {in_path_ = in_path;}
56  void set_path_output(std::string const& out_path) {out_path_ = out_path;}
57 
58 private:
59  boost::program_options::options_description od_;
60  std::string out_path_;
61  std::string in_path_;
62  std::vector<std::string> config_fn_;
63  std::vector<std::string> input_csv_;
64  std::string help_;
65  std::size_t max_reads_;
66  std::size_t max_file_reads_;
67  bool version_;
68  bool no_stamp_;
69  bool args_provided_;
70 
71  void init_options();
72 
73  boost::property_tree::ptree options_to_tree() const;
74 };
75 
76 }//namespace vdj_pipe
77 #endif /* COMMAND_LINE_OPTIONS_HPP_ */
Definition: command_line_options.hpp:23
Definition: command_line_options.hpp:20
Main namespace of vdj_pipe library.
Definition: sequence_file.hpp:14
Definition: exception.hpp:23