The Gaudi Framework  master (37c0b60a)
AlgorithmHistory.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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 //
13 // GaudiHistory/AlgorithmHistory.cpp
14 //
15 // Contains history information for an Algorithm
16 //
17 //
18 // @author: Charles Leggett
19 //
21 
22 #include <Gaudi/Algorithm.h>
24 #include <GaudiKernel/JobHistory.h>
25 #include <assert.h>
26 #include <iostream>
27 
28 using std::endl;
29 using std::ostream;
30 using std::type_info;
31 using std::vector;
32 
33 //**********************************************************************
34 // Member functions.
35 //**********************************************************************
36 
37 // Constructor.
38 
40  : m_algorithm_type( System::typeinfoName( typeid( alg ) ) )
41  , m_algorithm_version( alg.version() )
42  , m_algorithm_name( alg.name() )
43  , m_algorithm( &alg )
44  , m_properties( alg.getProperties() )
45  , m_jobHistory( job ) {}
46 
47 //**********************************************************************
48 
50  const PropertyList& props,
51  const HistoryList& subHists )
52  : m_algorithm_type( std::move( algType ) ) // FIXME type_info???
53  , m_algorithm_version( std::move( algVersion ) )
54  , m_algorithm_name( std::move( algName ) )
55  , m_algorithm( nullptr )
56  , m_properties( props )
57  , m_subalgorithm_histories( subHists )
58  , m_jobHistory( nullptr ) {}
59 
60 //**********************************************************************
61 
62 // Destructor.
63 
65  for ( auto& i : m_subalgorithm_histories ) delete i;
66 }
67 
68 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
69 
71 
72  static const CLID CLID_AlgorithmHistory = 56809101; // from `clid AlgorithmHistory`
73  return CLID_AlgorithmHistory;
74 }
75 
76 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
77 
78 std::ostream& AlgorithmHistory::dump( std::ostream& ost, const bool isXML, int ind ) const {
79 
80  if ( !isXML ) {
81  ost << "Type: " << algorithm_type() << endl;
82  ost << "Name: " << algorithm_name() << endl;
83  ost << "Version: " << algorithm_version() << endl;
84  // Properties.
85  ost << "Properties: [" << endl;
86  ;
87  for ( const auto& iprop : properties() ) {
88  iprop->fillStream( ost );
89  ost << endl;
90  }
91  ost << "]" << endl;
92  } else {
93  ind += 2;
94  indent( ost, ind );
95  ost << "<COMPONENT name=\"" << algorithm_name() << "\" class=\"" << convert_string( algorithm_type() )
96  << "\" version=\"" << algorithm_version() << "\">" << std::endl;
97 
98  for ( const auto& iprop : properties() ) {
99  indent( ost, ind + 2 );
100  ost << "<PROPERTY name=\"" << iprop->name() << "\" value=\"" << convert_string( iprop->toString() )
101  << "\" documentation=\"" << convert_string( iprop->documentation() ) << "\">" << std::endl;
102  }
103 
104  indent( ost, ind );
105  ost << "</COMPONENT>" << std::endl;
106  }
107  return ost;
108 }
109 
110 //**********************************************************************
AlgorithmHistory::properties
const PropertyList & properties() const override
Definition: AlgorithmHistory.h:93
std::string
STL class.
AlgorithmHistory::algorithm_name
const std::string & algorithm_name() const
Definition: AlgorithmHistory.h:87
AlgorithmHistory::algorithm_version
const std::string & algorithm_version() const
Definition: AlgorithmHistory.h:84
std::vector< Gaudi::Details::PropertyBase * >
std::type_info
check_ParticleID.props
props
Definition: check_ParticleID.py:21
AlgorithmHistory::dump
std::ostream & dump(std::ostream &, bool isXML, int indent) const override
Definition: AlgorithmHistory.cpp:78
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:315
AlgorithmHistory::classID
static const CLID & classID()
Definition: AlgorithmHistory.cpp:70
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
std::ostream
STL class.
HistoryObj::indent
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:56
conf.version
string version
Definition: conf.py:25
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
GaudiPython.Bindings.nullptr
nullptr
Definition: Bindings.py:87
Algorithm.h
HistoryObj::convert_string
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:30
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
JobHistory.h
AlgorithmHistory::AlgorithmHistory
AlgorithmHistory(const Gaudi::Algorithm &alg, const JobHistory *job)
Definition: AlgorithmHistory.cpp:39
Containers::vector
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
Definition: KeyedObjectManager.h:39
AlgorithmHistory::m_subalgorithm_histories
HistoryList m_subalgorithm_histories
Definition: AlgorithmHistory.h:61
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
std::endl
T endl(T... args)
AlgorithmHistory.h
std
STL namespace.
AlgorithmHistory::~AlgorithmHistory
virtual ~AlgorithmHistory()
Definition: AlgorithmHistory.cpp:64
JobHistory
Definition: JobHistory.h:33
System
Note: OS specific details for environment resolution.
Definition: Debugger.h:29
AlgorithmHistory::algorithm_type
const std::string & algorithm_type() const
Definition: AlgorithmHistory.h:81