metric_format_factory.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <vector>
11 #include "interop/util/map.h"
12 #include "interop/util/assert.h"
17 
23 #define INTEROP_REGISTER_METRIC_GENERIC_LAYOUT(Metric, Version) \
24  illumina::interop::io::metric_format_factory< Metric > \
25  illumina_interop_io_##Type##Metric##Version(new illumina::interop::io::metric_format<Metric, illumina::interop::io::generic_layout<Metric, Version> >);
26 
33 #define INTEROP_REGISTER_METRIC_ANOTHER_GENERIC_LAYOUT(Metric, Proxy, Version) \
34  illumina::interop::io::metric_format_factory< Proxy > \
35  illumina_interop_io_##Type##Proxy##Version(new illumina::interop::io::metric_format<Proxy, illumina::interop::io::generic_layout<Metric, Version> >);
36 
37 
38 namespace illumina { namespace interop { namespace io
39 {
47  template<class Metric>
49  {
51  typedef Metric metric_type;
55  typedef typename Metric::header_type header_type;
59  typedef INTEROP_UNORDERED_MAP(int, metric_format_pointer) metric_format_map;
60 
65  metric_format_factory(abstract_metric_format_t *pformat)
66  {
67  INTEROP_ASSERT(pformat != 0);
68  metric_formats()[pformat->version()] = metric_format_pointer(pformat);
69  }
70 
76  static metric_format_map &metric_formats()
77  {
78  INTEROP_FORCE_LINK_USE(metric_type);
79  static metric_format_map vec;
80  return vec;
81  }
82  };
83 
84 }}}
85 
86 
Metric metric_type
Definition: metric_format_factory.h:51
Definition: enum_description.h:15
Definition: abstract_metric_format.h:24
Definition: metric_format_factory.h:48
#define INTEROP_FORCE_LINK_USE(X)
Definition: self_registration.h:15
#define INTEROP_ASSERT(TST)
Definition: assert.h:21
static metric_format_map & metric_formats()
Definition: metric_format_factory.h:76
Metric::header_type header_type
Definition: metric_format_factory.h:55
typedef INTEROP_UNORDERED_MAP(int, metric_format_pointer) metric_format_map
std::unique_ptr< T > unique_ptr
Definition: unique_ptr.h:96
stdbp::unique_ptr< abstract_metric_format_t > metric_format_pointer
Definition: metric_format_factory.h:57
abstract_metric_format< metric_type > abstract_metric_format_t
Definition: metric_format_factory.h:53