Gaudi Framework, version v23r6

Home   Generated: Wed Jan 30 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
HistorySvc Class Reference

HistorySvc class definition. More...

#include <HistorySvc.h>

Inheritance diagram for HistorySvc:
Inheritance graph
[legend]
Collaboration diagram for HistorySvc:
Collaboration graph
[legend]

Public Member Functions

virtual StatusCode initialize ()
 
virtual StatusCode reinitialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode stop ()
 
virtual StatusCode captureState ()
 
virtual StatusCode registerJob ()
 
virtual StatusCode listProperties () const
 
virtual JobHistorygetJobHistory () const
 
virtual StatusCode registerSvc (const IService &)
 
virtual StatusCode listProperties (const IService &) const
 
virtual ServiceHistorygetServiceHistory (const IService &) const
 
virtual void getServiceHistory (std::set< ServiceHistory * > &) const
 
virtual StatusCode registerAlg (const Algorithm &)
 
virtual StatusCode listProperties (const Algorithm &) const
 
virtual AlgorithmHistorygetAlgHistory (const Algorithm &) const
 
virtual void getAlgHistory (std::set< AlgorithmHistory * > &) const
 
virtual StatusCode registerAlgTool (const IAlgTool &)
 
virtual StatusCode listProperties (const IAlgTool &) const
 
virtual AlgToolHistorygetAlgToolHistory (const IAlgTool &) const
 
virtual void getAlgToolHistory (std::set< AlgToolHistory * > &) const
 
virtual DataHistorycreateDataHistoryObj (const CLID &id, const std::string &key, const std::string &store)
 
virtual StatusCode registerDataHistory (const CLID &id, const std::string &key, const std::string &store)
 
virtual DataHistorygetDataHistory (const CLID &id, const std::string &key, const std::string &store) const
 
virtual int getDataHistory (const CLID &id, const std::string &key, const std::string &storeName, std::list< DataHistory * > &dhlist) const
 
 HistorySvc (const std::string &name, ISvcLocator *svc)
 
virtual void handle (const Incident &inc)
 
virtual ~HistorySvc ()
 
- Public Member Functions inherited from extends2< Service, IHistorySvc, IIncidentListener >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends2 (A1 a1)
 Templated constructor with 1 argument.
 
 extends2 ()
 Default constructor.
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface.
 
virtual std::vector< std::stringgetInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual ~extends2 ()
 Virtual destructor.
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance.
 
virtual const std::stringname () const
 Retrieve name of the service.
 
virtual StatusCode configure ()
 
virtual StatusCode start ()
 
virtual StatusCode terminate ()
 
virtual Gaudi::StateMachine::State FSMState () const
 
virtual Gaudi::StateMachine::State targetFSMState () const
 
virtual StatusCode restart ()
 
virtual StatusCode sysInitialize ()
 Initialize Service.
 
virtual StatusCode sysStart ()
 Initialize Service.
 
virtual StatusCode sysStop ()
 Initialize Service.
 
virtual StatusCode sysFinalize ()
 Finalize Service.
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service.
 
virtual StatusCode sysRestart ()
 Re-initialize the Service.
 
virtual StatusCode setProperty (const Property &p)
 
virtual StatusCode setProperty (const std::string &s)
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 
virtual StatusCode getProperty (Property *p) const
 
virtual const PropertygetProperty (const std::string &name) const
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 
virtual const std::vector
< Property * > & 
getProperties () const
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator.
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job.
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist.
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments.
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments.
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument.
 
 CommonMessaging ()
 Default constructor.
 
virtual ~CommonMessaging ()
 Virtual destructor.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from extend_interfaces2< I1, I2 >
virtual ~extend_interfaces2 ()
 Virtual destructor.
 

Private Types

typedef
IVersHistoryObj::PropertyList 
PropertyList
 
typedef std::multimap< DHH,
DataHistory * > 
DataHistMap
 
typedef DataHistMap::iterator DHMitr
 
typedef DataHistMap::const_iterator DHMCitr
 

Private Member Functions

void clearState ()
 
void dumpProperties (std::ofstream &) const
 
void dumpProperties (const IService &, std::ofstream &) const
 
void dumpProperties (const Algorithm &, std::ofstream &) const
 
void dumpProperties (const IAlgTool &, std::ofstream &) const
 
void dumpState (std::ofstream &) const
 
void dumpState (const INamedInterface *, std::ofstream &) const
 
