ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
IdDict
src
IdDictFieldImplementation.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
10
11
#include "
IdDict/IdDictFieldImplementation.h
"
12
#include "GaudiKernel/MsgStream.h"
13
#include <iostream>
14
#include <format>
15
#include <string>
16
#include <string_view>
17
18
19
const
IdDictRange
*
20
IdDictFieldImplementation::range
()
const
{
return
(
m_range
);}
21
22
void
23
IdDictFieldImplementation::set_range
(
const
IdDictRange
*
range
) {
24
m_range
=
range
;
25
}
26
27
void
28
IdDictFieldImplementation::show
()
const
{
29
std::cout <<
show_to_string
() << std::endl;
30
}
31
32
std::string
IdDictFieldImplementation::show_to_string
()
const
{
33
// Build the indexes list once
34
const
auto
& idx =
m_ored_field
.get_indexes();
35
std::string indexes;
36
indexes.reserve(idx.size() * 3);
37
for
(std::size_t i = 0; i < idx.size(); ++i) {
38
if
(i) indexes.push_back(
' '
);
39
indexes += std::to_string(idx[i]);
40
}
41
// Mode string
42
std::string_view mode =
43
m_ored_field
.isBounded() ?
"both_bounded"
44
:
m_ored_field
.isEnumerated() ?
"enumerated"
45
:
"unknown"
;
46
try
{
47
return
std::format(
48
"decode {:d} vals {:<15} "
49
"mask/zero mask/shift/bits/offset {:<3x} {:<3x} {:<3} {:<3} {:<3} "
50
"indexes {:<20} mode {} "
,
51
m_decode_index
,
52
static_cast<
std::string
>
(
m_ored_field
),
53
m_mask
,
54
m_zeroing_mask
,
55
m_shift
,
56
m_bits
,
57
m_bits_offset
,
58
indexes,
59
mode);
60
}
catch
(std::format_error & ){
61
return
{};
62
}
63
}
64
66
std::ostream &
operator<<
(std::ostream & os,
const
IdDictFieldImplementation
&idfi){
67
os<<idfi.
show_to_string
();
68
return
os;
69
}
70
72
MsgStream &
operator<<
(MsgStream & ms,
const
IdDictFieldImplementation
&idfi){
73
ms<<idfi.
show_to_string
();
74
return
ms;
75
}
76
77
operator<<
std::ostream & operator<<(std::ostream &os, const IdDictFieldImplementation &idfi)
stream insertion operator uses show_to_string
Definition
IdDictFieldImplementation.cxx:66
IdDictFieldImplementation.h
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition
IdDictFieldImplementation.h:59
IdDictFieldImplementation::m_bits
size_type m_bits
Definition
IdDictFieldImplementation.h:113
IdDictFieldImplementation::range
const IdDictRange * range() const
Accessors.
Definition
IdDictFieldImplementation.cxx:20
IdDictFieldImplementation::m_decode_index
bool m_decode_index
Definition
IdDictFieldImplementation.h:118
IdDictFieldImplementation::set_range
void set_range(const IdDictRange *range)
Modifiers.
Definition
IdDictFieldImplementation.cxx:23
IdDictFieldImplementation::m_bits_offset
size_type m_bits_offset
Definition
IdDictFieldImplementation.h:114
IdDictFieldImplementation::m_zeroing_mask
value_type m_zeroing_mask
Definition
IdDictFieldImplementation.h:116
IdDictFieldImplementation::m_ored_field
Range::field m_ored_field
Definition
IdDictFieldImplementation.h:112
IdDictFieldImplementation::show_to_string
std::string show_to_string(void) const
Definition
IdDictFieldImplementation.cxx:32
IdDictFieldImplementation::m_range
const IdDictRange * m_range
Definition
IdDictFieldImplementation.h:110
IdDictFieldImplementation::m_shift
size_type m_shift
Definition
IdDictFieldImplementation.h:117
IdDictFieldImplementation::show
void show(void) const
Definition
IdDictFieldImplementation.cxx:28
IdDictFieldImplementation::m_mask
size_type m_mask
Definition
IdDictFieldImplementation.h:115
IdDictRange
Definition
IdDictRange.h:19
Generated on
for ATLAS Offline Software by
1.17.0