7#include "GaudiKernel/ServiceHandle.h"
13#include "GaudiKernel/IMessageSvc.h"
14#include "GaudiKernel/MsgStream.h"
44 catch (
const GaudiException& Exception) {
45 throw std::runtime_error(
46 "AthenaBarCodeImpl::Can not Set Counter Bit, Counter Overflow");
55 catch (
const GaudiException& Exception) {
56 throw std::runtime_error(
57 "AthenaBarCodeImpl::Can not initialize Reserve Bit");
66 catch (
const GaudiException& Exception) {
67 throw std::runtime_error(
68 "AthenaBarCodeImpl::Can not initialize Version Bit");
75 catch (
const GaudiException& Exception) {
76 throw std::runtime_error(
"AthenaBarCodeImpl::Can not set UUID Hash Bits");
103 if (
this != &other) {
150 catch (
const GaudiException& Exception) {
151 throw std::runtime_error(
152 "AthenaBarCodeImpl::newVersion()::Version Overflow");
166 catch (
const GaudiException& Exception) {
167 throw std::runtime_error(
"AthenaBarCodeImpl::newVersion()::Version Too big");
176 out <<
"\n[AthenaBarCode]= " << std::hex << (
m_barcode) << std::dec << std::endl;
191 const int maxdigs = 16;
194 for (
int i = 0; i < maxdigs; i++) {
232 catch (
const GaudiException& Exception) {
233 throw std::runtime_error(
234 "AthenaBarCodeImpl::newVersion()::Version Overflow");
268 if ((
id) >= ((~tmp2) >> (
TotalBits - nbits))) {
272 MsgStream
msg(msgsvc,
"AthenaBarCodeImpl");
273 msg << MSG::WARNING <<
"setBits::bit to be set:" <<
id
274 <<
" is larger than limit:" << ((~tmp2) >> (
TotalBits - nbits))
278 std::cout <<
"setBits::bit to be set:" <<
id <<
" is larger than limit:"
279 << ((~tmp2) >> (
TotalBits - nbits)) << std::endl;
281 throw std::runtime_error(
"AthenaBarCodeImpl::setBit Failed");
285 tmp = (
id << (
TotalBits - nbits - startbit));
288 tmp2 = (tmp2 << (
TotalBits - nbits - startbit));
325 const char* env_uuid = getenv (
"_ATHENABARCODEIMPL_JOBUUID");
333 StatusCode
sc = p_jobidsvc.retrieve();
334 if (!
sc.isSuccess() || 0 == p_jobidsvc) {
338 uuid_generate(JobID);
345 PJobID_t pjobid = p_jobidsvc->getJobID();
uint64_t AthenaBarCode_t
barcode for all INav4Mom classes
AthenaBarCode_t AthenaBarCodeVersion_t
const unsigned char * PJobID_t
static const unsigned short ReserveBits
void setBits(unsigned short startbit, unsigned short nbits, AthenaBarCode_t id, AthenaBarCode_t &bc) const
static AthenaBarCode_t makeDefaultHash(const char *jobid)
static const unsigned short SUUIDBits
void setReserveBits(AthenaBarCode_t id)
AthenaBarCode_t hasUUIDHash() const
AthenaBarCode_t getUUIDHash() const
static const unsigned short UUIDBits
static void setDefaultHash(const char *jobid)
AthenaBarCode_t getBits(unsigned short startbit, unsigned short nbits) const
std::atomic< AthenaBarCode_t > m_barcode
static const unsigned short CounterBits
static const unsigned short SCounterBits
static AthenaBarCode_t getDefaultHash(const char *jobid=nullptr)
bool hasSameAthenaBarCodeExceptVersion(const IAthenaBarCode &obj) const
AthenaBarCodeVersion_t getVersion() const
void setAthenaBarCode(AthenaBarCode_t id)
static const unsigned short SVersionBits
bool createdInCurrentJob() const
AthenaBarCode_t getAthenaBarCode() const
std::ostream & dump(std::ostream &out) const
void setVersion(AthenaBarCodeVersion_t newversion)
static const unsigned short VersionBits
static const unsigned short TotalBits
AthenaBarCodeImpl & operator=(const AthenaBarCodeImpl &)
static const unsigned short SReserveBits
static AthenaBarCode_t hashUUID(const char *)
AthenaBarCode_t getReserveBits() const
static std::atomic< AthenaBarCode_t > m_barcodeCounter
bool hasSameAthenaBarCode(const IAthenaBarCode &obj) const
static const AthenaBarCode_t UNDEFINEDBARCODE
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)