PrintAlgsSequences.cpp
Go to the documentation of this file.
1 #include "GaudiKernel/IProperty.h"
2 #include "GaudiKernel/Property.h"
3 #include "GaudiKernel/IAlgManager.h"
4 #include "GaudiKernel/MsgStream.h"
5 #include "GaudiKernel/IMessageSvc.h"
6 #include "GaudiKernel/IAlgorithm.h"
7 
8 namespace {
10  void printAlgsSequences(SmartIF<IAlgManager>& algmgr, const std::string& algname, MsgStream& log, int indent) {
12  log << MSG::ALWAYS;
13  for(int i=0; i < indent; ++i) log << " ";
14  log << algname << endmsg;
15  auto prop = algmgr->algorithm<IProperty>(algname, false);
16  if (prop) {
17  // Try to get the property Members
18  StringArrayProperty p("Members", {});
19  if (prop->getProperty(&p).isSuccess()) {
20  for(auto& subalgname: p.value()) {
21  printAlgsSequences(algmgr, subalgname, log, indent+1);
22  }
23  }
24  } else {
25  log << MSG::WARNING << "Cannot get properties of " << algname << endmsg;
26  }
27  }
29  void printAlgsSequences(IInterface* app) {
30  auto prop = SmartIF<IProperty>(app);
31  auto algmgr = SmartIF<IAlgManager>(app);
32  auto msgsvc = SmartIF<IMessageSvc>(app);
33  if ( ! (prop && algmgr) ) return;
34  StringArrayProperty topalg("TopAlg", {});
35  if (prop->getProperty(&topalg).isSuccess()) {
36  MsgStream log(msgsvc, "ApplicationMgr");
37  log << MSG::ALWAYS << "****************************** Algorithm Sequence ****************************" << endmsg;
38  for(auto& algname: topalg.value()) {
39  printAlgsSequences(algmgr, algname, log, 0);
40  }
41  log << MSG::ALWAYS << "******************************************************************************" << endmsg;
42  }
43  }
44 }
45 
46 #ifdef GAUDI_HASCLASSVISIBILITY
47 #pragma GCC visibility push(default)
48 #endif
49 extern "C" {
52  printAlgsSequences(app);
53  }
54 }
55 #ifdef GAUDI_HASCLASSVISIBILITY
56 #pragma GCC visibility pop
57 #endif
virtual SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
void py_helper_printAlgsSequences(IInterface *app)
Helper to call printAlgsSequences from Pyhton ctypes.
Definition of the basic interface.
Definition: IInterface.h:160
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:22
list i
Definition: ana.py:128