LDMX Software
packing::RogueFrameHeader Class Reference

the header that the Rogue StreamWriter puts includes at the beginning of each frame. More...

#include <RogueFrameHeader.h>

Public Member Functions

utility::Readerread (utility::Reader &r)
 read the next rogue frame header into memory
 
int channel () const
 get the channel this data was written to
 
unsigned int size () const
 get the size of the frame not including this header
 
uint16_t flags () const
 get the flags included in the header
 
uint8_t error () const
 get specifc error flags included in the header
 
uint8_t trailer () const
 get the trailer byte for checking
 
bool probablyYaml () const
 check if this frame is probably a yaml dump
 

Private Attributes

uint32_t size_
 size of frame written by StreamWriter
 
uint16_t flags_
 extra flags written by StreamWriter
 
uint8_t error_
 error flags written by StreamWriter
 
uint8_t channel_
 StreamWriter channel.
 
uint8_t trailer_
 last byte stored in frame
 

Detailed Description

the header that the Rogue StreamWriter puts includes at the beginning of each frame.

Definition at line 16 of file RogueFrameHeader.h.

Member Function Documentation

◆ channel()

int packing::RogueFrameHeader::channel ( ) const
inline

get the channel this data was written to

Definition at line 21 of file RogueFrameHeader.h.

21{ return channel_; }
uint8_t channel_
StreamWriter channel.

References channel_.

◆ error()

uint8_t packing::RogueFrameHeader::error ( ) const
inline

get specifc error flags included in the header

Definition at line 27 of file RogueFrameHeader.h.

27{ return error_; }
uint8_t error_
error flags written by StreamWriter

References error_.

◆ flags()

uint16_t packing::RogueFrameHeader::flags ( ) const
inline

get the flags included in the header

Definition at line 25 of file RogueFrameHeader.h.

25{ return flags_; }
uint16_t flags_
extra flags written by StreamWriter

References flags_.

◆ probablyYaml()

bool packing::RogueFrameHeader::probablyYaml ( ) const
inline

check if this frame is probably a yaml dump

Definition at line 31 of file RogueFrameHeader.h.

31{ return trailer_ == 0x0a; }
uint8_t trailer_
last byte stored in frame

References trailer_.

◆ read()

utility::Reader & packing::RogueFrameHeader::read ( utility::Reader & r)

read the next rogue frame header into memory

Definition at line 5 of file RogueFrameHeader.cxx.

5 {
6 if (!(r >> size_ >> flags_ >> error_ >> channel_)) {
7 return r;
8 }
9
10 // subtract 4 from size since 4 bytes after
11 // the bytes holding size have been read
12 size_ -= 4;
13
14 int frame_start = r.tell();
15 r.seek(frame_start + size_ - 1);
16 r >> trailer_;
17 // reset back to beginning of frame
18 r.seek(frame_start);
19
20 return r;
21}
uint32_t size_
size of frame written by StreamWriter

References channel_, error_, flags_, packing::utility::Reader::seek(), size_, packing::utility::Reader::tell(), and trailer_.

◆ size()

unsigned int packing::RogueFrameHeader::size ( ) const
inline

get the size of the frame not including this header

Definition at line 23 of file RogueFrameHeader.h.

23{ return size_; }

References size_.

◆ trailer()

uint8_t packing::RogueFrameHeader::trailer ( ) const
inline

get the trailer byte for checking

Definition at line 29 of file RogueFrameHeader.h.

29{ return trailer_; }

References trailer_.

Member Data Documentation

◆ channel_

uint8_t packing::RogueFrameHeader::channel_
private

StreamWriter channel.

Definition at line 48 of file RogueFrameHeader.h.

Referenced by channel(), and read().

◆ error_

uint8_t packing::RogueFrameHeader::error_
private

error flags written by StreamWriter

Definition at line 46 of file RogueFrameHeader.h.

Referenced by error(), and read().

◆ flags_

uint16_t packing::RogueFrameHeader::flags_
private

extra flags written by StreamWriter

Definition at line 44 of file RogueFrameHeader.h.

Referenced by flags(), and read().

◆ size_

uint32_t packing::RogueFrameHeader::size_
private

size of frame written by StreamWriter

The number written on disk is 4 more than the number we store here for later use because the number on disk does not include the other 4 bytes we parse into the other members below.

Definition at line 42 of file RogueFrameHeader.h.

Referenced by read(), and size().

◆ trailer_

uint8_t packing::RogueFrameHeader::trailer_
private

last byte stored in frame

we need to check the trailer byte as well since many of the early runs took data with both the data and yaml-dump of the config stored in the same channel

The yaml-dump has a characteristic trailer byte 0x0a

Definition at line 58 of file RogueFrameHeader.h.

Referenced by probablyYaml(), read(), and trailer().


The documentation for this class was generated from the following files: