base_metric.h
Go to the documentation of this file.
1 
17 #pragma once
18 
19 #include <cstddef>
21 #include "interop/util/cstdint.h"
23 
24 namespace illumina { namespace interop { namespace io { namespace layout
25 {
26 #pragma pack(1)
27 
36  {
38  typedef ::uint16_t lane_t;
40  typedef ::uint32_t tile_t;
42  typedef ::uint8_t record_size_t;
45 
48  base_run_metric() : m_dummy(0)
49  {
50  }
51 
56  template<class BaseMetric>
57  void set(const BaseMetric &/*metric*/)
58  {
59  m_dummy = 0;
60  }
61 
66  bool is_valid() const
67  {
68  return true;
69  }
70 
71  private:
72  lane_t m_dummy;
73  };
74 
82  template<class T>
83  struct base_metric
84  {
86  typedef ::uint16_t lane_t;
88  typedef T tile_t;
90  typedef ::uint8_t record_size_t;
93 
99  base_metric(const lane_t lane_ = 0, const tile_t tile_ = 0) :
100  lane(lane_), tile(tile_)
101  {
102  static_assert(sizeof(::uint16_t) == 2, "16-bit int not supported");
103  static_assert(sizeof(::uint32_t) == 4, "32-bit int not supported");
104  }
105 
110  template<class BaseMetric>
111  void set(const BaseMetric &metric)
112  {
113  lane = static_cast< lane_t >(metric.lane());
114  tile = static_cast< tile_t >(metric.tile());
115  }
116 
121  bool is_valid() const
122  {
123  return tile > 0 && lane > 0;
124  }
125 
128  lane_t lane;
131  tile_t tile;
132  };
133 
141  template<class T>
143  {
145  typedef typename base_metric<T>::lane_t lane_t;
147  typedef typename base_metric<T>::tile_t tile_t;
149  typedef ::uint16_t cycle_t;
158  base_cycle_metric(const lane_t lane_ = 0, const tile_t tile_ = 0, const cycle_t cycle_ = 0) :
159  base_metric<T>(lane_, tile_), cycle(cycle_)
160  {
161  }
162 
167  template<class BaseMetric>
168  void set(const BaseMetric &metric)
169  {
170  base_metric<T>::set(metric);
171  cycle = static_cast< cycle_t >(metric.cycle());
172  }
173 
178  bool is_valid() const
179  {
180  return base_metric<T>::is_valid() && cycle > 0;
181  }
182 
185  cycle_t cycle;
186  };
187 
195  template<class T>
197  {
199  typedef typename base_metric<T>::lane_t lane_t;
201  typedef typename base_metric<T>::tile_t tile_t;
203  typedef ::uint16_t read_t;
212  base_read_metric(const lane_t lane_ = 0, const tile_t tile_ = 0, const read_t read_ = 0) :
213  base_metric<T>(lane_, tile_), read(read_)
214  {
215  }
216 
221  template<class BaseMetric>
222  void set(const BaseMetric &metric)
223  {
224  base_metric<T>::set(metric);
225  read = static_cast< read_t >(metric.read());
226  }
227 
232  bool is_valid() const
233  {
234  return base_metric<T>::is_valid() && read > 0;
235  }
236 
239  read_t read;
240  };
241 
242 #pragma pack()
243 }}}}
244 
245 
base_run_metric()
Definition: base_metric.h:48
base_metric< T >::tile_t tile_t
Definition: base_metric.h:147
Definition: enum_description.h:15
tile_t tile
Definition: base_metric.h:131
::uint8_t record_size_t
Definition: base_metric.h:42
void set(const BaseMetric &metric)
Definition: base_metric.h:111
void set(const BaseMetric &metric)
Definition: base_metric.h:222
base_metric(const lane_t lane_=0, const tile_t tile_=0)
Definition: base_metric.h:99
T tile_t
Definition: base_metric.h:88
bool is_valid() const
Definition: base_metric.h:66
base_metric< T >::lane_t lane_t
Definition: base_metric.h:145
void set(const BaseMetric &)
Definition: base_metric.h:57
Definition: type_traits.h:131
::uint32_t tile_t
Definition: base_metric.h:40
lane_t lane
Definition: base_metric.h:128
::uint16_t cycle_t
Definition: base_metric.h:149
::uint16_t read_t
Definition: base_metric.h:203
void set(const BaseMetric &metric)
Definition: base_metric.h:168
base_metric< T >::lane_t lane_t
Definition: base_metric.h:199
bool is_valid() const
Definition: base_metric.h:232
cycle_t cycle
Definition: base_metric.h:185
constants::base_cycle_t base_t
Definition: base_metric.h:151
Definition: enums.h:301
bool is_valid() const
Definition: base_metric.h:121
base_read_metric(const lane_t lane_=0, const tile_t tile_=0, const read_t read_=0)
Definition: base_metric.h:212
::uint16_t lane_t
Definition: base_metric.h:38
constants::base_tile_t base_t
Definition: base_metric.h:92
#define static_assert(x, m)
Definition: static_assert.h:23
constants::base_run_t base_t
Definition: base_metric.h:44
bool is_valid() const
Definition: base_metric.h:178
read_t read
Definition: base_metric.h:239
constants::base_read_t base_t
Definition: base_metric.h:205
Definition: base_metric.h:83
::uint8_t record_size_t
Definition: base_metric.h:90
base_metric< T >::tile_t tile_t
Definition: base_metric.h:201
::uint16_t lane_t
Definition: base_metric.h:86
base_cycle_metric(const lane_t lane_=0, const tile_t tile_=0, const cycle_t cycle_=0)
Definition: base_metric.h:158