All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlgToolHistory.cpp
Go to the documentation of this file.
1 //
3 // $Id: AlgToolHistory.cpp,v 1.1 2006/11/09 10:24:05 mato Exp $
4 //
5 // GaudiHistory/AlgToolHistory.cpp
6 //
7 // Contains history information for an AlgTool
8 //
9 //
10 // @author: Charles Leggett
11 //
13 
15 #include "GaudiKernel/JobHistory.h"
16 #include "GaudiKernel/AlgTool.h"
17 
18 #include <iostream>
19 
20 using std::ostream;
21 using std::endl;
22 
24 :
25  m_type(alg.type()),
26  m_version("UNKNOWN"),
27  m_name(alg.name()),
28  m_tool( &alg ),
29  m_properties(alg.getProperties()),
30  m_jobHistory(job)
31 {
32 }
33 
34 //**********************************************************************
35 
36 AlgToolHistory::AlgToolHistory(const std::string& algVersion,
37  const std::string& algName,
38  const std::string& algType,
39  const AlgTool* tool,
40  const PropertyList& props,
41  const JobHistory* job):
42  m_type(algType), // FIXME type_info???
43  m_version(algVersion),
44  m_name(algName),
45  m_tool(tool),
46  m_properties(props),
47  m_jobHistory(job)
48 {}
49 
50 //**********************************************************************
51 
53 
54  static CLID CLID_AlgToolHistory = 171959758; // from `clid AlgToolHistory`
55  return CLID_AlgToolHistory;
56 
57 }
58 
59 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
60 
61 void
62 AlgToolHistory::dump(std::ostream& ost, const bool isXML, int ind) const {
63 
64  if (!isXML) {
65 
66  ost << "Name: " << algtool_name() << endl;
67  ost << "Type: " << algtool_type() << endl;
68  ost << "Version: " << algtool_version() << endl;
69  ost << "Parent: " << algtool_instance()->name() << endl;
70 
71  //Properties
72  ost << "Properties: [" << endl;
73 
74  for ( AlgToolHistory::PropertyList::const_iterator
75  ipprop=properties().begin();
76  ipprop!=properties().end(); ++ipprop ) {
77  const Property& prop = **ipprop;
78  prop.fillStream(ost);
79  ost << endl;
80  }
81  ost << "]" << endl;
82 
83  } else {
84 
85  ind += 2;
86  indent(ost,ind);
87  ost << "<COMPONENT name=\"" << algtool_name()
88  << "\" class=\"" << convert_string(algtool_type())
89  << "\" version=\"" << convert_string(algtool_version())
90  << "\" parent=\"" << convert_string(algtool_instance()->name())
91  << "\">" << endl;
92 
93  for ( AlgToolHistory::PropertyList::const_iterator
94  ipprop=properties().begin();
95  ipprop!=properties().end(); ++ipprop ) {
96  const Property& prop = **ipprop;
97 
98  indent(ost,ind+2);
99  ost << "<PROPERTY name=\"" << prop.name()
100  << "\" value=\"" << convert_string(prop.toString())
101  << "\" documentation=\"" << convert_string(prop.documentation())
102  << "\">" << endl;
103  }
104 
105  indent(ost,ind);
106  ost << "</COMPONENT>" << endl;
107 
108  }
109 
110 }
111 
112 //**********************************************************************
113 
114 ostream& operator<<(ostream& lhs, const AlgToolHistory& rhs) {
115 
116  rhs.dump(lhs,false);
117 
118  return lhs;
119 }
virtual std::string toString() const =0
value -> string
const std::string & name() const
property name
Definition: Property.h:47
const AlgTool * algtool_instance() const
std::vector< Property * > PropertyList
const std::string & documentation() const
property documentation
Definition: Property.h:49
JobHistory class definition.
Definition: JobHistory.h:25
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:182
const std::string & name() const
string type
Definition: gaudirun.py:126
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:52
const PropertyList & properties() const
const std::string & algtool_type() const
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
static const CLID & classID()
void dump(std::ostream &, const bool isXML=false, int indent=0) const
AlgToolHistory class definition.
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:29
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:34
const std::string & algtool_version() const
AlgToolHistory(const AlgTool &alg, const JobHistory *job)
ostream & operator<<(ostream &lhs, const AlgToolHistory &rhs)
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
const std::string & algtool_name() const