Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AlgToolHistory.cpp
Go to the documentation of this file.
1 //
3 // GaudiHistory/AlgToolHistory.cpp
4 //
5 // Contains history information for an AlgTool
6 //
7 //
8 // @author: Charles Leggett
9 //
11 
13 #include "GaudiKernel/AlgTool.h"
14 #include "GaudiKernel/JobHistory.h"
15 
16 #include <iostream>
17 
18 using std::endl;
19 using std::ostream;
20 
22  : m_type( alg.type() )
23  , m_version( "UNKNOWN" )
24  , m_name( alg.name() )
25  , m_tool( &alg )
26  , m_properties( alg.getProperties() )
27  , m_jobHistory( job ) {}
28 
29 //**********************************************************************
30 
31 AlgToolHistory::AlgToolHistory( const std::string& algVersion, const std::string& algName, const std::string& algType,
32  const AlgTool* tool, const PropertyList& props,
33  const JobHistory* job )
34  : m_type( algType )
35  , // FIXME type_info???
36  m_version( algVersion )
37  , m_name( algName )
38  , m_tool( tool )
39  , m_properties( props )
40  , m_jobHistory( job ) {}
41 
42 //**********************************************************************
43 
45 
46  static const CLID CLID_AlgToolHistory = 171959758; // from `clid AlgToolHistory`
47  return CLID_AlgToolHistory;
48 }
49 
50 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
51 
52 void AlgToolHistory::dump( std::ostream& ost, const bool isXML, int ind ) const {
53 
54  if ( !isXML ) {
55 
56  ost << "Name: " << algtool_name() << endl;
57  ost << "Type: " << algtool_type() << endl;
58  ost << "Version: " << algtool_version() << endl;
59  ost << "Parent: " << algtool_instance()->name() << endl;
60 
61  // Properties
62  ost << "Properties: [" << endl;
63 
64  for ( const auto& iprop : properties() ) {
65  iprop->fillStream( ost );
66  ost << endl;
67  }
68  ost << "]" << endl;
69 
70  } else {
71 
72  ind += 2;
73  indent( ost, ind );
74  ost << "<COMPONENT name=\"" << algtool_name() << "\" class=\"" << convert_string( algtool_type() )
75  << "\" version=\"" << convert_string( algtool_version() ) << "\" parent=\""
76  << convert_string( algtool_instance()->name() ) << "\">" << endl;
77 
78  for ( const auto& iprop : properties() ) {
79 
80  indent( ost, ind + 2 );
81  ost << "<PROPERTY name=\"" << iprop->name() << "\" value=\"" << convert_string( iprop->toString() )
82  << "\" documentation=\"" << convert_string( iprop->documentation() ) << "\">" << endl;
83  }
84 
85  indent( ost, ind );
86  ost << "</COMPONENT>" << endl;
87  }
88 }
89 
90 //**********************************************************************
91 
92 ostream& operator<<( ostream& lhs, const AlgToolHistory& rhs ) {
93 
94  rhs.dump( lhs, false );
95 
96  return lhs;
97 }
std::string m_version
const JobHistory * m_jobHistory
std::string m_name
PropertyList m_properties
const AlgTool * algtool_instance() const
T endl(T...args)
JobHistory class definition.
Definition: JobHistory.h:22
std::string m_type
STL class.
const AlgTool * m_tool
const PropertyList & properties() const override
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:46
const std::string & algtool_type() const
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
static const CLID & classID()
AlgToolHistory class definition.
friend std::ostream & operator<<(std::ostream &s, const DataObject &obj)
Output operator (ASCII)
Definition: DataObject.h:87
void dump(std::ostream &, const bool isXML=false, int indent=0) const override
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:58
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:20
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:47
const std::string & name() const override
Properties m_properties
Collection of all declared properties.
Definition: PropertyMgr.h:137
const std::string & algtool_version() const
AlgToolHistory(const AlgTool &alg, const JobHistory *job)
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
STL class.
const std::string & algtool_name() const