-
Notifications
You must be signed in to change notification settings - Fork 1
/
zoom_record.hh
51 lines (43 loc) · 1.62 KB
/
zoom_record.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef DPJ_ZOOM_RECORD_HH_
#define DPJ_ZOOM_RECORD_HH_
#include "record.hh"
#include <iomanip>
////////////////////////////////////////////////////////////////////////////
// zoom_record
//
// common to wig and bed
//
////////////////////////////////////////////////////////////////////////////
namespace bbi {
namespace zoom {
struct record : bbi::record {
static const unsigned byte_size = 32;
uint32_t valid_count;
float min_val;
float max_val;
float sum_data;
float sum_squares;
// void pack(std::ostream& os) const;
record() {}
record(std::streambuf* s) { unpack(*this, s); }
friend void print(record const& r, std::ostream& os) {
print(static_cast<bbi::record const&>(r), os);
os << std::setw(25) << std::left << "valid_count" << r.valid_count << '\n';
os << std::setw(25) << std::left << "min_val" << r.min_val << '\n';
os << std::setw(25) << std::left << "max_val" << r.max_val << '\n';
os << std::setw(25) << std::left << "sum_data" << r.sum_data << '\n';
os << std::setw(25) << std::left << "sum_squares" << r.sum_squares << '\n';
}
friend void unpack(record& r, std::streambuf* s) {
unpack(static_cast<bbi::record&>(r), s);
s->sgetn((char*)&r.valid_count, sizeof r.valid_count);
s->sgetn((char*)&r.min_val, sizeof r.min_val);
s->sgetn((char*)&r.max_val, sizeof r.max_val);
s->sgetn((char*)&r.sum_data, sizeof r.sum_data);
s->sgetn((char*)&r.sum_squares, sizeof r.sum_squares);
}
};
}
template <> struct bbi_type<zoom::record> : std::true_type {};
}
#endif /* DPJ_ZOOM_RECORD_HH_ */