ATLAS Offline Software
PyClassIDSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PYANALYSISCORE_PYCLASSIDSVC_H
6 #define PYANALYSISCORE_PYCLASSIDSVC_H
7 
14 #include "GaudiKernel/IClassIDSvc.h"
15 #include "GaudiKernel/Bootstrap.h"
16 #include "GaudiKernel/ISvcLocator.h"
17 #include "GaudiKernel/MsgStream.h"
19 
21 {
23  static std::string getTypeNameOfID (const unsigned int id)
24  {
25  IClassIDSvc *pSvc = 0;
26  Gaudi::svcLocator()->service("ClassIDSvc", pSvc).ignore();
27  if (!pSvc)
28  {
29  MsgStream log(Athena::getMessageSvc(), "PyClassIDSvc");
30  log << MSG::ERROR << "could not get ClassIDSvc" << endmsg;
31  return "";
32  }
33 
34  std::string name;
35  StatusCode sc = pSvc->getTypeNameOfID (id, name);
36  if (sc.isFailure())
37  {
38  MsgStream log(Athena::getMessageSvc(), "PyClassIDSvc");
39  log << MSG::ERROR << "could not get TypeName for " << id << endmsg;
40  }
41  return name;
42  }
43 };
44 
45 #endif
46 
47 
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
PyClassIDSvc::getTypeNameOfID
static std::string getTypeNameOfID(const unsigned int id)
get type name associated with clID (if any)
Definition: PyClassIDSvc.h:23
PyClassIDSvc
A wrapper for ClassIDSvc.
Definition: PyClassIDSvc.h:21
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20