Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ServiceHistory.cpp
Go to the documentation of this file.
1 //
3 // GaudiHistory/ServiceHistory.cpp
4 //
5 // Contains history information for a Service
6 //
7 //
8 // @author: Charles Leggett
9 //
11 
13 #include "GaudiKernel/IService.h"
14 #include "GaudiKernel/JobHistory.h"
15 #include "GaudiKernel/Service.h"
16 #include <iostream>
17 
18 using namespace std;
20 
21 //
23 //
24 
26  : // HistoryObj(),
27  m_pService( nullptr )
28  , m_name( "none" )
29  , m_type( "none" )
30  , m_version( "none" ) {}
31 
32 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
34  : // HistoryObj(),
35  m_pService( isv )
36  , m_jobHistory( job )
37  , m_name( isv->name() )
38  , m_version( "none" ) {
39 
40  const Service* svc = dynamic_cast<const Service*>( isv );
41  m_type = System::typeinfoName( typeid( *svc ) );
42  m_properties = svc->getProperties();
43 }
44 
45 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
46 
48  : // HistoryObj(),
49  m_pService( &isv )
50  , m_jobHistory( job )
51  , m_name( isv.name() )
52  , m_version( "none" ) {
53 
54  const Service* svc = dynamic_cast<const Service*>( &isv );
55  m_type = System::typeinfoName( typeid( *svc ) );
56  m_properties = svc->getProperties();
57 }
58 
59 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
60 
62 
63  static const CLID CLID_ServiceHistory = 187225489; // from `clid ServiceHistory`
64  return CLID_ServiceHistory;
65 }
66 
67 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
68 
69 void ServiceHistory::dump( std::ostream& ost, const bool isXML, int ind ) const {
70 
71  if ( !isXML ) {
72 
73  ost << "Name: " << name() << endl;
74  ost << "Type: " << type() << endl;
75  ost << "Version: " << version() << endl;
76 
77  // Properties
78  ost << "Properties: [" << endl;
79 
80  for ( const auto& ipprop : properties() ) {
81  const PropertyBase& prop = *ipprop;
82  prop.fillStream( ost );
83  ost << endl;
84  }
85  ost << "]" << endl;
86 
87  } else {
88 
89  ind += 2;
90  indent( ost, ind );
91  ost << "<COMPONENT name=\"" << name() << "\" class=\"" << convert_string( type() ) << "\" version=\""
92  << convert_string( version() ) << "\">" << endl;
93 
94  for ( const auto& ipprop : properties() ) {
95  const PropertyBase& prop = *ipprop;
96 
97  indent( ost, ind + 2 );
98  ost << "<PROPERTY name=\"" << prop.name() << "\" value=\"" << convert_string( prop.toString() )
99  << "\" documentation=\"" << convert_string( prop.documentation() ) << "\">" << endl;
100  }
101 
102  indent( ost, ind );
103  ost << "</COMPONENT>" << endl;
104  }
105 }
106 
107 //**********************************************************************
108 // Free functions.
109 //**********************************************************************
110 
111 // Output stream.
112 
113 ostream& operator<<( ostream& lhs, const ServiceHistory& rhs ) {
114 
115  rhs.dump( lhs, false );
116 
117  return lhs;
118 }
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:309
const std::string name() const
property name
Definition: Property.h:36
T endl(T...args)
STL namespace.
std::string m_name
virtual std::string toString() const =0
value -> string
JobHistory class definition.
Definition: JobHistory.h:22
PropertyList m_properties
void dump(std::ostream &, const bool isXML=false, int indent=0) const override
std::string m_type
General service interface definition.
Definition: IService.h:18
const PropertyList & properties() const override
const std::string & name() const override
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:46
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:49
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
const std::string & version() const override
friend std::ostream & operator<<(std::ostream &s, const DataObject &obj)
Output operator (ASCII)
Definition: DataObject.h:87
const JobHistory * m_jobHistory
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:20
std::string documentation() const
property documentation
Definition: Property.h:38
std::string m_version
ServiceHistory class definition.
Base class for all services.
Definition: Service.h:36
const IService * m_pService
STL class.
static const CLID & classID()
const std::string & type() const override