Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Typedefs | Functions
clb_common_header.hh File Reference
#include <ostream>
#include <stdint.h>
#include <cassert>
#include <cstdlib>
#include <arpa/inet.h>
#include "utctime.hh"

Go to the source code of this file.

Classes

struct  CLBCommonHeader
 

Typedefs

typedef uint64_t frame_idx_t
 

Functions

std::ostream & operator<< (std::ostream &stream, const CLBCommonHeader &header)
 
int32_t seq_number (CLBCommonHeader const &header, uint64_t start_run_ms, int ts_duration_ms)
 
frame_idx_t data2idx (CLBCommonHeader const &header, uint64_t start_run_ms, int ts_duration_ms)
 
uint32_t dom_id (frame_idx_t idx)
 
bool validTimeStamp (CLBCommonHeader const &header)
 
bool isTrailer (CLBCommonHeader const &header)
 

Typedef Documentation

typedef uint64_t frame_idx_t

Definition at line 84 of file clb_common_header.hh.

Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const CLBCommonHeader header 
)
inline

Definition at line 71 of file clb_common_header.hh.

72 {
73  return stream << "DataType: " << header.dataType() << '\n'
74  << "RunNumber: " << header.runNumber() << '\n'
75  << "UDPSequenceNumber: " << header.udpSequenceNumber() << '\n'
76  << "Timestamp: \n" << header.timeStamp() << '\n'
77  << "DOMIdentifier: " << header.domIdentifier() << '\n'
78  << "DOMStatus1: " << header.domStatus(1) << '\n'
79  << "DOMStatus2: " << header.domStatus(2) << '\n'
80  << "DOMStatus3: " << header.domStatus(3) << '\n'
81  << "DOMStatus4: " << header.domStatus(4);
82 }
uint32_t domIdentifier() const
uint32_t runNumber() const
UTCTime timeStamp() const
uint32_t domStatus(int n=1) const
uint32_t udpSequenceNumber() const
uint32_t dataType() const
int32_t seq_number ( CLBCommonHeader const &  header,
uint64_t  start_run_ms,
int  ts_duration_ms 
)
inline

Definition at line 87 of file clb_common_header.hh.

91 {
92  return (header.timeStamp().inMilliSeconds() - start_run_ms) / ts_duration_ms;
93 }
frame_idx_t data2idx ( CLBCommonHeader const &  header,
uint64_t  start_run_ms,
int  ts_duration_ms 
)
inline

Definition at line 96 of file clb_common_header.hh.

100 {
101  frame_idx_t value = seq_number(header, start_run_ms, ts_duration_ms);
102  value <<= 32;
103  value += header.domIdentifier();
104  return value;
105 }
uint64_t frame_idx_t
int32_t seq_number(CLBCommonHeader const &header, uint64_t start_run_ms, int ts_duration_ms)
uint32_t dom_id ( frame_idx_t  idx)
inline

Definition at line 108 of file clb_common_header.hh.

109 {
110  frame_idx_t const mask = 0x00000000FFFFFFFF;
111 
112  return idx & mask;
113 }
uint64_t frame_idx_t
bool validTimeStamp ( CLBCommonHeader const &  header)
inline

Definition at line 116 of file clb_common_header.hh.

117 {
118  const static uint32_t mask = 0x80000000;
119 
120  return header.domStatus() & mask;
121 }
bool isTrailer ( CLBCommonHeader const &  header)
inline

Definition at line 124 of file clb_common_header.hh.

125 {
126  const static uint32_t mask = 0x80000000;
127 
128  return header.domStatus(2) & mask;
129 }