Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
dune::CTBFragment Class Reference

#include <CTBFragment.hh>

Public Member Functions

 CTBFragment (artdaq::Fragment const &f)
 
unsigned int NWords () const noexcept
 
const ptb::content::word::word_toperator[] (unsigned int i) const
 
const ptb::content::word::word_tWord (unsigned int i) const
 
const ptb::content::word::feedback_tFeedback (unsigned int i) const
 
const ptb::content::word::ch_status_tChStatus (unsigned int i) const
 
const ptb::content::word::timestamp_tTimestamp (unsigned int i) const
 
const ptb::content::word::trigger_tTrigger (unsigned int i) const
 

Static Public Member Functions

static const ptb::content::word::feedback_tFeedback (const ptb::content::word::word_t &w)
 
static const ptb::content::word::ch_status_tChStatus (const ptb::content::word::word_t &w)
 
static const ptb::content::word::timestamp_tTimestamp (const ptb::content::word::word_t &w)
 
static const ptb::content::word::trigger_tTrigger (const ptb::content::word::word_t &w)
 
static constexpr unsigned int WordSize ()
 

Private Attributes

const unsigned int _n_words
 
artdaq::Fragment const & artdaq_Fragment_
 

Friends

std::ostream & operator<< (std::ostream &, CTBFragment const &)
 

Detailed Description

Definition at line 37 of file CTBFragment.hh.

Constructor & Destructor Documentation

dune::CTBFragment::CTBFragment ( artdaq::Fragment const &  f)

Definition at line 48 of file CTBFragment.cc.

48  :
49 
50  _n_words( f.dataSizeBytes()/CTBFragment::WordSize() ),
52  { ; }
artdaq::Fragment const & artdaq_Fragment_
Definition: CTBFragment.hh:98
const unsigned int _n_words
Definition: CTBFragment.hh:96
static constexpr unsigned int WordSize()
Definition: CTBFragment.hh:86

Member Function Documentation

const ptb::content::word::ch_status_t * dune::CTBFragment::ChStatus ( unsigned int  i) const

Definition at line 79 of file CTBFragment.cc.

79  {
80 
81  const ptb::content::word::word_t* w = Word( i ) ;
82 
83  if ( ! w ) return nullptr ;
84 
85  return CTBFragment::ChStatus( *w ) ;
86 
87  }
const ptb::content::word::ch_status_t * ChStatus(unsigned int i) const
Definition: CTBFragment.cc:79
const ptb::content::word::word_t * Word(unsigned int i) const
Definition: CTBFragment.cc:59
const ptb::content::word::ch_status_t * dune::CTBFragment::ChStatus ( const ptb::content::word::word_t w)
static

Definition at line 123 of file CTBFragment.cc.

123  {
124 
125  if ( w.word_type != ptb::content::word::t_ch ) return nullptr ;
126 
127  return reinterpret_cast<const ptb::content::word::ch_status_t*>( & w ) ;
128 
129  }
const ptb::content::word::feedback_t * dune::CTBFragment::Feedback ( unsigned int  i) const

Definition at line 68 of file CTBFragment.cc.

68  {
69 
70  const ptb::content::word::word_t* w = Word( i ) ;
71 
72  if ( ! w ) return nullptr ;
73 
74  return CTBFragment::Feedback( *w ) ;
75 
76  }
const ptb::content::word::word_t * Word(unsigned int i) const
Definition: CTBFragment.cc:59
const ptb::content::word::feedback_t * Feedback(unsigned int i) const
Definition: CTBFragment.cc:68
const ptb::content::word::feedback_t * dune::CTBFragment::Feedback ( const ptb::content::word::word_t w)
static

Definition at line 115 of file CTBFragment.cc.

115  {
116 
117  if ( w.word_type != ptb::content::word::t_fback ) return nullptr ;
118 
119  return reinterpret_cast<const ptb::content::word::feedback_t*>( & w ) ;
120 
121  }
unsigned int dune::CTBFragment::NWords ( ) const
inlinenoexcept

Definition at line 47 of file CTBFragment.hh.

47 { return _n_words ; }
const unsigned int _n_words
Definition: CTBFragment.hh:96
const ptb::content::word::word_t* dune::CTBFragment::operator[] ( unsigned int  i) const
inline

Definition at line 52 of file CTBFragment.hh.

52 { return Word(i) ; }
const ptb::content::word::word_t * Word(unsigned int i) const
Definition: CTBFragment.cc:59
const ptb::content::word::timestamp_t * dune::CTBFragment::Timestamp ( unsigned int  i) const

Definition at line 90 of file CTBFragment.cc.