std::string dumpProp (const Property *, const bool isXML=false, int indent=0) const
 
IAlgorithmgetCurrentIAlg () const
 

Private Attributes

bool m_isInitialized
 
bool m_dump
 
bool m_activate
 
IAlgContextSvcp_algCtxSvc
 
std::set< const Algorithm * > m_algs
 
std::map< const Algorithm
*, AlgorithmHistory * > 
m_algmap
 
std::set< const IAlgTool * > m_ialgtools
 
std::set< const AlgTool * > m_algtools
 
std::map< const AlgTool
*, AlgToolHistory * > 
m_algtoolmap
 
std::set< const IService * > m_svcs
 
std::map< const IService
*, ServiceHistory * > 
m_svcmap
 
std::multimap< DHH, DataHistory * > m_datMap
 
JobHistorym_jobHistory
 
std::string m_outputFile
 
IIncidentSvcm_incidentSvc
 
SmartIF< IToolSvcm_toolSvc
 
MsgStream m_log
 
bool m_outputFileTypeXML
 

Friends

class SvcFactory< HistorySvc >
 

Additional Inherited Members

- Public Types inherited from extends2< Service, IHistorySvc, IIncidentListener >
typedef extends2 base_class
 Typedef to this class.
 
typedef extend_interfaces2
< IHistorySvc,
IIncidentListener
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor.
 
int outputLevel () const
 get the Service's output level
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level.
 
Gaudi::StateMachine::State m_state
 Service state.
 
Gaudi::StateMachine::State m_targetState
 Service state.
 

Detailed Description

HistorySvc class definition.

Definition at line 46 of file HistorySvc.h.

Member Typedef Documentation

Definition at line 101 of file HistorySvc.h.

Definition at line 103 of file HistorySvc.h.

Definition at line 102 of file HistorySvc.h.

Definition at line 99 of file HistorySvc.h.

Constructor & Destructor Documentation

HistorySvc::HistorySvc ( const std::string name,
ISvcLocator svc 
)

Definition at line 67 of file HistorySvc.cpp.

: base_class( name, svc ),
m_dump(false),
{
declareProperty("Activate", m_activate=true);
// hack to bring in environ
envtmp.size(); // prevent icc remark #177: X declared but never referenced
}
HistorySvc::~HistorySvc ( )
virtual

Definition at line 89 of file HistorySvc.cpp.

{
delete m_jobHistory;
}

Member Function Documentation

StatusCode HistorySvc::captureState ( )
virtual

Get all the Algorithms

Get all the AlgTools

Get all the Services

Definition at line 192 of file HistorySvc.cpp.

{
if (m_jobHistory == 0) {
if (service("JobOptionsSvc",jo).isFailure()) {
<< "Could not get jobOptionsSvc - "
<< "not adding properties to JobHistory" << endmsg;
} else {
bool foundAppMgr(false);
for (it=clients.begin(); it!=clients.end(); ++it) {
if (*it == "ApplicationMgr") {
foundAppMgr = true;
}
for (itr=props->begin(); itr != props->end(); ++itr) {
m_jobHistory->addProperty( *it, *itr );
}
}
if (!foundAppMgr) {
IProperty *ap;
if (service("ApplicationMgr",ap).isFailure()) {
m_log << MSG::ERROR << "could not get the ApplicationMgr" << endmsg;
} else {
for (itr2=props.begin(); itr2 != props.end(); ++itr2) {
m_jobHistory->addProperty( "ApplicationMgr", *itr2 );
}
}
}
}
}
IAlgManager* algMgr = 0;
pp_cast<void>(&algMgr) );
if (sc.isFailure()) {
m_log << MSG::ERROR << "Could not get AlgManager" << endmsg;
} else {
algs = algMgr->getAlgorithms();
for (itr=algs.begin(); itr!=algs.end(); ++itr) {
Algorithm* alg = dynamic_cast<Algorithm*> (*itr);
if (alg == 0) {
m_log << MSG::WARNING << "Algorithm " << (*itr)->name()
<< " does not inherit from Algorithm. Not registering it."
<< endmsg;
} else {
registerAlg( *alg ).ignore();
}
}
m_log << "Registered " << algs.size() << " Algorithms" << endmsg;
}
for (itra = m_ialgtools.begin(); itra != m_ialgtools.end(); ++itra) {
(const_cast<IAlgTool*>(*itra))->addRef();
}
m_log << MSG::INFO << "Registered " << m_algtools.size() << " AlgTools"
<< endmsg;
for (itrs=svcs.begin(); itrs!=svcs.end(); ++itrs) {
(*itrs)->addRef();
registerSvc(**itrs).ignore();
}
m_log << "Registered " << svcs.size() << " Services" << endmsg;
}
void HistorySvc::clearState ( )
private

