ATLAS Offline Software
Loading...
Searching...
No Matches
Trailer.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// this header file
8
9// gaudi includes
10#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/ISvcLocator.h"
12#include "GaudiKernel/IMessageSvc.h"
13#include "GaudiKernel/MsgStream.h"
14
15// STL includes
16#include <sstream>
17#include <iomanip>
18
19// Local include(s):
21
22namespace ROIB {
23
24 Trailer::Trailer( const uint32_t i1, const uint32_t i2 ) {
25
26 m_trailer.push_back( i2 ); // status element: error
27 m_trailer.push_back( 0 ); // status element: info
28 m_trailer.push_back( 2 ); // number of status words
29 m_trailer.push_back( i1 ); // number of data words
30 m_trailer.push_back( 1 ); // status block position
31
32 }
33
34 Trailer::Trailer( const uint32_t i ) {
35
36 m_trailer.push_back( 0 ); // status element: error
37 m_trailer.push_back( 0 ); // status element: info
38 m_trailer.push_back( 2 ); // number of status words
39 m_trailer.push_back( i ); // number of data words
40 m_trailer.push_back( 1 ); // status block position
41
42 }
43
44
45 const std::string Trailer::dump() const
46 {
47 std::ostringstream s;
48
49 for (size_t i(0); i < m_trailer.size(); ++i) {
51 }
52
53 return s.str();
54 }
55
56 const std::string Trailer::print(const bool longFormat) const
57 {
58 std::ostringstream s;
59
60 if (longFormat) {
61 s << "Size: " << size() << std::endl;
62 s << std::setw(2) << 0 << "ErrorStatus:" << errorStatus() << std::endl;
63 s << std::setw(2) << 1 << "SatusInfo:" << statusInfo() << std::endl;
64 s << std::setw(2) << 2 << "nStatusWords:" << numStatusWords() << std::endl;
65 s << std::setw(2) << 3 << "nDataWords:" << numDataWords() << std::endl;
66 s << std::setw(2) << 4 << "StatusPosition:" << statusPosition();
67 } else {
68 for (size_t i(0); i < m_trailer.size(); ++i) {
70 }
71 }
72
73 return s.str();
74 }
75
76 void Trailer::dumpData() const
77 {
78 SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service("MessageSvc")};
79 if ( !msgSvc ) {
80 return;
81 }
82 MsgStream log(msgSvc, "ROIB::Header");
83 dumpData(log);
84 }
85
86 void Trailer::dumpData(MsgStream& log) const
87 {
88 log << MSG::DEBUG << "*BEGIN* ROIB::Trailer" << endmsg;
89 log << MSG::DEBUG << "Trailer size : " << size() << endmsg;
90 log << MSG::DEBUG << "Error status : " << errorStatus() << endmsg;
91 log << MSG::DEBUG << "Status info : " << statusInfo() << endmsg;
92 log << MSG::DEBUG << "No data words : " << numDataWords() << endmsg;
93 log << MSG::DEBUG << "*END* ROIB::Trailer" << endmsg;
94 }
95} // namespace ROIB
#define endmsg
uint32_t statusPosition() const
get position of status information in ROD (LVL1 assumes 1)
const std::string dump() const
dump raw object content to string
Definition Trailer.cxx:45
Trailer()
default constructor: empty object
Definition Trailer.h:46
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition Trailer.cxx:56
uint32_t numDataWords() const
get number of data words
int size() const
get trailer/data size (should always return 5)
uint32_t numStatusWords() const
get number of status words in trailer
uint32_t errorStatus() const
get error status word (LVL1 trailer assumes only on word)
uint32_t statusInfo() const
get info status word (LVL1 trailer assumes only on word)
std::vector< uint32_t > m_trailer
vector of unsigned ints - the only data member - hopefully 5
Definition Trailer.h:105
void dumpData() const
print object content to default message stream
Definition Trailer.cxx:76
const std::string convertToHex(const uint32_t word)
helper function to dump a number in hex format
Namespace of the LVL1 RoIB simulation.