Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
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 
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 
56  for ( auto& i : m_subalgorithm_histories ) delete i;
57 }
58 
59 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
60 
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 
107  rhs.dump( lhs, false );
108  return lhs;
109 }
110 
111 //**********************************************************************
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:309
AlgorithmHistory(const Gaudi::Algorithm &alg, const JobHistory *job)
AlgorithmHistory class definition.
Note: OS specific details for environment resolution.
Definition: Debugger.h:19
T endl(T...args)
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
std::string m_algorithm_type
std::string m_algorithm_version
const PropertyList & properties() const override
JobHistory class definition.
Definition: JobHistory.h:22
HistoryList m_subalgorithm_histories
STL class.
const std::string & algorithm_name() const
PropertyList m_properties
void dump(std::ostream &, const bool isXML=false, int indent=0) const override
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:46
std::string m_algorithm_name
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
friend std::ostream & operator<<(std::ostream &s, const DataObject &obj)
Output operator (ASCII)
Definition: DataObject.h:87
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:20
const std::string & algorithm_version() const
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
const std::string & algorithm_type() const
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:137
virtual ~AlgorithmHistory()
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
STL class.
const Gaudi::Algorithm * m_algorithm
const JobHistory * m_jobHistory