text_format.h
Go to the documentation of this file.
1 
9 #pragma once
10 #ifdef _MSC_VER
11 #pragma warning(disable:4702) // MSVC warns that there is unreachable code
12 #endif
13 
14 
15 #include "interop/util/exception.h"
18 
19 namespace illumina { namespace interop { namespace io
20 {
23  template<class Metric, class Layout>
24  struct text_format;
29  template<class Metric, int Version>
30  struct text_format<Metric, text_layout<Metric, Version> > : public abstract_text_format<Metric>
31  {
32  private:
34  typedef typename Metric::id_t id_t;
35  public:
37  typedef Metric metric_t;
39  typedef typename Metric::header_type header_t;
40 
50  size_t write_header(std::ostream &out,
51  const header_t &header,
52  const std::vector<std::string>& channel_names,
53  const char sep,
54  const char eol)
55  {
56  out << "# " << Metric::prefix() << Metric::suffix() << sep;
57  out << Version << eol;
58  return layout_t::write_header(out, header, channel_names, sep, eol);
59  }
60 
71  size_t write_metric(std::ostream &out,
72  const metric_t &metric,
73  const header_t &header,
74  const char sep,
75  const char eol,
76  const char missing)
77  {
78  return layout_t::write_metric(out, metric, header, sep, eol, missing);
79  }
80 
85  ::int16_t version() const
86  {
87  return static_cast< ::int16_t >(Version);
88  }
89  };
90 }}}
91 
92 
void write_metric(std::ostream &out, const MetricType &metric, const typename MetricType::header_type &header, const ::int16_t version)
Definition: metric_stream.h:263
Definition: enum_description.h:15
Definition: generic_layout.h:31
size_t write_metric(std::ostream &out, const metric_t &metric, const header_t &header, const char sep, const char eol, const char missing)
Definition: text_format.h:71
metric_t::id_t id_t
Definition: abstract_text_format.h:29
Definition: text_format.h:24
size_t write_header(std::ostream &out, const header_t &header, const std::vector< std::string > &channel_names, const char sep, const char eol)
Definition: text_format.h:50
Definition: abstract_text_format.h:22