Gaudi Framework, version v25r2

Home   Generated: Wed Jun 4 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | 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::string > getInterfaceNames () 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::string & name () 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
 

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 43 of file HistorySvc.h.

Member Typedef Documentation

typedef std::multimap<DHH,DataHistory*> HistorySvc::DataHistMap
private

Definition at line 98 of file HistorySvc.h.

typedef DataHistMap::const_iterator HistorySvc::DHMCitr
private

Definition at line 100 of file HistorySvc.h.

typedef DataHistMap::iterator HistorySvc::DHMitr
private

Definition at line 99 of file HistorySvc.h.

Definition at line 96 of file HistorySvc.h.

Constructor & Destructor Documentation

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

Definition at line 64 of file HistorySvc.cpp.

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

Definition at line 87 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 195 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);
std::vector<std::string> clients = jo->getClients();
std::vector<std::string>::const_iterator it;
std::vector<const Property*>::const_iterator itr;
for (it=clients.begin(); it!=clients.end(); ++it) {
if (*it == "ApplicationMgr") {
foundAppMgr = true;
}
const std::vector<const Property*> *props = jo->getProperties(*it);
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 {
std::vector<Property*>::const_iterator itr2;
const std::vector<Property*> props = ap->getProperties();
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 {
std::list<IAlgorithm*> algs;
algs = algMgr->getAlgorithms();
std::list<IAlgorithm*>::const_iterator itr;
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;
}
std::set<const IAlgTool*>::const_iterator itra;
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;
std::list<IService*> svcs = Gaudi::svcLocator()->getServices();
std::list<IService*>::const_iterator itrs;
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 105 of file HistorySvc.cpp.

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

Definition at line 593 of file HistorySvc.cpp.

{
if (!m_activate) return 0;
AlgorithmHistory *algHist;
if (ialg == 0) {
<< "Could not discover current Algorithm:" << endl
<< " object CLID: " << id << " key: \"" << key
<< "\"" << endmsg;
algHist = 0;
} else {
Algorithm* alg = dynamic_cast<Algorithm*>(ialg);
if (alg != 0) {
algHist = getAlgHistory( *alg );
} else {
<< "Could not extract concrete 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 964 of file HistorySvc.cpp.

{
std::ostringstream ost;
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 526 of file HistorySvc.cpp.

{
ofs << "GLOBAL" << std::endl;
JobHistory::PropertyPairList::const_iterator itrj;
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;
std::map<const IService*, ServiceHistory*>::const_iterator itr_s;
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;
std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr;
for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) {
const Algorithm* alg = itr->first;
dumpProperties( *alg, ofs );
}
ofs << std::endl << "ALGTOOLS" << std::endl;
std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a;
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 808 of file HistorySvc.cpp.

{
if (hist == 0) {
return;
}
PropertyList::const_iterator itr;
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 405 of file HistorySvc.cpp.

{
if (hist == 0) {
return;
}
PropertyList::const_iterator itr;
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 897 of file HistorySvc.cpp.

{
if (hist == 0) {
return;
}
PropertyList::const_iterator itr;
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 984 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;
}
JobHistory::PropertyPairList::const_iterator itrj;
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;
}
std::map<const IService*, ServiceHistory*>::const_iterator itr_s;
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;
}
std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr;
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;
}
std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a;
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 1077 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::VERBOSE << in->name() << " is Service" << endmsg;
hist = dynamic_cast<HistoryObj*>( o );
vhist = dynamic_cast<IVersHistoryObj*>( o );
} else if ( (ia = dynamic_cast<const Algorithm*>(in)) != 0 ) {
m_log << MSG::VERBOSE << in->name() << " is Alg" << endmsg;
hist = dynamic_cast<HistoryObj*>( o );
vhist = dynamic_cast<IVersHistoryObj*>( o );
} else if ( (it = dynamic_cast<const IAlgTool*>(in)) != 0 ) {
m_log << MSG::VERBOSE << in->name() << " is AlgTool" << endmsg;
hist = dynamic_cast<HistoryObj*>( o );
vhist = dynamic_cast<IVersHistoryObj*>( o );
} else {
<< "Could not dcast interface to accepted History Obj type for "
<< in->name() << endreq;
return;
}
if (hist == 0 || vhist == 0) {
m_log << MSG::ERROR << "Could not dcast recognized object to HistoryObj or IVersHistoryObj. This should never happen."
<< endmsg;
return;
}
hist->dump(ofs,true);
} else {
ofs << ">> " << vhist->name() << endl << *hist << endl;
}
}
StatusCode HistorySvc::finalize ( )
virtual

Reimplemented from Service.

Definition at line 330 of file HistorySvc.cpp.

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

Definition at line 422 of file HistorySvc.cpp.

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

Definition at line 441 of file HistorySvc.cpp.

{
set<const Algorithm*>::const_iterator itr;
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 915 of file HistorySvc.cpp.

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

Definition at line 935 of file HistorySvc.cpp.

{
set<const AlgTool*>::const_iterator itr;
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 578 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 675 of file HistorySvc.cpp.

{
DHH dhh(id,key);
pair<DHMCitr,DHMCitr> mitr = m_datMap.equal_range(dhh);
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 693 of file HistorySvc.cpp.

{
DHH dhh(id,key);
int n(0);
pair<DHMCitr,DHMCitr> mitr = m_datMap.equal_range(dhh);
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 570 of file HistorySvc.cpp.

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

Definition at line 751 of file HistorySvc.cpp.

{
const IService *psvc = &svc;
map<const IService*, ServiceHistory*>::const_iterator itr =
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 768 of file HistorySvc.cpp.

{
set<const IService*>::const_iterator itr;
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 949 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 136 of file HistorySvc.cpp.

{
if (status.isFailure()) {
m_log << MSG::DEBUG << "Failed to initialize the base class (Service)"
<< endmsg;
return status;
}
m_log << MSG::DEBUG << "Initializing HistorySvc" << endmsg;
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);
if (m_outputFile.find(".XML") != string::npos || m_outputFile.find(".xml") != string::npos) {
m_log << MSG::DEBUG << "output format is XML" << endmsg;
}
}
StatusCode HistorySvc::listProperties ( ) const
virtual

Definition at line 466 of file HistorySvc.cpp.

{
m_log << "Dumping properties for all Algorithms (" << m_algmap.size()
<< ")" << endmsg;
std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr;
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;
std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a;
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;
std::map<const IService*, ServiceHistory*>::const_iterator itr_s;
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";
ostringstream ost;
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 782 of file HistorySvc.cpp.

{
m_log << MSG::INFO << "Dumping properties for " << svc.name() << endl;
if (hist == 0) {
}
ostringstream ost;
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 382 of file HistorySvc.cpp.

{
m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl;
if (hist == 0) {
}
ostringstream ost;
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 874 of file HistorySvc.cpp.

{
m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl;
if (hist == 0) {
}
ostringstream ost;
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 353 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;
m_log << MSG::DEBUG << "Registering algorithm: ";
m_log << alg.name() << endmsg;
}
}
StatusCode HistorySvc::registerAlgTool ( const IAlgTool ialg)
virtual

Definition at line 826 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;
}
}
m_ialgtools.insert(&ialg);
}
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;
}
m_algtools.insert(alg);
(const_cast<AlgTool*>(alg))->addRef();
const JobHistory *job = getJobHistory();
AlgToolHistory *algHist = new AlgToolHistory(*alg, job);
m_algtoolmap[alg] = algHist;
if (m_log.level() <= MSG::DEBUG) {
m_log << MSG::DEBUG << "Registering algtool: ";
m_log << alg->name() << endmsg;
}
}
StatusCode HistorySvc::registerDataHistory ( const CLID id,
const std::string &  key,
const std::string &  store 
)
virtual

Definition at line 631 of file HistorySvc.cpp.

{
DHH dhh(id,key);
pair<DHMitr,DHMitr> mitr = m_datMap.equal_range(dhh);
if (mitr.first == mitr.second) {
// not in the map
DataHistory *dh = createDataHistoryObj(id,key,storeName);
m_datMap.insert(pair<DHH,DataHistory*>(dhh,dh));
} 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);
m_datMap.insert(pair<DHH,DataHistory*>(dhh,dh));
}
}
}
StatusCode HistorySvc::registerJob ( )
virtual

Definition at line 455 of file HistorySvc.cpp.

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

Definition at line 715 of file HistorySvc.cpp.

{
if ( svc.name() == "HistoryStore" ) {
// m_log << MSG::WARNING << "not registering store" << endmsg;
}
const IService* psvc = &svc;
map<const IService*, ServiceHistory*>::const_iterator itr =
m_svcmap.find(psvc);
if (itr == m_svcmap.end()) {
if (m_log.level() <= MSG::DEBUG) {
m_log << MSG::DEBUG << "Registering Service: ";
m_log << svc.name() << endmsg;
}
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 93 of file HistorySvc.cpp.

StatusCode HistorySvc::stop ( )
virtual

Reimplemented from Service.

Definition at line 299 of file HistorySvc.cpp.

{
if (m_dump) {
}
if (m_outputFile != "") {
std::ofstream ofs;
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();
}
}
}

Member Data Documentation

bool HistorySvc::m_activate
private

Definition at line 106 of file HistorySvc.h.

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

Definition at line 111 of file HistorySvc.h.

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

Definition at line 110 of file HistorySvc.h.

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

Definition at line 115 of file HistorySvc.h.

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

Definition at line 114 of file HistorySvc.h.

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

Definition at line 120 of file HistorySvc.h.

bool HistorySvc::m_dump
private

Definition at line 105 of file HistorySvc.h.

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

Definition at line 113 of file HistorySvc.h.

IIncidentSvc* HistorySvc::m_incidentSvc
private

Definition at line 141 of file HistorySvc.h.

bool HistorySvc::m_isInitialized
private

Definition at line 104 of file HistorySvc.h.

JobHistory* HistorySvc::m_jobHistory
private

Definition at line 124 of file HistorySvc.h.

MsgStream HistorySvc::m_log
mutableprivate

Definition at line 144 of file HistorySvc.h.

std::string HistorySvc::m_outputFile
private

Definition at line 126 of file HistorySvc.h.

bool HistorySvc::m_outputFileTypeXML
private

Definition at line 145 of file HistorySvc.h.

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

Definition at line 118 of file HistorySvc.h.

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

Definition at line 117 of file HistorySvc.h.

SmartIF<IToolSvc> HistorySvc::m_toolSvc
private

Definition at line 142 of file HistorySvc.h.

IAlgContextSvc* HistorySvc::p_algCtxSvc
private

Definition at line 108 of file HistorySvc.h.


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

Generated at Wed Jun 4 2014 14:49:02 for Gaudi Framework, version v25r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004