The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
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>
14#include <assert.h>
15#include <iostream>
16
17using std::endl;
18using std::ostream;
19using std::vector;
20
22 : m_algorithm_type( System::typeinfoName( typeid( alg ) ) )
24 , m_algorithm_name( alg.name() )
25 , m_algorithm( &alg )
26 , m_properties( alg.getProperties() )
27 , m_jobHistory( job ) {}
28
29AlgorithmHistory::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
43
45 static const CLID CLID_AlgorithmHistory = 56809101; // from `clid AlgorithmHistory`
46 return CLID_AlgorithmHistory;
47}
48
49std::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}
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
const std::string & algorithm_name() const
std::string m_algorithm_name
const std::string & name() const override
static const CLID & classID()
const JobHistory * m_jobHistory
const std::string & algorithm_version() const
const std::string & version() const override
const PropertyList & properties() const override
std::string m_algorithm_version
std::vector< const AlgorithmHistory * > HistoryList
std::ostream & dump(std::ostream &, bool isXML, int indent) const override
AlgorithmHistory(const Gaudi::Algorithm &alg, const JobHistory *job)
const Gaudi::Algorithm * m_algorithm
const std::string & algorithm_type() const
HistoryList m_subalgorithm_histories
PropertyList m_properties
std::string m_algorithm_type
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:87
virtual void indent(std::ostream &, int) const
static std::string convert_string(const std::string &)
std::vector< Gaudi::Details::PropertyBase * > PropertyList
JobHistory class definition.
Definition JobHistory.h:32
Note: OS specific details for environment resolution.
Definition Environment.h:25
STL namespace.