The Gaudi Framework  v33r0 (d5ea422b)
PrintAlgsSequences.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
12 #include "GaudiKernel/IAlgorithm.h"
14 #include "GaudiKernel/IProperty.h"
15 #include "GaudiKernel/MsgStream.h"
16 #include "GaudiKernel/Property.h"
17 
18 namespace {
20  void printAlgsSequences( SmartIF<IAlgManager>& algmgr, const std::string& algname, MsgStream& log, int indent ) {
22  log << MSG::ALWAYS;
23  for ( int i = 0; i < indent; ++i ) log << " ";
24  log << algname << endmsg;
25  auto prop = algmgr->algorithm<IProperty>( algname, false );
26  if ( prop ) {
27  // Try to get the property Members
28  Gaudi::Property<std::vector<std::string>> p( "Members", {} );
29  if ( prop->getProperty( &p ).isSuccess() ) {
30  for ( auto& subalgname : p.value() ) { printAlgsSequences( algmgr, subalgname, log, indent + 1 ); }
31  }
32  } else {
33  log << MSG::WARNING << "Cannot get properties of " << algname << endmsg;
34  }
35  }
37  void printAlgsSequences( IInterface* app ) {
38  auto prop = SmartIF<IProperty>( app );
39  auto algmgr = SmartIF<IAlgManager>( app );
40  auto msgsvc = SmartIF<IMessageSvc>( app );
41  if ( !prop || !algmgr ) return;
42  Gaudi::Property<std::vector<std::string>> topalg( "TopAlg", {} );
43  if ( prop->getProperty( &topalg ).isSuccess() ) {
44  MsgStream log( msgsvc, "ApplicationMgr" );
45  log << MSG::ALWAYS << "****************************** Algorithm Sequence ****************************" << endmsg;
46  for ( auto& algname : topalg.value() ) { printAlgsSequences( algmgr, algname, log, 0 ); }
47  log << MSG::ALWAYS << "******************************************************************************" << endmsg;
48  }
49  }
50 } // namespace
51 
52 #ifdef GAUDI_HASCLASSVISIBILITY
53 # pragma GCC visibility push( default )
54 #endif
55 extern "C" {
57 void py_helper_printAlgsSequences( IInterface* app ) { printAlgsSequences( app ); }
58 }
59 #ifdef GAUDI_HASCLASSVISIBILITY
60 # pragma GCC visibility pop
61 #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:34
Implementation of property with value of concrete type.
Definition: Property.h:370
STL class.
Helper class to parse a string of format "type/name".
void py_helper_printAlgsSequences(IInterface *app)
Helper to call printAlgsSequences from Pyhton ctypes.
Definition of the basic interface.
Definition: IInterface.h:254
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition: IProperty.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202