| The Gaudi Framework v32r1 (f65d50dc)

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