Definition at line 107 of file HistorySvc.cpp.

{
for (algitr = m_algmap.begin(); algitr != m_algmap.end(); ++algitr) {
AlgorithmHistory* h = algitr->second;
(const_cast<Algorithm*> (algitr->first))->release();
delete h;
}
for (atitr=m_algtoolmap.begin(); atitr != m_algtoolmap.end(); ++atitr) {
(const_cast<AlgTool*> (atitr->first))->release();
delete atitr->second;
}
for (svitr = m_svcmap.begin(); svitr != m_svcmap.end(); ++svitr) {
(const_cast<IService*> (svitr->first))->release();
delete svitr->second;
}
}
DataHistory * HistorySvc::createDataHistoryObj ( const CLID id,
const std::string key,
const std::string store 
)
virtual

Definition at line 586 of file HistorySvc.cpp.

{
if (!m_activate) return 0;
AlgorithmHistory *algHist;
if (ialg == 0) {
#ifndef NDEBUG
<< "Could not discover current Algorithm:" << endl
<< " object CLID: " << id << " key: \"" << key
<< "\"" << endmsg;
#endif
algHist = 0;
} else {
Algorithm* alg = dynamic_cast<Algorithm*>(ialg);
if (alg != 0) {
algHist = getAlgHistory( *alg );
} else {
<< "Could not extract concerete Algorithm:"
<< endl
<< " object CLID: " << id << " key: \"" << key
<< "\"" << endmsg;
algHist = 0;
}
}
DataHistory *hist = new DataHistory(id, key, algHist);
return hist;
}
std::string HistorySvc::dumpProp ( const Property prop,
const bool  isXML = false,
int  indent = 0 
) const
private

Definition at line 958 of file HistorySvc.cpp.

{
if (isXML) {
while (ind > 0) {
ost << " ";
ind --;
}
ost << "<PROPERTY name=\"" << prop->name()
<< "\" value=\"" << HistoryObj::convert_string(prop->toString())
<< "\" documentation=\"" << HistoryObj::convert_string(prop->documentation())
<< "\">";
} else {
prop->fillStream(ost);
}
return ost.str();
}
void HistorySvc::dumpProperties ( std::ofstream ofs) const
private

Definition at line 519 of file HistorySvc.cpp.

{
ofs << "GLOBAL" << std::endl;
for (itrj=props.begin(); itrj != props.end(); ++itrj) {
std::string client = itrj->first;
const Property* prp = itrj->second;
ofs << client << " " << dumpProp(prp) << std::endl;
}
ofs << std::endl << "SERVICES" << std::endl;
for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) {
const IService* svc = itr_s->first;
dumpProperties( *svc, ofs );
}
ofs << std::endl << "ALGORITHMS" << std::endl;
for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) {
const Algorithm* alg = itr->first;
dumpProperties( *alg, ofs );
}
ofs << std::endl << "ALGTOOLS" << std::endl;
for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) {
const AlgTool* alg = itr_a->first;
dumpProperties( *alg, ofs );
}
}
void HistorySvc::dumpProperties ( const IService svc,
std::ofstream ofs 
) const
private

Definition at line 802 of file HistorySvc.cpp.

{
if (hist == 0) {
return;
}
for (itr=hist->properties().begin(); itr != hist->properties().end();++itr) {
ofs << svc.name() << " " << dumpProp(*itr) << std::endl;
}
}
void HistorySvc::dumpProperties ( const Algorithm alg,
std::ofstream ofs 
) const
private

Definition at line 399 of file HistorySvc.cpp.

{
if (hist == 0) {
return;
}
for (itr=hist->properties().begin(); itr!=hist->properties().end(); ++itr) {
ofs << alg.name() << " " << dumpProp(*itr) << std::endl;
}
}
void HistorySvc::dumpProperties ( const IAlgTool alg,
std::ofstream ofs 
) const
private

Definition at line 891 of file HistorySvc.cpp.

