| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ServiceHistory.cpp
Go to the documentation of this file.
1
2 //
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
14 #include "GaudiKernel/ServiceHistory.h"
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
27 ServiceHistory::ServiceHistory():
28 // HistoryObj(),
29 m_pService(0),
30 m_name("none"),
31 m_type("none"),
32 m_version("none")
33 {
34
35 }
36
37
38 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
39 ServiceHistory::ServiceHistory(const IService* isv, const JobHistory* job):
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
56 ServiceHistory::ServiceHistory(const IService& isv, const JobHistory* job):
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
72 ServiceHistory::~ServiceHistory() {
73
74 }
75
76 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
77
78 const CLID&
79 ServiceHistory::classID() {
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 }