90  {
91 
92  const ptb::content::word::word_t* w = Word( i ) ;
93 
94  if ( ! w ) return nullptr ;
95 
96  return CTBFragment::Timestamp( *w ) ;
97 
98  }
const ptb::content::word::word_t * Word(unsigned int i) const
Definition: CTBFragment.cc:59
const ptb::content::word::timestamp_t * Timestamp(unsigned int i) const
Definition: CTBFragment.cc:90
const ptb::content::word::timestamp_t * dune::CTBFragment::Timestamp ( const ptb::content::word::word_t w)
static

Definition at line 131 of file CTBFragment.cc.

131  {
132 
133  if ( w.word_type != ptb::content::word::t_ts ) return nullptr ;
134 
135  return reinterpret_cast<const ptb::content::word::timestamp_t*>( & w ) ;
136 
137  }
const ptb::content::word::trigger_t * dune::CTBFragment::Trigger ( unsigned int  i) const

Definition at line 101 of file CTBFragment.cc.

101  {
102 
103  const ptb::content::word::word_t* w = Word( i ) ;
104 
105  if ( ! w ) return nullptr ;
106 
107  return CTBFragment::Trigger( *w ) ;
108 
109  }
const ptb::content::word::word_t * Word(unsigned int i) const
Definition: CTBFragment.cc:59
const ptb::content::word::trigger_t * Trigger(unsigned int i) const
Definition: CTBFragment.cc:101
const ptb::content::word::trigger_t * dune::CTBFragment::Trigger ( const ptb::content::word::word_t w)
static

Definition at line 139 of file CTBFragment.cc.

139  {
140 
141  if ( w.word_type != ptb::content::word::t_lt && w.word_type != ptb::content::word::t_gt ) return nullptr ;
142 
143  return reinterpret_cast<const ptb::content::word::trigger_t*>( & w ) ;
144 
145  }
const ptb::content::word::word_t * dune::CTBFragment::Word ( unsigned int  i) const

Definition at line 59 of file CTBFragment.cc.

59  {
60 
61  if ( i >= NWords() ) return nullptr ;
62 
63  return reinterpret_cast<const ptb::content::word::word_t*>( artdaq_Fragment_.dataBeginBytes() + i * CTBFragment::WordSize() ) ;
64 
65  }
artdaq::Fragment const & artdaq_Fragment_
Definition: CTBFragment.hh:98
unsigned int NWords() const noexcept
Definition: CTBFragment.hh:47
static constexpr unsigned int WordSize()
Definition: CTBFragment.hh:86
static constexpr unsigned int dune::CTBFragment::WordSize ( )
inlinestatic

Definition at line 86 of file CTBFragment.hh.

86 { return sizeof( ptb::content::word::word_t ) ; }
struct ptb::content::word::word_t word_t

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
CTBFragment const &  f 
)
friend

Definition at line 6 of file CTBFragment.cc.

6  {
7 
8  out << "Fragment size: " << f.artdaq_Fragment_.dataSizeBytes() << " -> " << f._n_words << " words" << std::endl ;
9 
10  for ( unsigned int i = 0; i < f.NWords() ; ++i ) {
11 
12  if ( f.Trigger(i) ) {
13  out << "Trigger word " << std::hex << f.Trigger(i) -> word_type
14  << ", payload: " << f.Trigger(i) -> trigger_word
15  << ", TS: " << f.Trigger(i) -> timestamp << std::dec << std::endl ;
16  }
17  else if ( f.ChStatus(i) ) {
18  out << "Check Status word " << std::hex
19  << " PDS " << f.ChStatus(i) -> get_pds()
20  << ", CRT: " << f.ChStatus(i) -> get_crt()
21  << ", Beam: " << f.ChStatus(i) -> get_beam()
22  << ", TS: " << f.ChStatus(i) -> timestamp
23  << std::dec << std::endl ;
24 
25  }
26  else if ( f.Feedback(i) ) {
27  out << "Feedback word " << std::hex
28  << ", Padding: " << f.Feedback(i) -> padding
29  << ", Source: " << f.Feedback(i) -> source
30  << ", Code: " << f.Feedback(i) -> code
31  << ", TS: " << f.Feedback(i) -> timestamp << std::dec << std::endl ;
32 
33  }
34  else {
35  out << "type: " << std::hex << f.Word(i) -> word_type
36  << ", payload: " << f.Word(i) -> payload
37  << ", TS: " << f.Word(i) -> timestamp << std::dec << std::endl ;
38  }
39 
40  }
41 
42 
43  return out ;
44  }
QTextStream & hex(QTextStream &s)
CodeOutputInterface * code
QTextStream & dec(QTextStream &s)
QTextStream & endl(QTextStream &s)

Member Data Documentation

const unsigned int dune::CTBFragment::_n_words
private

Definition at line 96 of file CTBFragment.hh.

artdaq::Fragment const& dune::CTBFragment::artdaq_Fragment_
private

Definition at line 98 of file CTBFragment.hh.


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