The Gaudi Framework  v33r1 (b1225454)
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( std::string algVersion, std::string algName, std::string algType, const AlgTool* tool,
42  const PropertyList& props,
43  const JobHistory* job )
44  : m_type( std::move( algType ) ) // FIXME type_info???
45  , m_version( std::move( algVersion ) )
46  , m_name( std::move( algName ) )
47  , m_tool( tool )
48  , m_properties( props )
49  , m_jobHistory( job ) {}
50 
51 //**********************************************************************
52 
54 
55  static const CLID CLID_AlgToolHistory = 171959758; // from `clid AlgToolHistory`
56  return CLID_AlgToolHistory;
57 }
58 
59 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
60 
61 std::ostream& AlgToolHistory::dump( std::ostream& ost, const bool isXML, int ind ) const {
62 
63  if ( !isXML ) {
64 
65  ost << "Name: " << algtool_name() << endl;
66  ost << "Type: " << algtool_type() << endl;
67  ost << "Version: " << algtool_version() << endl;
68  ost << "Parent: " << algtool_instance()->name() << endl;
69 
70  // Properties
71  ost << "Properties: [" << endl;
72 
73  for ( const auto& iprop : properties() ) {
74  iprop->fillStream( ost );
75  ost << endl;
76  }
77  ost << "]" << endl;
78 
79  } else {
80 
81  ind += 2;
82  indent( ost, ind );
83  ost << "<COMPONENT name=\"" << algtool_name() << "\" class=\"" << convert_string( algtool_type() )
84  << "\" version=\"" << convert_string( algtool_version() ) << "\" parent=\""
85  << convert_string( algtool_instance()->name() ) << "\">" << endl;
86 
87  for ( const auto& iprop : properties() ) {
88 
89  indent( ost, ind + 2 );
90  ost << "<PROPERTY name=\"" << iprop->name() << "\" value=\"" << convert_string( iprop->toString() )
91  << "\" documentation=\"" << convert_string( iprop->documentation() ) << "\">" << endl;
92  }
93 
94  indent( ost, ind );
95  ost << "</COMPONENT>" << endl;
96  }
97  return ost;
98 }
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)
STL namespace.
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
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
AlgToolHistory(const AlgTool &alg, const JobHistory *job)
std::ostream & dump(std::ostream &, bool isXML, int indent) const override
STL class.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68