metric_type_ext.h
Go to the documentation of this file.
1 
8 #pragma once
13 
14 namespace illumina { namespace interop { namespace logic { namespace utils
15 {
16 
23  {
24  using namespace constants;
25  // TODO: This can be reduced to a single macro define
26  typedef std::pair<metric_type, metric_group > mapped_t;
27 # define INTEROP_TUPLE1(Metric)
28 # define INTEROP_TUPLE4(Metric, Unused1, Group, Unused2) mapped_t(Metric,Group),
29 # define INTEROP_TUPLE7(Metric, Unused1, Group, Unused2, Unused3, Unused4, Unused5) mapped_t(Metric,Group),
30  static const mapped_t name_types[] = {INTEROP_ENUM_METRIC_TYPES};
31 # undef INTEROP_TUPLE7
32 # undef INTEROP_TUPLE4
33 # undef INTEROP_TUPLE1
34  return util::constant_mapping_get(name_types, type, UnknownMetricGroup);
35  }
41  inline const std::string to_description(const constants::metric_type type)
42  {
43  using namespace constants;
44  // TODO: This can be reduced to a single macro define
45  typedef std::pair<metric_type, std::string > mapped_t;
46 # define INTEROP_TUPLE1(Metric)
47 # define INTEROP_TUPLE4(Metric, Description, Unused1, Unused2) mapped_t(Metric,Description),
48 # define INTEROP_TUPLE7(Metric, Description, Unused1, Unused2, Unused3, Unused4, Unused5) mapped_t(Metric,Description),
49  static const mapped_t name_types[] = {INTEROP_ENUM_METRIC_TYPES};
50 # undef INTEROP_TUPLE7
51 # undef INTEROP_TUPLE4
52 # undef INTEROP_TUPLE1
53  return util::constant_mapping_get(name_types, type, std::string("UnknownDescription"));
54  }
60  {
61  using namespace constants;
62  // TODO: This can be reduced to a single macro define
63  typedef std::pair<metric_type, std::string > mapped_t;
64 # define INTEROP_TUPLE1(Metric)
65 # define INTEROP_TUPLE4(Metric, Description, Unused1, Unused2) mapped_t(Metric,Description),
66 # define INTEROP_TUPLE7(Metric, Description, Unused1, Unused2, Unused3, Unused4, Unused5) mapped_t(Metric,Description),
67  static const mapped_t name_types[] = {INTEROP_ENUM_METRIC_TYPES};
68 # undef INTEROP_TUPLE7
69 # undef INTEROP_TUPLE4
70 # undef INTEROP_TUPLE1
71  types.assign(name_types, name_types+util::length_of(name_types));
72  }
79  {
80  using namespace constants;
81  // TODO: This can be reduced to a single macro define
82  typedef std::pair<metric_type, metric_feature_type > mapped_t;
83 # define INTEROP_TUPLE1(Metric)
84 # define INTEROP_TUPLE4(Metric, Unused1, Unused2, Feature) mapped_t(Metric,static_cast<metric_feature_type>(Feature)),
85 # define INTEROP_TUPLE7(Metric, Unused1, Unused2, Feature, Unused3, Unused4, Unused5) mapped_t(Metric,static_cast<metric_feature_type>(Feature)),
86  static const mapped_t name_types[] = {INTEROP_ENUM_METRIC_TYPES};
87 # undef INTEROP_TUPLE7
88 # undef INTEROP_TUPLE4
89 # undef INTEROP_TUPLE1
90  return util::constant_mapping_get(name_types, type, UnknownMetricFeature);
91  }
98  {
99  using namespace constants;
100  // TODO: This can be reduced to a single macro define
101  typedef std::pair<metric_group, metric_feature_type > mapped_t;
102 # define INTEROP_TUPLE2(Group, Feature) mapped_t(Group,static_cast<metric_feature_type>(Feature))
103 # define INTEROP_TUPLE1(Group) mapped_t(Group,UnknownMetricFeature)
104  static const mapped_t name_types[] = {INTEROP_ENUM_METRIC_GROUPS};
105 # undef INTEROP_TUPLE2
106 # undef INTEROP_TUPLE1
107  return util::constant_mapping_get(name_types, type, UnknownMetricFeature);
108  }
109 
115  inline bool is_base_metric(const constants::metric_type type)
116  {
118  }
119 
126  {
128  }
129 
135  inline bool is_read_metric(const constants::metric_type type)
136  {
138  }
139 
145  inline bool is_cycle_metric(const constants::metric_type type)
146  {
148  }
149 
155  inline bool is_tile_metric(const constants::metric_type type)
156  {
158  }
159 
160 }}}}
161 
metric_type
Definition: enums.h:284
Definition: enum_description.h:15
const Value & constant_mapping_get(const std::pair< Key, Value >(&pairs)[N], const Key &key, const Value &default_value)
Definition: constant_mapping.h:122
bool is_tile_metric(const constants::metric_type type)
Definition: metric_type_ext.h:155
void list_descriptions(std::vector< constants::enum_description< constants::metric_type > > &types)
Definition: metric_type_ext.h:59
metric_group
Definition: enums.h:289
const std::string to_description(const constants::metric_type type)
Definition: metric_type_ext.h:41
constants::metric_group to_group(const constants::metric_type type)
Definition: metric_type_ext.h:22
metric_feature_type
Definition: enums.h:334
bool is_read_metric(const constants::metric_type type)
Definition: metric_type_ext.h:135
#define INTEROP_ENUM_METRIC_GROUPS
Definition: enums.h:77
constants::metric_feature_type to_feature(const constants::metric_type type)
Definition: metric_type_ext.h:78
Definition: enum_description.h:20
bool is_channel_metric(const constants::metric_type type)
Definition: metric_type_ext.h:125
bool is_cycle_metric(const constants::metric_type type)
Definition: metric_type_ext.h:145
size_t length_of(const T &val)
Definition: length_of.h:55
#define INTEROP_ENUM_METRIC_TYPES
Definition: enums.h:42
bool is_base_metric(const constants::metric_type type)
Definition: metric_type_ext.h:115