ATLAS Offline Software
Loading...
Searching...
No Matches
TrigMonROBData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5// C/C++
6#include <iostream>
7#include <sstream>
8
11
12namespace ROBbits
13{
14 const uint32_t maskHistory = 0x0000000f;
15 const uint32_t maskStatus = 0x000000f0;
16 const uint32_t maskState = 0x000000ff;
17 const uint32_t maskSize = 0xffffff00;
18 const uint32_t shiftSize = 8;
19}
20
21
22//--------------------------------------------------------------------------------------
28
29//--------------------------------------------------------------------------------------
30TrigMonROBData::TrigMonROBData(uint32_t rob_id, uint32_t rob_size)
31 :m_rob_id(rob_id),
32 m_word(0)
33{
34 if(rob_size >= 16777215) {
35 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonROBData")
36 << "Size out of range";
37 }
38 else {
39 m_word |= (rob_size << ROBbits::shiftSize);
40 }
41}
42
43//--------------------------------------------------------------------------------------
45{
46 //
47 // Set history enum.
48 //
49 m_word = m_word & (~ROBbits::maskHistory);
50 m_word |= hist;
51}
52
53//--------------------------------------------------------------------------------------
55{
56 //
57 // Set status bit
58 //
59 m_word |= kOK;
60}
61
62//--------------------------------------------------------------------------------------
64{
65 //
66 // Set status bit
67 //
69}
70
71//--------------------------------------------------------------------------------------
73{
74 //
75 // Return status bit
76 //
77 return (m_word & kOK);
78}
79
80//--------------------------------------------------------------------------------------
82{
83 //
84 // Return status bit
85 //
86 return (m_word & kPREFETCH);
87}
88
89//--------------------------------------------------------------------------------------
91{
92 //
93 // Get data size
94 //
96}
97
98//--------------------------------------------------------------------------------------
100{
101 //
102 // Return encoded Status and History integer
103 //
104 return (m_word & ROBbits::maskState);
105}
106
107//--------------------------------------------------------------------------------------
109{
110 //
111 // Mask history bits and get history
112 //
114}
115
116//--------------------------------------------------------------------------------------
118{
119 //
120 // Mask status bits and get status
121 //
123}
124
125//--------------------------------------------------------------------------------------
126void TrigMonROBData::print(std::ostream &os) const
127{
128 os << str(*this) << "\n";
129}
130
131//--------------------------------------------------------------------------------------
132std::string str(const TrigMonROBData &o)
133{
134 std::stringstream str;
135 str << "TrigMonROBData: rob id=" << o.getROBId()
136 << " size=" << o.getROBSize();
137
138 return str.str();
139}
140
141//--------------------------------------------------------------------------------------
143{
144 const uint32_t hist = val & ROBbits::maskHistory;
145
146 if(hist == 1) return TrigMonROBData::kRETRIEVED;
147 if(hist == 2) return TrigMonROBData::kCACHED;
148 if(hist == 4) return TrigMonROBData::kIGNORED;
149 if(hist == 8) return TrigMonROBData::kDISABLED;
150
152}
153
154//--------------------------------------------------------------------------------------
156{
157 const uint32_t stat = val & ROBbits::maskStatus;
158
161
163}
164
165//--------------------------------------------------------------------------------------
167{
168 if(hist == TrigMonROBData::kUNCLASSIFIED) return "UNCLASSIFIED";
169 if(hist == TrigMonROBData::kRETRIEVED) return "RETRIEVED";
170 if(hist == TrigMonROBData::kCACHED) return "CACHED";
171 if(hist == TrigMonROBData::kIGNORED) return "IGNORED";
172 if(hist == TrigMonROBData::kDISABLED) return "DISABLED";
173
174 return "UNCLASSIFIED";
175}
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
bool isStatusOk() const
void print(std::ostream &os=std::cout) const
bool isStatusPrefetched() const
uint32_t getROBSize() const
void setHistory(History hist)
Status getStatus() const
uint32_t getEncodedState() const
uint32_t getROBId() const
History getHistory() const
const uint32_t maskState
const uint32_t maskHistory
const uint32_t maskSize
const uint32_t shiftSize
const uint32_t maskStatus
TrigMonROBData::Status getROBStatus(unsigned int val)
TrigMonROBData::History getROBHistory(unsigned int val)
std::string AsStringROBHistory(TrigMonROBData::History hist)