{
if (hist == 0) {
return;
}
for (itr=hist->properties().begin(); itr!=hist->properties().end(); ++itr) {
ofs << alg.name() << " " << dumpProp(*itr) << std::endl;
}
}
void HistorySvc::dumpState ( std::ofstream ofs) const
private

Definition at line 978 of file HistorySvc.cpp.

{
//xml header
ofs << "<?xml version=\"1.0\" ?> " << std::endl;
ofs << "<!--Test-xml-->" << std::endl;
ofs << "<SETUP>" << std::endl;
ofs << " <GLOBAL>" << std::endl;
} else {
ofs << "GLOBAL" << std::endl;
}
std::string client_currently_open = "start";
for (itrj=props.begin(); itrj != props.end(); ++itrj) {
// client is the name of the component of the current property
std::string client = itrj->first;
const Property* prp = itrj->second;
if (client != client_currently_open) {
if(client_currently_open!="start") ofs << " </COMPONENT>" << endl;
ofs << " <COMPONENT name=\""
<< client << "\" class=\"undefined\">" << std::endl;
}
} else {
ofs << client << " ";
}
ofs << dumpProp(prp,m_outputFileTypeXML,6) << endl;
client_currently_open = client;
}
ofs << " </COMPONENT>" << endl;
ofs << "</GLOBAL>" << endl << "<SERVICES>" << endl;
} else {
ofs << "SERVICES" << std::endl;
}
for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) {
const IService* svc = itr_s->first;
dumpState(svc,ofs);
}
ofs << "</SERVICES>" << endl << "<ALGORITHMS> " << endl;
} else {
ofs << "ALGORITHMS" << std::endl;
}
for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) {
const Algorithm* alg = itr->first;
dumpState(alg,ofs);
}
ofs << "</ALGORITHMS>" << endl << "<ALGTOOLS> " << endl;
} else {
ofs << "ALGTOOLS" << std::endl;
}
for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) {
const AlgTool* alg = itr_a->first;
dumpState( alg, ofs);
}
ofs << "</ALGTOOLS>" << endl << "</SETUP>" << endl;
}
}
void HistorySvc::dumpState ( const INamedInterface in,
std::ofstream ofs 
) const
private

Definition at line 1070 of file HistorySvc.cpp.

{
HistoryObj *hist(0);
IVersHistoryObj *vhist(0);
const IService* is(0);
const Algorithm* ia(0);
const IAlgTool* it(0);
if ( (is=dynamic_cast<const IService*>(in)) != 0) {
// m_log << MSG::DEBUG << in->name() << " is Service" << endmsg;
hist = getServiceHistory( *is );
} else if ( (ia = dynamic_cast<const Algorithm*>(in)) != 0 ) {
// m_log << MSG::DEBUG << in->name() << " is Alg" << endmsg;
hist = getAlgHistory( *ia );
} else if ( (it = dynamic_cast<const IAlgTool*>(in)) != 0 ) {
// m_log << MSG::DEBUG << in->name() << " is AlgTool" << endmsg;
hist = getAlgToolHistory( *it );
} else {
<< "Could not dcast interface to accepted History Obj type for "
<< in->name() << endmsg;
return;
}
if (hist == 0) { return; }
vhist = dynamic_cast<IVersHistoryObj*>(hist);
if (!vhist) {
warning() << "Failed to dynamic cast IVersHistoryObj for " << in->name() << endmsg;
return;
}
hist->dump(ofs,true);
} else {
ofs << ">> " << vhist->name() << endl << *hist << endl;
}
}
StatusCode HistorySvc::finalize ( )
virtual

Reimplemented from Service.

Definition at line 327 of file HistorySvc.cpp.

{
if ( status.isSuccess() )
m_log << MSG::INFO << "Service finalised successfully" << endmsg;
return status;
}
AlgorithmHistory * HistorySvc::getAlgHistory ( const Algorithm alg) const
virtual

Definition at line 416 of file HistorySvc.cpp.

{
const Algorithm *palg = &alg;
if ( itr == m_algs.end() ) {
m_log << MSG::WARNING << "Algorithm " << alg.name() << " not registered"
<< endmsg;
return 0;
}
itr2 = m_algmap.find( *itr );
return ( itr2->second );
}
void HistorySvc::getAlgHistory ( std::set< AlgorithmHistory * > &  algs) const
virtual

Definition at line 435 of file HistorySvc.cpp.

