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 
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_;
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_ */
bool args_provided_
Definition: command_line_options.hpp:69
Definition: command_line_options.hpp:23
void add_config_file(std::string const &config_fn)
Definition: command_line_options.hpp:51
Command_line_options()
Definition: command_line_options.hpp:29
std::vector< std::string > const & config_files() const
Definition: command_line_options.hpp:49
Definition: command_line_options.hpp:20
std::size_t max_reads_
Definition: command_line_options.hpp:65
std::size_t max_file_reads() const
Definition: command_line_options.hpp:47
bool args_provided() const
Definition: command_line_options.hpp:44
bool no_stamp_
Definition: command_line_options.hpp:68
std::string help_
Definition: command_line_options.hpp:64
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
#define VDJ_PIPE_DECL
Definition: config.hpp:23
bool is_help() const
Definition: command_line_options.hpp:41
boost::program_options::options_description od_
Definition: command_line_options.hpp:59
Definition: exception.hpp:23
std::size_t max_reads() const
Definition: command_line_options.hpp:46
std::size_t max_file_reads_
Definition: command_line_options.hpp:66
std::string const & help_opt() const
Definition: command_line_options.hpp:42
std::vector< std::string > config_fn_
Definition: command_line_options.hpp:62
bool version_
Definition: command_line_options.hpp:67
std::string in_path_
Definition: command_line_options.hpp:61
void set_path_output(std::string const &out_path)
Definition: command_line_options.hpp:56
std::string out_path_
Definition: command_line_options.hpp:60
std::vector< std::string > input_csv_
Definition: command_line_options.hpp:63
void set_path_input(std::string const &in_path)
Definition: command_line_options.hpp:55
bpt::ptree ptree
Definition: processing_step_utils.hpp:19
bool version() const
Definition: command_line_options.hpp:43