The Gaudi Framework  v30r3 (a5ef0a68)
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 }
33 
34 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
36  : // HistoryObj(),
37  m_pService( isv )
38  , m_jobHistory( job )
39  , m_name( isv->name() )
40  , m_version( "none" )
41 {
42 
43  const Service* svc = dynamic_cast<const Service*>( isv );
44  m_type = System::typeinfoName( typeid( *svc ) );
45  m_properties = svc->getProperties();
46 }
47 
48 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
49 
51  : // HistoryObj(),
52  m_pService( &isv )
53  , m_jobHistory( job )
54  , m_name( isv.name() )
55  , m_version( "none" )
56 {
57 
58  const Service* svc = dynamic_cast<const Service*>( &isv );
59  m_type = System::typeinfoName( typeid( *svc ) );
60  m_properties = svc->getProperties();
61 }
62 
63 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
64 
66 {
67 
68  static const CLID CLID_ServiceHistory = 187225489; // from `clid ServiceHistory`
69  return CLID_ServiceHistory;
70 }
71 
72 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
73 
74 void ServiceHistory::dump( std::ostream& ost, const bool isXML, int ind ) const
75 {
76 
77  if ( !isXML ) {
78 
79  ost << "Name: " << name() << endl;
80  ost << "Type: " << type() << endl;
81  ost << "Version: " << version() << endl;
82 
83  // Properties
84  ost << "Properties: [" << endl;
85 
86  for ( const auto& ipprop : properties() ) {
87  const PropertyBase& prop = *ipprop;
88  prop.fillStream( ost );
89  ost << endl;
90  }
91  ost << "]" << endl;
92 
93  } else {
94 
95  ind += 2;
96  indent( ost, ind );
97  ost << "<COMPONENT name=\"" << name() << "\" class=\"" << convert_string( type() ) << "\" version=\""
98  << convert_string( version() ) << "\">" << endl;
99 
100  for ( const auto& ipprop : properties() ) {
101  const PropertyBase& prop = *ipprop;
102 
103  indent( ost, ind + 2 );
104  ost << "<PROPERTY name=\"" << prop.name() << "\" value=\"" << convert_string( prop.toString() )
105  << "\" documentation=\"" << convert_string( prop.documentation() ) << "\">" << endl;
106  }
107 
108  indent( ost, ind );
109  ost << "</COMPONENT>" << endl;
110  }
111 }
112 
113 //**********************************************************************
114 // Free functions.
115 //**********************************************************************
116 
117 // Output stream.
118 
120 {
121 
122  rhs.dump( lhs, false );
123 
124  return lhs;
125 }
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:332
const std::string name() const
property name
Definition: Property.h:40
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:49
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:52
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:89
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:42
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