All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ServiceHistory.cpp
Go to the documentation of this file.
1 //
3 // $Id: ServiceHistory.cpp,v 1.2 2008/06/04 12:35:15 marcocle Exp $
4 //
5 // GaudiHistory/ServiceHistory.cpp
6 //
7 // Contains history information for a Service
8 //
9 //
10 // @author: Charles Leggett
11 //
13 
15 #include "GaudiKernel/JobHistory.h"
16 #include "GaudiKernel/IService.h"
17 #include "GaudiKernel/Service.h"
18 #include <iostream>
19 
20 using namespace std;
21 
22 
23 //
25 //
26 
28  // HistoryObj(),
29  m_pService(0),
30  m_name("none"),
31  m_type("none"),
32  m_version("none")
33 {
34 
35 }
36 
37 
38 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
40  // HistoryObj(),
41  m_pService(isv),
42  m_jobHistory(job),
43  m_name(isv->name()),
44  m_version("none")
45 {
46 
47  const Service *svc = dynamic_cast<const Service*>(isv);
48  m_type = System::typeinfoName(typeid(*svc));
49  m_properties = svc->getProperties();
50 
51 }
52 
53 
54 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
55 
57  // HistoryObj(),
58  m_pService(&isv),
59  m_jobHistory(job),
60  m_name(isv.name()),
61  m_version("none")
62 {
63 
64  const Service *svc = dynamic_cast<const Service*>(&isv);
65  m_type = System::typeinfoName(typeid(*svc));
66  m_properties = svc->getProperties();
67 
68 }
69 
70 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
71 
73 
74 }
75 
76 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
77 
78 const CLID&
80 
81  static CLID CLID_ServiceHistory = 187225489; // from `clid ServiceHistory`
82  return CLID_ServiceHistory;
83 
84 }
85 
86 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
87 
88 void
89 ServiceHistory::dump(std::ostream& ost, const bool isXML, int ind) const {
90 
91  if (!isXML) {
92 
93  ost << "Name: " << name() << endl;
94  ost << "Type: " << type() << endl;
95  ost << "Version: " << version() << endl;
96 
97  //Properties
98  ost << "Properties: [" << endl;
99 
100  for ( ServiceHistory::PropertyList::const_iterator
101  ipprop=properties().begin();
102  ipprop!=properties().end(); ++ipprop ) {
103  const Property& prop = **ipprop;
104  prop.fillStream(ost);
105  ost << endl;
106  }
107  ost << "]" << endl;
108 
109  } else {
110 
111  ind += 2;
112  indent(ost,ind);
113  ost << "<COMPONENT name=\"" << name()
114  << "\" class=\"" << convert_string(type())
115  << "\" version=\"" << convert_string(version())
116  << "\">" << endl;
117 
118  for ( ServiceHistory::PropertyList::const_iterator
119  ipprop=properties().begin();
120  ipprop!=properties().end(); ++ipprop ) {
121  const Property& prop = **ipprop;
122 
123  indent(ost,ind+2);
124  ost << "<PROPERTY name=\"" << prop.name()
125  << "\" value=\"" << convert_string(prop.toString())
126  << "\" documentation=\"" << convert_string(prop.documentation())
127  << "\">" << endl;
128  }
129 
130  indent(ost,ind);
131  ost << "</COMPONENT>" << endl;
132 
133  }
134 
135 }
136 
137 
138 //**********************************************************************
139 // Free functions.
140 //**********************************************************************
141 
142 // Output stream.
143 
144 ostream& operator<<(ostream& lhs, const ServiceHistory& rhs) {
145 
146  rhs.dump(lhs,false);
147 
148  return lhs;
149 }
void dump(std::ostream &, const bool isXML=false, int indent=0) const
ostream & operator<<(ostream &lhs, const ServiceHistory &rhs)
virtual std::string toString() const =0
value -> string
const std::string & name() const
const std::string & name() const
property name
Definition: Property.h:47
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
const std::string & documentation() const
property documentation
Definition: Property.h:49
JobHistory class definition.
Definition: JobHistory.h:25
virtual ~ServiceHistory()
PropertyList m_properties
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:182
const std::string & version() const
std::string m_type
General service interface definition.
Definition: IService.h:19
const std::string & type() const
virtual void indent(std::ostream &, int) const
Definition: HistoryObj.cpp:52
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
const PropertyList & properties() const
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:29
std
AIDA -> ROTO converter.
Definition: GaudiAlgs.py:73
ServiceHistory class definition.
Base class for all services.
Definition: Service.h:33
static const CLID & classID()
virtual const std::vector< Property * > & getProperties() const
Get list of properties.
Definition: Service.cpp:366