{
for (itr=m_algs.begin(); itr!=m_algs.end(); ++itr) {
AlgorithmHistory *ah = m_algmap.find(*itr)->second;
algs.insert(ah);
}
}
AlgToolHistory * HistorySvc::getAlgToolHistory ( const IAlgTool alg) const
virtual

Definition at line 909 of file HistorySvc.cpp.

{
const AlgTool *palg = dynamic_cast<const AlgTool*>(&alg);
if ( itr == m_algtools.end() ) {
m_log << MSG::WARNING << "AlgTool " << alg.name() << " not registered"
<< endmsg;
return 0;
}
itr2 = m_algtoolmap.find( *itr );
return ( itr2->second );
}
void HistorySvc::getAlgToolHistory ( std::set< AlgToolHistory * > &  algs) const
virtual

Definition at line 929 of file HistorySvc.cpp.

{
for (itr=m_algtools.begin(); itr!=m_algtools.end(); ++itr) {
AlgToolHistory *ah = m_algtoolmap.find(*itr)->second;
algs.insert(ah);
}
}
IAlgorithm * HistorySvc::getCurrentIAlg ( ) const
private

Definition at line 571 of file HistorySvc.cpp.

{
if (p_algCtxSvc == 0) {
m_log << MSG::WARNING << "trying to create DataHistoryObj before "
<< "HistorySvc has been initialized" << endmsg;
return 0;
} else {
}
}
DataHistory * HistorySvc::getDataHistory ( const CLID id,
const std::string key,
const std::string store 
) const
virtual

Definition at line 669 of file HistorySvc.cpp.

{
DHH dhh(id,key);
if(mitr.first == mitr.second) {
return 0;
}
return mitr.first->second;
}
int HistorySvc::getDataHistory ( const CLID id,
const std::string key,
const std::string storeName,
std::list< DataHistory * > &  dhlist 
) const
virtual

Definition at line 687 of file HistorySvc.cpp.

{
DHH dhh(id,key);
int n(0);
for (DHMCitr itr=mitr.first; itr != mitr.second; ++itr) {
dhlist.push_back(itr->second);
n++;
}
return n;
}
JobHistory * HistorySvc::getJobHistory ( ) const
virtual

Definition at line 563 of file HistorySvc.cpp.

{
return m_jobHistory;
}
ServiceHistory * HistorySvc::getServiceHistory ( const IService svc) const
virtual

Definition at line 745 of file HistorySvc.cpp.

{
const IService *psvc = &svc;
m_svcmap.find(psvc);
if ( itr == m_svcmap.end() ) {
m_log << MSG::WARNING << "Service " << svc.name() << " not registered"
<< endmsg;
return 0;
}
return ( itr->second );
}
void HistorySvc::getServiceHistory ( std::set< ServiceHistory * > &  svcs) const
virtual

Definition at line 762 of file HistorySvc.cpp.

{
for (itr=m_svcs.begin(); itr!=m_svcs.end(); ++itr) {
ServiceHistory *sh = m_svcmap.find( *itr )->second;
svcs.insert(sh);
}
}
void HistorySvc::handle ( const Incident inc)
virtual

Definition at line 943 of file HistorySvc.cpp.

{
if (incident.type() == IncidentType::BeginEvent) {
m_log << MSG::WARNING << "Error capturing state." << endl
<< "Will try again at next BeginEvent incident" << endmsg;
}
}
}
StatusCode HistorySvc::initialize ( )
virtual

Reimplemented from Service.

Definition at line 138 of file HistorySvc.cpp.

{
if (status.isFailure()) {
#ifndef NDEBUG
m_log << MSG::DEBUG << "Failed to initialize the base class (Service)"
<< endmsg;
#endif
return status;
}
#ifndef NDEBUG
m_log << MSG::DEBUG << "Initializing HistorySvc" << endmsg;
#endif
static const bool CREATEIF(true);
if ( service("AlgContextSvc",p_algCtxSvc,CREATEIF).isFailure() ) {
m_log << MSG::ERROR << "unable to get the AlgContextSvc" << endmsg;
}
if (service("IncidentSvc", m_incidentSvc, CREATEIF).isFailure()) {
m_log << MSG::ERROR << "unable to get the IncidentSvc" << endmsg;
}
// create a weak dependency on the ToolSvc, so that it doesn't get deleted
// before we're done with it in finalize
m_toolSvc = serviceLocator()->service("ToolSvc");
if (! m_toolSvc) {
m_log << MSG::ERROR << "could not retrieve the ToolSvc handle !"
<< endmsg;
}
// add listener to be triggered by first BeginEvent with low priority
// so it gets called first
const bool rethrow = false;
const bool oneShot = true; // make the listener called only once
std::numeric_limits<long>::min(),rethrow,oneShot);
}
StatusCode HistorySvc::listProperties ( ) const
virtual

