ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
10
11
12TrigSerializeGuidHelper::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
23
25 std::string remapToDictName(const std::string &s);
26}
27
28StatusCode 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
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
53StatusCode 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}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This file contains the class definition for the Guid class (migrated from POOL).
TPropertyListAdapter RootPropertyList
Definition RootType.h:209
TTypeAdapter RootType
Definition RootType.h:211
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition Guid.h:25
std::string PropertyAsString(const std::string &key) const
Definition RootType.cxx:83
Bool_t HasProperty(const std::string &key) const
Definition RootType.cxx:74
static TScopeAdapter ByNameNoQuiet(const std::string &name, Bool_t load=kTRUE)
Definition RootType.cxx:586
std::string Name(unsigned int mod=Reflex::SCOPED) const
Definition RootType.cxx:612
StatusCode IntsToClassName(const uint32_t *iarr, std::string &clname)
TrigSerializeGuidHelper(const std::string &name, const std::string &type, const IInterface *parent)
StatusCode ClassNameToInts(const std::string &clname, uint32_t *iarr)
static const TypeH forGuid(const Guid &info)
Access classes by Guid.
static Guid guid(const TypeH &id)
Determine Guid (normalized string form) from reflection type.
@ SCOPED
Definition RootType.h:27
std::string remapToDictName(const std::string &s)