ICP  1
TCPEventStreamDefs.h
Go to the documentation of this file.
1 #ifndef TCP_EVENT_STREAM_DEFS_H
2 #define TCP_EVENT_STREAM_DEFS_H
3 
13 
18 {
19  uint32_t marker1;
20  uint32_t marker2;
21  uint32_t version;
22  uint32_t length;
23  uint32_t type;
24 
26  static const uint32_t marker = 0xffffffff;
30  static const uint32_t major_version = 1;
31  static const uint32_t minor_version = 0;
32  static const uint32_t current_version = (major_version << 16) | minor_version;
33  uint32_t majorVersion() const { return version >> 16; }
34  uint32_t minorVersion() const { return version & 0xffff; }
35 };
36 
39 {
40  enum { StartTime=0x1, RunNumber=0x2, RunState=0x4, InstName=0x8 } ChangedFields;
41  uint32_t length;
42  time_t start_time;
43  int run_number;
44  int run_state;
45  char inst_name[32];
46 
48  bool isValid() const { return length >= sizeof(TCPStreamEventHeaderSetup); }
49  uint32_t changedFields(const TCPStreamEventHeaderSetup& ref) const
50  {
51  uint32_t changed = 0;
52  changed |= ( start_time != ref.start_time ? StartTime : 0 );
53  changed |= ( run_number != ref.run_number ? RunNumber : 0 );
54  changed |= ( run_state != ref.run_state ? RunState : 0 );
55  changed |= ( strcmp(inst_name, ref.inst_name) ? InstName : 0 );
56  return changed;
57  }
58 };
59 
62 {
63  float time_offset;
64 };
65 
68 {
69  uint32_t length;
70  uint32_t frame_number;
71  uint32_t period;
72  float protons;
74  uint32_t nevents;
75 
77  bool isValid() const { return length >= sizeof(TCPStreamEventHeaderNeutron); }
78 };
79 
82 {
84  uint32_t spectrum;
85 };
86 
96 {
99  std::vector<TCPStreamEventNeutron> data;
100 
103  bool isValid() const { return head.isValid() && head_n.isValid() && (head.type == TCPStreamEventHeader::Neutron) && (data.size() == head_n.nevents); }
104 };
105 
108 {
113  bool isValid() const { return head.isValid() && head_setup.isValid() && (head.type == TCPStreamEventHeader::Setup); }
114 };
115 
116 // placeholder fro SE data
118 {
121 };
122 
123 #endif /* TCP_EVENT_STREAM_DEFS_H */
enum TCPStreamEventHeaderSetup::@11 ChangedFields
TCPStreamEventHeader head
details of ISIS frame data was collected in and the number of neutron events in this packet ...
float frame_time_zero
time offset from run_start of this frame, in seconds
char inst_name[32]
instrument name
uint32_t majorVersion() const
header for initial data packet send on initial connection and on a state change e.g. run number changes
TCPStreamEventHeader head
details of ISIS frame data was collected in and the number of neutron events in this packet ...
placeholder for sample environment data
TCPStreamEventHeaderSE head_s
uint32_t nevents
number of TCPStreamEvent() structures in this packet
this structure is part of a sequence of neutron events, which are all from the same ISIS frame ...
uint32_t spectrum
spectrum number neutron count was recorded in
structure describing an individual neutron event following on from a TCPStreamEventHeaderNeutron ...
TCPStreamEventHeaderNeutron head_n
details of ISIS frame data was collected in and the number of neutron events in this packet ...
TCPStreamEventDataNeutron(const TCPStreamEventHeader &head_)
TCPStreamEventHeader(uint32_t type_)
static const uint32_t minor_version
reset to 0 in major version change, then incremented whenever layout of this or further packets chang...
std::vector< TCPStreamEventNeutron > data
list of neutron events
float time_of_flight
neutron time of flight within frame (microseconds)
TCPStreamEventDataSetup(const TCPStreamEventHeader &head_)
time_t start_time
run start time from ISISCRPT_STRUCT
uint32_t version
should be TCPStreamEventHeader::current_version
uint32_t period
period number
int run_number
run number from ISISCRPT_STRUCT
uint32_t length
packet size in bytes
uint32_t length
this packet size in bytes
static const uint32_t major_version
starts at 1, then incremented whenever layout of this or further packets changes in a non backward co...
uint32_t type
StreamDataType
TCPStreamEventHeaderSetup head_setup
layout of initial data packet send on initial connection and on a state change e.g. run number changes
uint32_t minorVersion() const
uint32_t changedFields(const TCPStreamEventHeaderSetup &ref) const
static const uint32_t marker
magic value for marker1, marker2
static const uint32_t current_version
starts at 1, then incremented whenever layout of this or further packets changes
uint32_t length
packet size in bytes
uint32_t marker1
always 0xffffffff
float protons
proton charge (uAh) for this frame
uint32_t marker2
always 0xffffffff
TCPStreamEventHeader head
uint32_t frame_number
ISIS frame number, 0 being first frame of run.