Definition at line 460 of file HistorySvc.cpp.

{
m_log << "Dumping properties for all Algorithms (" << m_algmap.size()
<< ")" << endmsg;
for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) {
const Algorithm* alg = itr->first;
}
m_log << "Dumping properties for all AlgTools (" << m_algtoolmap.size()
<< ")" << endmsg;
for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) {
m_log << MSG::DEBUG << " --> " << itr_a->second->algtool_name() << endmsg;
const AlgTool* alg = itr_a->first;
}
m_log << "Dumping properties for all Services (" << m_svcmap.size()
<< ")" << endmsg;
for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) {
const IService* svc = itr_s->first;
}
m_log << "Dumping properties for Job";
ost << *m_jobHistory;
std::string str = ost.str();
m_log << std::endl << str << endmsg;
}
StatusCode HistorySvc::listProperties ( const IService svc) const
virtual

Definition at line 776 of file HistorySvc.cpp.

{
m_log << MSG::INFO << "Dumping properties for " << svc.name() << endl;
if (hist == 0) {
}
ost << *hist;
std::string str = ost.str();
m_log << MSG::INFO << svc.name() << " --> " << endl << str << endmsg;
}
StatusCode HistorySvc::listProperties ( const Algorithm alg) const
virtual

Definition at line 376 of file HistorySvc.cpp.

{
m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl;
if (hist == 0) {
}
ost << *hist;
std::string str = ost.str();
m_log << MSG::INFO << alg.name() << " --> " << endl << str << endmsg;
}
StatusCode HistorySvc::listProperties ( const IAlgTool alg) const
virtual

Definition at line 868 of file HistorySvc.cpp.

{
m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl;
if (hist == 0) {
}
ost << *hist;
std::string str = ost.str();
m_log << MSG::INFO << alg.name() << " --> " << endl << str << endmsg;
}
StatusCode HistorySvc::registerAlg ( const Algorithm alg)
virtual

Definition at line 347 of file HistorySvc.cpp.

{
if (m_algmap.find(&alg) != m_algmap.end()) {
m_log << MSG::WARNING << "Algorithm " << alg.name()
<< " already registered with HistorySvc" << endmsg;
}
(const_cast<Algorithm*>(&alg))->addRef();
m_algs.insert(&alg);
AlgorithmHistory *algHist = new AlgorithmHistory(alg, job);
m_algmap[&alg] = algHist;
#ifndef NDEBUG
m_log << MSG::DEBUG << "Registering algorithm: ";
m_log << alg.name() << endmsg;
#endif
}
StatusCode HistorySvc::registerAlgTool ( const IAlgTool ialg)
virtual

Definition at line 820 of file HistorySvc.cpp.

{
if (! m_isInitialized) {
if (p_algCtxSvc == 0) {
if ( service("AlgContextSvc",p_algCtxSvc,true).isFailure() ) {
m_log << MSG::ERROR << "unable to get the AlgContextSvc" << endmsg;
}
}
}
const AlgTool *alg = dynamic_cast<const AlgTool*>( &ialg );
if ( alg == 0 ) {
m_log << MSG::ERROR << "Could not dcast IAlgTool \"" << ialg.name()
<< "\" to an AlgTool" << endmsg;
}
if (m_algtools.find(alg) != m_algtools.end()) {
m_log << MSG::WARNING << "AlgTool " << ialg.name()
<< " already registered in HistorySvc" << endmsg;
}
(const_cast<AlgTool*>(alg))->addRef();
const JobHistory *job = getJobHistory();
AlgToolHistory *algHist = new AlgToolHistory(*alg, job);
m_algtoolmap[alg] = algHist;
#ifndef NDEBUG
m_log << MSG::DEBUG << "Registering algtool: ";
m_log << alg->name() << endmsg;
#endif
}
StatusCode HistorySvc::registerDataHistory ( const CLID id,
const std::string key,
const std::string store 
)
virtual

Definition at line 625 of file HistorySvc.cpp.

