paths.h
Go to the documentation of this file.
1 
9 #pragma once
10 #include <string>
12 
13 namespace illumina { namespace interop { namespace io
14 {
15 
18  class paths
19  {
20  public:
27  static std::string rta_config(const std::string &run_directory, const int version=3)
28  {
29  return io::combine(run_directory, rta_config(version));
30  }
35  static std::string run_info(const std::string &run_directory)
36  {
37  return io::combine(run_directory, run_info());
38  }
45  static std::string run_parameters(const std::string &run_directory, const bool alternate=false)
46  {
47  return io::combine(run_directory, run_parameters(alternate));
48  }
53  static std::string run_info()
54  {
55  return "RunInfo.xml";
56  }
62  static std::string run_parameters(const bool alternate=false)
63  {
64  if(alternate) return "runParameters.xml";
65  return "RunParameters.xml";
66  }
76  template<class MetricType>
77  static std::string interop_filename(const std::string &run_directory, bool use_out = true)
78  {
79  return interop_filename(run_directory, MetricType::prefix(), MetricType::suffix(), use_out);
80  }
81 
90  template<class MetricType>
91  static std::string interop_basename(bool use_out = true)
92  {
93  return interop_basename(MetricType::prefix(), MetricType::suffix(), use_out);
94  }
100  static std::string rta_config(const int version=3)
101  {
102  if(version == 3) return "RTA3.cfg";
103  return "RTAConfiguration.xml";
104  }
105 
106  private:
117  static std::string interop_basename(const std::string &prefix,
118  const std::string &suffix,
119  const bool use_out = true)
120  {
121  return prefix + "Metrics" + suffix + ((use_out) ? ("Out.bin") : (".bin"));
122  }
123 
135  static std::string interop_filename(const std::string &run_directory,
136  const std::string &prefix,
137  const std::string &suffix,
138  const bool use_out = true)
139  {
140  if (io::basename(run_directory) == interop_basename(prefix, suffix, use_out))
141  return run_directory;
142  if (io::basename(run_directory) == "InterOp")
143  return io::combine(run_directory, interop_basename(prefix, suffix, use_out));
144  return io::combine(interop_directory_name(run_directory), interop_basename(prefix, suffix, use_out));
145  }
151  static std::string interop_directory_name(const std::string &run_directory)
152  {
153  return io::combine(run_directory, "InterOp");
154  }
160  static std::string cycle_folder(const size_t cycle)
161  {
162  return "C" + util::lexical_cast<std::string>(cycle)+".1";
163  }
164 
165  public:
178  static std::string interop_filename(const std::string &run_directory,
179  const std::string &prefix,
180  const std::string &suffix,
181  const size_t cycle,
182  const bool use_out = true)
183  {
184  if (io::basename(run_directory) == interop_basename(prefix, suffix, use_out))
185  return run_directory;
186  if (io::basename(run_directory) == "InterOp")
187  return io::combine(io::combine(run_directory, cycle_folder(cycle)), interop_basename(prefix, suffix, use_out));
188  return io::combine(io::combine(interop_directory_name(run_directory), cycle_folder(cycle)), interop_basename(prefix, suffix, use_out));
189  }
190 
201  template<class MetricType>
202  static std::string interop_filename(const std::string &run_directory, const size_t cycle, bool use_out = true)
203  {
204  return interop_filename(run_directory, MetricType::prefix(), MetricType::suffix(), cycle, use_out);
205  }
206 
207  };
208 
209 }}}
210 
211 
Definition: enum_description.h:15
static std::string interop_filename(const std::string &run_directory, bool use_out=true)
Definition: paths.h:77
std::string basename(std::string const &source)
Definition: filesystem.cpp:95
static std::string run_info()
Definition: paths.h:53
std::string combine(const std::string &path, const std::string &name)
Definition: filesystem.cpp:39
static std::string interop_filename(const std::string &run_directory, const std::string &prefix, const std::string &suffix, const size_t cycle, const bool use_out=true)
Definition: paths.h:178
static std::string interop_filename(const std::string &run_directory, const size_t cycle, bool use_out=true)
Definition: paths.h:202
static std::string run_parameters(const std::string &run_directory, const bool alternate=false)
Definition: paths.h:45
static std::string rta_config(const int version=3)
Definition: paths.h:100
static std::string run_parameters(const bool alternate=false)
Definition: paths.h:62
Definition: paths.h:18
static std::string run_info(const std::string &run_directory)
Definition: paths.h:35
static std::string interop_basename(bool use_out=true)
Definition: paths.h:91
static std::string rta_config(const std::string &run_directory, const int version=3)
Definition: paths.h:27
Destination lexical_cast(const Source &src)
Definition: lexical_cast.h:264