-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSxHeader.h
74 lines (48 loc) · 1.93 KB
/
NSxHeader.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* NSxHeader: This class stores/represents the NSx Basic Header
from Ripple's Trellis/NEV data format. It stores information about
the entire recording (sampling rate, time zero for the timestamps, etc).
The entire spec is on page 8 of NEVspec_2_2.pdf, available in /opt/Trellis
See also: NSxChannel.h, which represents individual channels.
*/
#ifndef __NSxHeader__
#define __NSxHeader__
#include <fstream>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <stdexcept>
#include <cstdint>
#include "systemtime.h"
class NSxHeader {
public:
NSxHeader() {}
NSxHeader(std::ifstream& file);
friend std::ostream& operator<<(std::ostream& out, const NSxHeader& h);
double getSamplingFreq() const;
double getVersion() const;
std::uint32_t getChannelCount() const { return channelCount;}
std::uint32_t getOffset() const { return offset;}
std::uint32_t getSamplingPeriod() const { return samplingPeriod;}
std::uint32_t getTimeResolution() const { return timeResolution ;}
std::uint8_t getMajorVersion() const { return majorVersion; }
std::uint8_t getMinorVersion() const { return minorVersion; }
std::string getLabel() const { return std::string(label); }
std::string getComment() const { return std::string(comment); }
SystemTime getStartTime() const { return time; }
private:
// Version numbers
std::uint8_t majorVersion;
std::uint8_t minorVersion;
// User data showing the type of data acquired in this file (label)
// and some free-form comments. I *think* these are required to be null-terminated
char label[16];
char comment[256];
// Time data acquisition started. Other timestamps are relative to this
SystemTime time;
std::uint32_t samplingPeriod;
std::uint32_t timeResolution;
std::uint32_t channelCount;
std::uint32_t offset;
};
#endif /* defined(__NSxHeader__) */