{
DHH dhh(id,key);
if (mitr.first == mitr.second) {
// not in the map
DataHistory *dh = createDataHistoryObj(id,key,storeName);
} else {
// found at least one
bool match(false);
std::string algName;
if (ialg != 0) {
algName = ialg->name();
} else {
algName = "UNKNOWN";
}
for (DHMitr itr = mitr.first; itr != mitr.second; ++itr) {
DataHistory *dh = itr->second;
if (dh->algorithmHistory()->algorithm_name() == algName) {
match = true;
break;
}
}
if (! match) {
DataHistory *dh = createDataHistoryObj(id,key,storeName);
}
}
}
StatusCode HistorySvc::registerJob ( )
virtual

Definition at line 449 of file HistorySvc.cpp.

{
}
StatusCode HistorySvc::registerSvc ( const IService svc)
virtual

Definition at line 709 of file HistorySvc.cpp.

{
if ( svc.name() == "HistoryStore" ) {
// m_log << MSG::WARNING << "not registering store" << endmsg;
}
const IService* psvc = &svc;
m_svcmap.find(psvc);
if (itr == m_svcmap.end()) {
#ifndef NDEBUG
m_log << MSG::DEBUG << "Registering Service: ";
m_log << svc.name() << endmsg;
#endif
m_svcs.insert(psvc);
ServiceHistory *svcHist = new ServiceHistory(&svc, job);
m_svcmap[psvc] = svcHist;
(const_cast<IService*>(psvc))->addRef();
}
}
StatusCode HistorySvc::reinitialize ( )
virtual

Reimplemented from Service.

Definition at line 95 of file HistorySvc.cpp.

StatusCode HistorySvc::stop ( )
virtual

Reimplemented from Service.

Definition at line 296 of file HistorySvc.cpp.

{
if (m_dump) {
}
if (m_outputFile != "") {
ofs.open(m_outputFile.c_str());
if (!ofs) {
m_log << MSG::ERROR << "Unable to open output file \"m_outputFile\""
<< endmsg;
} else {
// dumpProperties(ofs);
dumpState(ofs);
ofs.close();
}
}
}

Friends And Related Function Documentation

friend class SvcFactory< HistorySvc >
friend

Definition at line 108 of file HistorySvc.h.

Member Data Documentation

bool HistorySvc::m_activate
private

Definition at line 112 of file HistorySvc.h.

std::map<const Algorithm*, AlgorithmHistory*> HistorySvc::m_algmap
private

Definition at line 117 of file HistorySvc.h.

std::set<const Algorithm*> HistorySvc::m_algs
private

Definition at line 116 of file HistorySvc.h.

std::map<const AlgTool*, AlgToolHistory*> HistorySvc::m_algtoolmap
private

Definition at line 121 of file HistorySvc.h.

std::set<const AlgTool*> HistorySvc::m_algtools
private

Definition at line 120 of file HistorySvc.h.

std::multimap<DHH, DataHistory*> HistorySvc::m_datMap
private

Definition at line 126 of file HistorySvc.h.

bool HistorySvc::m_dump
private

Definition at line 111 of file HistorySvc.h.

std::set<const IAlgTool*> HistorySvc::m_ialgtools
private

Definition at line 119 of file HistorySvc.h.

IIncidentSvc* HistorySvc::m_incidentSvc
private

Definition at line 147 of file HistorySvc.h.

bool HistorySvc::m_isInitialized
private

Definition at line 110 of file HistorySvc.h.

JobHistory* HistorySvc::m_jobHistory
private

Definition at line 130 of file HistorySvc.h.

MsgStream HistorySvc::m_log
mutableprivate

Definition at line 150 of file HistorySvc.h.

std::string HistorySvc::m_outputFile
private

Definition at line 132 of file HistorySvc.h.

bool HistorySvc::m_outputFileTypeXML
private

Definition at line 151 of file HistorySvc.h.

std::map<const IService*, ServiceHistory*> HistorySvc::m_svcmap
private

Definition at line 124 of file HistorySvc.h.

std::set<const IService*> HistorySvc::m_svcs
private

Definition at line 123 of file HistorySvc.h.

SmartIF<IToolSvc> HistorySvc::m_toolSvc
private

Definition at line 148 of file HistorySvc.h.

IAlgContextSvc* HistorySvc::p_algCtxSvc
private

Definition at line 114 of file HistorySvc.h.


The documentation for this class was generated from the following files:

Generated at Wed Jan 30 2013 17:13:46 for Gaudi Framework, version v23r6 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004