ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
Navigation
Navigation
AthenaBarCodeImpl.h
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#ifndef ATHENABARCODEIMPL_H
8
#define ATHENABARCODEIMPL_H
9
18
// //
20
21
// STL includes
22
23
#include <inttypes.h>
24
25
#include <iosfwd>
26
#include <atomic>
27
28
#include <
AthenaKernel/IAthenaBarCode.h
>
//for static const data memebers
30
//
31
// Universal Object Identifier for all INav4Mom Objects
32
//
34
35
class
StatusCode
;
36
37
class
AthenaBarCodeImpl
{
38
friend
class
AthenaBarCodeCnv_p1
;
39
40
public
:
41
static
const
unsigned
short
TotalBits
= 64;
42
43
static
const
unsigned
short
UUIDBits
= 32;
44
static
const
unsigned
short
CounterBits
= 26;
45
static
const
unsigned
short
VersionBits
= 4;
46
static
const
unsigned
short
ReserveBits
= 2;
47
48
static
const
unsigned
short
SUUIDBits
= 0;
49
static
const
unsigned
short
SCounterBits
=
UUIDBits
;
50
static
const
unsigned
short
SVersionBits
=
UUIDBits
+
CounterBits
;
51
static
const
unsigned
short
SReserveBits
=
UUIDBits
+
CounterBits
+
VersionBits
;
52
53
54
public
:
55
//Constructors
56
57
virtual
~AthenaBarCodeImpl
() =
default
;
58
59
AthenaBarCodeImpl
();
60
AthenaBarCodeImpl
(
const
AthenaBarCodeImpl
&);
61
AthenaBarCodeImpl
&
operator=
(
const
AthenaBarCodeImpl
&);
62
63
public
:
64
//Public setter and getters
65
AthenaBarCode_t
getAthenaBarCode
()
const
;
66
void
setAthenaBarCode
(
AthenaBarCode_t
id
);
67
68
public
:
69
//Comparing & Versioning Control
70
bool
hasSameAthenaBarCode
(
const
IAthenaBarCode
&obj)
const
;
71
bool
hasSameAthenaBarCodeExceptVersion
(
const
IAthenaBarCode
&obj)
const
;
72
73
AthenaBarCodeVersion_t
getVersion
()
const
;
74
void
newVersion
();
75
void
setVersion
(
AthenaBarCodeVersion_t
newversion);
76
77
std::ostream&
dump
(std::ostream& out)
const
;
78
79
//True if the athenabarcode is created in this job, meaning a newly created object. False if the object is read from a file.
80
bool
createdInCurrentJob
()
const
;
81
82
//Handle reserved bits, mainly for read back of older version of AthenaBarCode when the configuration of #bits for UUID,counter and version bits are different from the current one.
83
AthenaBarCode_t
getReserveBits
()
const
;
84
void
setReserveBits
(
AthenaBarCode_t
id
);
85
86
// Used to set the default hash when JobIDSvc is not being used.
87
// Should not be called within Athena.
88
static
void
setDefaultHash
(
const
char
* jobid);
89
90
protected
:
91
void
setBits
(
unsigned
short
startbit,
unsigned
short
nbits,
AthenaBarCode_t
id
,
92
AthenaBarCode_t
& bc)
const
;
93
AthenaBarCode_t
getBits
(
unsigned
short
startbit,
unsigned
short
nbits)
const
;
94
void
initABC
()
const
;
95
96
private
:
97
//UUID related
98
AthenaBarCode_t
combineWithUUIDHash
(
const
AthenaBarCode_t
&)
const
;
99
static
AthenaBarCode_t
hashUUID
(
const
char
*);
100
101
void
setUUIDHash
(
AthenaBarCode_t
uuidhash);
102
AthenaBarCode_t
hasUUIDHash
()
const
;
103
AthenaBarCode_t
getUUIDHash
()
const
;
104
105
static
AthenaBarCode_t
getDefaultHash
(
const
char
* jobid =
nullptr
);
106
static
AthenaBarCode_t
makeDefaultHash
(
const
char
* jobid);
107
108
//data fields
109
static
std::atomic<AthenaBarCode_t>
m_barcodeCounter
;
110
mutable
std::atomic<AthenaBarCode_t>
m_barcode
;
111
112
};
113
114
inline
void
AthenaBarCodeImpl::setUUIDHash
(
AthenaBarCode_t
uuidhash) {
115
m_barcode
=
combineWithUUIDHash
(uuidhash);
116
}
117
118
119
inline
AthenaBarCode_t
AthenaBarCodeImpl::combineWithUUIDHash
(
120
const
AthenaBarCode_t
&hash)
const
{
121
122
AthenaBarCode_t
tmp = 0;
123
AthenaBarCode_t
lowerh = ~tmp >> (
TotalBits
124
-
UUIDBits
);
125
AthenaBarCode_t
higherh = ~tmp << (
UUIDBits
);
126
127
AthenaBarCode_t
lower =
m_barcode
& lowerh;
128
AthenaBarCode_t
higher = hash & higherh;
129
130
/*
131
std::cout << "AthenaBarCodeImpl::combineWithHash::hash=" << std::hex
132
<< hash << " lower=" << lower << " higher=" << higher << " lowerh="
133
<< lowerh << " higherh=" << higherh << " barcode=" << (lower
134
| higher) << std::endl;
135
*/
136
return
lower | higher;
137
138
}
139
140
#endif
// not NAVIGATION_ATHENABARCODE_H
IAthenaBarCode.h
AthenaBarCode_t
uint64_t AthenaBarCode_t
barcode for all INav4Mom classes
Definition
AthenaKernel/AthenaKernel/IAthenaBarCode.h:44
AthenaBarCodeVersion_t
AthenaBarCode_t AthenaBarCodeVersion_t
Definition
AthenaKernel/AthenaKernel/IAthenaBarCode.h:46
AthenaBarCodeImpl::initABC
void initABC() const
Definition
AthenaBarCodeImpl.cxx:24
AthenaBarCodeImpl::ReserveBits
static const unsigned short ReserveBits
Definition
AthenaBarCodeImpl.h:46
AthenaBarCodeImpl::setBits
void setBits(unsigned short startbit, unsigned short nbits, AthenaBarCode_t id, AthenaBarCode_t &bc) const
Definition
AthenaBarCodeImpl.cxx:260
AthenaBarCodeImpl::newVersion
void newVersion()
Definition
AthenaBarCodeImpl.cxx:138
AthenaBarCodeImpl::makeDefaultHash
static AthenaBarCode_t makeDefaultHash(const char *jobid)
Definition
AthenaBarCodeImpl.cxx:312
AthenaBarCodeImpl::SUUIDBits
static const unsigned short SUUIDBits
Definition
AthenaBarCodeImpl.h:48
AthenaBarCodeImpl::setReserveBits
void setReserveBits(AthenaBarCode_t id)
Definition
AthenaBarCodeImpl.cxx:223
AthenaBarCodeImpl::hasUUIDHash
AthenaBarCode_t hasUUIDHash() const
Definition
AthenaBarCodeImpl.cxx:239
AthenaBarCodeImpl::getUUIDHash
AthenaBarCode_t getUUIDHash() const
Definition
AthenaBarCodeImpl.cxx:244
AthenaBarCodeImpl::UUIDBits
static const unsigned short UUIDBits
Definition
AthenaBarCodeImpl.h:43
AthenaBarCodeImpl::~AthenaBarCodeImpl
virtual ~AthenaBarCodeImpl()=default
AthenaBarCodeImpl::setDefaultHash
static void setDefaultHash(const char *jobid)
Definition
AthenaBarCodeImpl.cxx:298
AthenaBarCodeImpl::getBits
AthenaBarCode_t getBits(unsigned short startbit, unsigned short nbits) const
Definition
AthenaBarCodeImpl.cxx:249
AthenaBarCodeImpl::m_barcode
std::atomic< AthenaBarCode_t > m_barcode
Definition
AthenaBarCodeImpl.h:110
AthenaBarCodeImpl::AthenaBarCodeImpl
AthenaBarCodeImpl()
Definition
AthenaBarCodeImpl.cxx:91
AthenaBarCodeImpl::CounterBits
static const unsigned short CounterBits
Definition
AthenaBarCodeImpl.h:44
AthenaBarCodeImpl::SCounterBits
static const unsigned short SCounterBits
Definition
AthenaBarCodeImpl.h:49
AthenaBarCodeImpl::getDefaultHash
static AthenaBarCode_t getDefaultHash(const char *jobid=nullptr)
Definition
AthenaBarCodeImpl.cxx:304
AthenaBarCodeImpl::hasSameAthenaBarCodeExceptVersion
bool hasSameAthenaBarCodeExceptVersion(const IAthenaBarCode &obj) const
Definition
AthenaBarCodeImpl.cxx:120
AthenaBarCodeImpl::getVersion
AthenaBarCodeVersion_t getVersion() const
Definition
AthenaBarCodeImpl.cxx:131
AthenaBarCodeImpl::setAthenaBarCode
void setAthenaBarCode(AthenaBarCode_t id)
Definition
AthenaBarCodeImpl.cxx:211
AthenaBarCodeImpl::SVersionBits
static const unsigned short SVersionBits
Definition
AthenaBarCodeImpl.h:50
AthenaBarCodeImpl::setUUIDHash
void setUUIDHash(AthenaBarCode_t uuidhash)
Definition
AthenaBarCodeImpl.h:114
AthenaBarCodeImpl::createdInCurrentJob
bool createdInCurrentJob() const
Definition
AthenaBarCodeImpl.cxx:181
AthenaBarCodeImpl::getAthenaBarCode
AthenaBarCode_t getAthenaBarCode() const
Definition
AthenaBarCodeImpl.cxx:203
AthenaBarCodeImpl::AthenaBarCodeCnv_p1
friend class AthenaBarCodeCnv_p1
Definition
AthenaBarCodeImpl.h:38
AthenaBarCodeImpl::setVersion
void setVersion(AthenaBarCodeVersion_t newversion)
Definition
AthenaBarCodeImpl.cxx:157
AthenaBarCodeImpl::VersionBits
static const unsigned short VersionBits
Definition
AthenaBarCodeImpl.h:45
AthenaBarCodeImpl::TotalBits
static const unsigned short TotalBits
Definition
AthenaBarCodeImpl.h:41
AthenaBarCodeImpl::operator=
AthenaBarCodeImpl & operator=(const AthenaBarCodeImpl &)
Definition
AthenaBarCodeImpl.cxx:101
AthenaBarCodeImpl::SReserveBits
static const unsigned short SReserveBits
Definition
AthenaBarCodeImpl.h:51
AthenaBarCodeImpl::hashUUID
static AthenaBarCode_t hashUUID(const char *)
Definition
AthenaBarCodeImpl.cxx:190
AthenaBarCodeImpl::getReserveBits
AthenaBarCode_t getReserveBits() const
Definition
AthenaBarCodeImpl.cxx:216
AthenaBarCodeImpl::m_barcodeCounter
static std::atomic< AthenaBarCode_t > m_barcodeCounter
Definition
AthenaBarCodeImpl.h:109
AthenaBarCodeImpl::hasSameAthenaBarCode
bool hasSameAthenaBarCode(const IAthenaBarCode &obj) const
Definition
AthenaBarCodeImpl.cxx:110
AthenaBarCodeImpl::combineWithUUIDHash
AthenaBarCode_t combineWithUUIDHash(const AthenaBarCode_t &) const
Definition
AthenaBarCodeImpl.h:119
IAthenaBarCode
Definition
AthenaKernel/AthenaKernel/IAthenaBarCode.h:48
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
dump
-event-from-file
Generated on
for ATLAS Offline Software by
1.17.0