| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

# ServiceHistory.cpp

Go to the documentation of this file.

    00001
    00002 //
    00003 // $Id: ServiceHistory.cpp,v 1.2 2008/06/04 12:35:15 marcocle Exp $
    00004 //
    00005 // GaudiHistory/ServiceHistory.cpp
    00006 //
    00007 // Contains history information for a Service
    00008 //
    00009 //
    00010 // @author: Charles Leggett
    00011 //
    00013
    00014 #include "GaudiKernel/ServiceHistory.h"
    00015 #include "GaudiKernel/JobHistory.h"
    00016 #include "GaudiKernel/IService.h"
    00017 #include "GaudiKernel/Service.h"
    00018 #include <iostream>
    00019
    00020 using namespace std;
    00021
    00022
    00023 //
    00025 //
    00026
    00027 ServiceHistory::ServiceHistory():
    00028   //  HistoryObj(),
    00029   m_pService(0),
    00030   m_name("none"),
    00031   m_type("none"),
    00032   m_version("none")
    00033 {
    00034
    00035 }
    00036
    00037
    00038 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    00039 ServiceHistory::ServiceHistory(const IService* isv, const JobHistory* job):
    00040   //  HistoryObj(),
    00041   m_pService(isv),
    00042   m_jobHistory(job),
    00043   m_name(isv->name()),
    00044   m_version("none")
    00045 {
    00046
    00047   const Service *svc = dynamic_cast<const Service*>(isv);
    00048   m_type = System::typeinfoName(typeid(*svc));
    00049   m_properties = svc->getProperties();
    00050
    00051 }
    00052
    00053
    00054 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    00055
    00056 ServiceHistory::ServiceHistory(const IService& isv, const JobHistory* job):
    00057   //  HistoryObj(),
    00058   m_pService(&isv),
    00059   m_jobHistory(job),
    00060   m_name(isv.name()),
    00061   m_version("none")
    00062 {
    00063
    00064   const Service *svc = dynamic_cast<const Service*>(&isv);
    00065   m_type = System::typeinfoName(typeid(*svc));
    00066   m_properties = svc->getProperties();
    00067
    00068 }
    00069
    00070 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    00071
    00072 ServiceHistory::~ServiceHistory() {
    00073
    00074 }
    00075
    00076 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    00077
    00078 const CLID&
    00079 ServiceHistory::classID() {
    00080
    00081   static CLID CLID_ServiceHistory = 187225489;   // from `clid ServiceHistory`
    00082   return CLID_ServiceHistory;
    00083
    00084 }
    00085
    00086 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    00087
    00088 void
    00089 ServiceHistory::dump(std::ostream& ost, const bool isXML, int ind) const {
    00090
    00091   if (!isXML) {
    00092
    00093     ost << "Name: " << name() << endl;
    00094     ost << "Type: " << type() << endl;
    00095     ost << "Version: " << version() << endl;
    00096
    00097     //Properties
    00098     ost << "Properties: [" << endl;
    00099
    00100     for ( ServiceHistory::PropertyList::const_iterator
    00101             ipprop=properties().begin();
    00102           ipprop!=properties().end(); ++ipprop ) {
    00103       const Property& prop = **ipprop;
    00104       prop.fillStream(ost);
    00105       ost << endl;
    00106     }
    00107     ost << "]" << endl;
    00108
    00109   } else {
    00110
    00111     ind += 2;
    00112     indent(ost,ind);
    00113     ost << "<COMPONENT name=\"" << name()
    00114         << "\" class=\"" << convert_string(type())
    00115         << "\" version=\"" << convert_string(version())
    00116         << "\">" << endl;
    00117
    00118     for ( ServiceHistory::PropertyList::const_iterator
    00119             ipprop=properties().begin();
    00120           ipprop!=properties().end(); ++ipprop ) {
    00121       const Property& prop = **ipprop;
    00122
    00123       indent(ost,ind+2);
    00124       ost << "<PROPERTY name=\"" << prop.name()
    00125           << "\" value=\"" << convert_string(prop.toString())
    00126           << "\" documentation=\"" << convert_string(prop.documentation())
    00127           << "\">" << endl;
    00128     }
    00129
    00130     indent(ost,ind);
    00131     ost << "</COMPONENT>" << endl;
    00132
    00133   }
    00134
    00135 }
    00136
    00137
    00138 //**********************************************************************
    00139 // Free functions.
    00140 //**********************************************************************
    00141
    00142 // Output stream.
    00143
    00144 ostream& operator<<(ostream& lhs, const ServiceHistory& rhs) {
    00145
    00146   rhs.dump(lhs,false);
    00147
    00148   return lhs;
    00149 }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines