Loading [MathJax]/jax/input/TeX/config.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AlgorithmHistory.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 \***********************************************************************************/
11 #include <Gaudi/Algorithm.h>
13 #include <GaudiKernel/JobHistory.h>
14 #include <assert.h>
15 #include <iostream>
16 
17 using std::endl;
18 using std::ostream;
19 using std::vector;
20 
22  : m_algorithm_type( System::typeinfoName( typeid( alg ) ) )
23  , m_algorithm_version( alg.version() )
24  , m_algorithm_name( alg.name() )
25  , m_algorithm( &alg )
26  , m_properties( alg.getProperties() )
27  , m_jobHistory( job ) {}
28 
29 AlgorithmHistory::AlgorithmHistory( std::string algVersion, std::string algName, std::string algType,
30  const PropertyList& props,
31  const HistoryList& subHists )
32  : m_algorithm_type( std::move( algType ) ) // FIXME type_info???
33  , m_algorithm_version( std::move( algVersion ) )
34  , m_algorithm_name( std::move( algName ) )
35  , m_algorithm( nullptr )
36  , m_properties( props )
37  , m_subalgorithm_histories( subHists )
38  , m_jobHistory( nullptr ) {}
39 
41  for ( auto& i : m_subalgorithm_histories ) delete i;
42 }
43 
45  static const CLID CLID_AlgorithmHistory = 56809101; // from `clid AlgorithmHistory`
46  return CLID_AlgorithmHistory;
47 }
48 
49 std::ostream& AlgorithmHistory::dump( std::ostream& ost, const bool isXML, int ind ) const {
50 
51  if ( !isXML ) {
52  ost << "Type: " << algorithm_type() << endl;
53  ost << "Name: " << algorithm_name() << endl;
54  ost << "Version: " << algorithm_version() << endl;
55  // Properties.
56  ost << "Properties: [" << endl;
57  ;
58  for ( const auto& iprop : properties() ) {
59  iprop->fillStream( ost );
60  ost << endl;
61  }
62  ost << "]" << endl;
63  } else {
64  ind += 2;
65  indent( ost, ind );
66  ost << "<COMPONENT name=\"" << algorithm_name() << "\" class=\"" << convert_string( algorithm_type() )
67  << "\" version=\"" << algorithm_version() << "\">" << std::endl;
68 
69  for ( const auto& iprop : properties() ) {
70  indent( ost, ind + 2 );
71  ost << "<PROPERTY name=\"" << iprop->name() << "\" value=\"" << convert_string( iprop->toString() )
72  << "\" documentation=\"" << convert_string( iprop->documentation() ) << "\">" << std::endl;
73  }
74 
75  indent( ost, ind );
76  ost << "</COMPONENT>" << std::endl;
77  }
78  return ost;
79 }
AlgorithmHistory::properties
const PropertyList & properties() const override
Definition: AlgorithmHistory.h:92
GaudiPartProp.decorators.std
std
Definition: decorators.py:32
AlgorithmHistory::algorithm_name
const std::string & algorithm_name() const
Definition: AlgorithmHistory.h:86
AlgorithmHistory::algorithm_version
const std::string & algorithm_version() const
Definition: AlgorithmHistory.h:83
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:49
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:260
AlgorithmHistory::classID
static const CLID & classID()
Definition: AlgorithmHistory.cpp:44
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
HistoryObj::indent
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:37
conf.version
string version
Definition: conf.py:25
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:87
IVersHistoryObj::PropertyList
std::vector< Gaudi::Details::PropertyBase * > PropertyList
Definition: IVersHistoryObj.h:29
GaudiPython.Bindings.nullptr
nullptr
Definition: Bindings.py:87
Algorithm.h
HistoryObj::convert_string
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:14
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:16
JobHistory.h
AlgorithmHistory::AlgorithmHistory
AlgorithmHistory(const Gaudi::Algorithm &alg, const JobHistory *job)
Definition: AlgorithmHistory.cpp:21
AlgorithmHistory::HistoryList
std::vector< const AlgorithmHistory * > HistoryList
Definition: AlgorithmHistory.h:41
Containers::vector
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
Definition: KeyedObjectManager.h:31
AlgorithmHistory::m_subalgorithm_histories
HistoryList m_subalgorithm_histories
Definition: AlgorithmHistory.h:60
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
AlgorithmHistory.h
AlgorithmHistory::~AlgorithmHistory
virtual ~AlgorithmHistory()
Definition: AlgorithmHistory.cpp:40
JobHistory
Definition: JobHistory.h:32
System
Note: OS specific details for environment resolution.
Definition: Environment.h:25
AlgorithmHistory::algorithm_type
const std::string & algorithm_type() const
Definition: AlgorithmHistory.h:80