The Gaudi Framework  v33r0 (d5ea422b)
AlgToolHistory.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/AlgToolHistory.cpp
14 //
15 // Contains history information for an AlgTool
16 //
17 //
18 // @author: Charles Leggett
19 //
21 
23 #include "GaudiKernel/AlgTool.h"
24 #include "GaudiKernel/JobHistory.h"
25 
26 #include <iostream>
27 
28 using std::endl;
29 using std::ostream;
30 
32  : m_type( alg.type() )
33  , m_version( "UNKNOWN" )
34  , m_name( alg.name() )
35  , m_tool( &alg )
36  , m_properties( alg.getProperties() )
37  , m_jobHistory( job ) {}
38 
39 //**********************************************************************
40 
41 AlgToolHistory::AlgToolHistory( const std::string& algVersion, const std::string& algName, const std::string& algType,
42  const AlgTool* tool, const PropertyList& props,
43  const JobHistory* job )
44  : m_type( algType )
45  , // FIXME type_info???
46  m_version( algVersion )
47  , m_name( algName )
48  , m_tool( tool )
49  , m_properties( props )
50  , m_jobHistory( job ) {}
51 
52 //**********************************************************************
53 
55 
56  static const CLID CLID_AlgToolHistory = 171959758; // from `clid AlgToolHistory`
57  return CLID_AlgToolHistory;
58 }
59 
60 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
61 
62 void 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 ( const auto& iprop : properties() ) {
75  iprop->fillStream( ost );
76  ost << endl;
77  }
78  ost << "]" << endl;
79 
80  } else {
81 
82  ind += 2;
83  indent( ost, ind );
84  ost << "<COMPONENT name=\"" << algtool_name() << "\" class=\"" << convert_string( algtool_type() )
85  << "\" version=\"" << convert_string( algtool_version() ) << "\" parent=\""
86  << convert_string( algtool_instance()->name() ) << "\">" << endl;
87 
88  for ( const auto& iprop : properties() ) {
89 
90  indent( ost, ind + 2 );
91  ost << "<PROPERTY name=\"" << iprop->name() << "\" value=\"" << convert_string( iprop->toString() )
92  << "\" documentation=\"" << convert_string( iprop->documentation() ) << "\">" << endl;
93  }
94 
95  indent( ost, ind );
96  ost << "</COMPONENT>" << endl;
97  }
98 }
99 
100 //**********************************************************************
101 
102 ostream& operator<<( ostream& lhs, const AlgToolHistory& rhs ) {
103 
104  rhs.dump( lhs, false );
105 
106  return lhs;
107 }
const PropertyList & properties() const override
const std::string & algtool_name() const
const std::string & algtool_version() const
const std::string & name() const override
T endl(T... args)
JobHistory class definition.
Definition: JobHistory.h:32
const AlgTool * algtool_instance() const
STL class.
const std::string & algtool_type() const
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
static const CLID & classID()
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:56
AlgToolHistory class definition.
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:30
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:57
void dump(std::ostream &, const bool isXML=false, int indent=0) const override
AlgToolHistory(const AlgTool &alg, const JobHistory *job)
ostream & operator<<(ostream &lhs, const AlgToolHistory &rhs)
STL class.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68