The Gaudi Framework  v33r1 (b1225454)
AlgorithmHistory.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 //
13 // GaudiHistory/AlgorithmHistory.cpp
14 //
15 // Contains history information for an Algorithm
16 //
17 //
18 // @author: Charles Leggett
19 //
21 
23 #include "GaudiKernel/JobHistory.h"
24 #include <Gaudi/Algorithm.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 //**********************************************************************
const std::string & algorithm_version() const
const std::string & algorithm_type() const
static const CLID & classID()
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
AlgorithmHistory(const Gaudi::Algorithm &alg, const JobHistory *job)
Note: OS specific details for environment resolution.
Definition: Debugger.h:29
T endl(T... args)
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
STL namespace.
JobHistory class definition.
Definition: JobHistory.h:32
HistoryList m_subalgorithm_histories
STL class.
const std::string & algorithm_name() const
std::ostream & dump(std::ostream &, bool isXML, int indent) const override
const PropertyList & properties() const override
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:56
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:30
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:89
virtual ~AlgorithmHistory()
STL class.