ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigDataAccess
TrigSerializeCnvSvc
src
TrigSerializeGuidHelper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigSerializeGuidHelper.h
"
6
7
#include "
PersistentDataModel/Guid.h
"
8
#include "
DataModelRoot/RootType.h
"
9
#include "
StorageSvc/DbReflex.h
"
10
11
12
TrigSerializeGuidHelper::TrigSerializeGuidHelper
(
const
std::string& name,
const
std::string&
type
,
13
const
IInterface* parent) :
14
AthAlgTool
(name,
type
, parent)
15
{
16
declareInterface<ITrigSerializeGuidHelper>(
this
);
17
18
}
19
20
TrigSerializeGuidHelper::~TrigSerializeGuidHelper
(){
21
22
}
23
24
namespace
TrigSerializeResult
{
25
std::string
remapToDictName
(
const
std::string &s);
26
}
27
28
StatusCode
TrigSerializeGuidHelper::ClassNameToInts
(
const
std::string &clname, uint32_t *iarr){
29
iarr[0] = iarr[1] = iarr[2] = iarr[3] = 0;
30
31
std::string cl =
TrigSerializeResult::remapToDictName
(clname);
32
33
RootType
t =
RootType::ByNameNoQuiet
(cl);
34
RootPropertyList
pl = t.Properties();
35
if
(pl.
HasProperty
(
"ClassID"
)){
36
std::string gecko = pl.
PropertyAsString
(
"ClassID"
);
37
ATH_MSG_DEBUG
( clname <<
" to ROOT known as "
<< cl <<
" has "
<<
"ClassID="
<< gecko );
38
39
const
Guid
guid(gecko );
40
iarr[0] = guid.data1();
41
iarr[1] = guid.data2() << 16 | guid.data3();
42
iarr[2] = guid.data4(0) << 24 | guid.data4(1) << 16 | guid.data4(2) << 8 | guid.data4(3);
43
iarr[3] = guid.data4(4) << 24 | guid.data4(5) << 16 | guid.data4(6) << 8 | guid.data4(7);
44
}
45
else
{
46
ATH_MSG_WARNING
(
"property list has no ClassID for class name "
<< clname <<
" aka ("
<< cl <<
")"
);
47
return
StatusCode::FAILURE;
48
}
49
50
return
StatusCode::SUCCESS;
51
}
52
53
StatusCode
TrigSerializeGuidHelper::IntsToClassName
(
const
uint32_t *iarr, std::string &clname) {
54
55
Guid
guid;
56
guid.setData1(iarr[0]);
57
guid.setData2(iarr[1] >> 16);
58
guid.setData3(iarr[1] & 0xFFFF);
59
guid.setData4(iarr[2] >> 24, 0);
60
guid.setData4(iarr[2] >> 16, 1);
61
guid.setData4(iarr[2] >> 8, 2);
62
guid.setData4(iarr[2] & 0xFF, 3);
63
guid.setData4(iarr[3] >> 24, 4);
64
guid.setData4(iarr[3] >> 16, 5);
65
guid.setData4(iarr[3] >> 8, 6);
66
guid.setData4(iarr[3] & 0xFF, 7);
67
68
ATH_MSG_DEBUG
(
"constructed "
<< guid.toString() <<
" from ints"
);
69
70
if
( clname !=
""
) {
71
// Instead of getting a typename for a known guid (quite costly in ROOT6)
72
// and comparing names,
73
// get a class by name and compare guids
74
Guid
g(
pool::DbReflex::guid
(
RootType
(clname) ) );
75
if
( g != guid ) {
76
// the typename was wrong, will need to look it up by GUID
77
clname =
""
;
78
}
79
}
80
81
if
( clname ==
""
) {
82
RootType
cltype(
pool::DbReflex::forGuid
(guid) );
83
clname = cltype.
Name
(
Reflex::SCOPED
);
84
}
85
86
ATH_MSG_DEBUG
(
"corresponds to "
<< clname );
87
88
if
(clname.empty()){
89
return
StatusCode::FAILURE;
90
}
91
92
return
StatusCode::SUCCESS;
93
}
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DbReflex.h
Guid.h
This file contains the class definition for the Guid class (migrated from POOL).
RootType.h
RootPropertyList
TPropertyListAdapter RootPropertyList
Definition
RootType.h:209
RootType
TTypeAdapter RootType
Definition
RootType.h:211
TrigSerializeGuidHelper.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition
Guid.h:25
TPropertyListAdapter::PropertyAsString
std::string PropertyAsString(const std::string &key) const
Definition
RootType.cxx:83
TPropertyListAdapter::HasProperty
Bool_t HasProperty(const std::string &key) const
Definition
RootType.cxx:74
TScopeAdapter::ByNameNoQuiet
static TScopeAdapter ByNameNoQuiet(const std::string &name, Bool_t load=kTRUE)
Definition
RootType.cxx:586
TScopeAdapter::Name
std::string Name(unsigned int mod=Reflex::SCOPED) const
Definition
RootType.cxx:612
TrigSerializeGuidHelper::IntsToClassName
StatusCode IntsToClassName(const uint32_t *iarr, std::string &clname)
Definition
TrigSerializeGuidHelper.cxx:53
TrigSerializeGuidHelper::TrigSerializeGuidHelper
TrigSerializeGuidHelper(const std::string &name, const std::string &type, const IInterface *parent)
Definition
TrigSerializeGuidHelper.cxx:12
TrigSerializeGuidHelper::ClassNameToInts
StatusCode ClassNameToInts(const std::string &clname, uint32_t *iarr)
Definition
TrigSerializeGuidHelper.cxx:28
TrigSerializeGuidHelper::~TrigSerializeGuidHelper
virtual ~TrigSerializeGuidHelper()
Definition
TrigSerializeGuidHelper.cxx:20
pool::DbReflex::forGuid
static const TypeH forGuid(const Guid &info)
Access classes by Guid.
pool::DbReflex::guid
static Guid guid(const TypeH &id)
Determine Guid (normalized string form) from reflection type.
Reflex::SCOPED
@ SCOPED
Definition
RootType.h:27
TrigSerializeResult
Definition
TrigSerializeGuidHelper.cxx:24
TrigSerializeResult::remapToDictName
std::string remapToDictName(const std::string &s)
Definition
SerializeCommon.cxx:31
type
Generated on
for ATLAS Offline Software by
1.17.0