HistorySvc Class Reference

HistorySvc class definition. More...

#include <src/HistorySvc.h>

Inheritance diagram for HistorySvc:
Collaboration diagram for HistorySvc:

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 ()=default
 
- Public Member Functions inherited from extends< BASE, Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

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 = false
 
bool m_dump = false
 
bool m_activate = true
 
IAlgContextSvcp_algCtxSvc = nullptr
 
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
 
std::set< const IAlgTool * > m_ialgtools
 
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
 
std::map< const IService *, ServiceHistory * > m_svcmap
 
std::multimap< DHH, DataHistory * > m_datMap
 
std::unique_ptr< JobHistorym_jobHistory
 
std::string m_outputFile
 
IIncidentSvcm_incidentSvc = nullptr
 
SmartIF< IToolSvcm_toolSvc
 
MsgStream m_log
 
bool m_outputFileTypeXML = false
 

Additional Inherited Members

- Public Types inherited from extends< BASE, Interfaces >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 

Detailed Description

HistorySvc class definition.

Definition at line 41 of file HistorySvc.h.

Member Typedef Documentation

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

Definition at line 96 of file HistorySvc.h.

typedef DataHistMap::const_iterator HistorySvc::DHMCitr
private

Definition at line 98 of file HistorySvc.h.

typedef DataHistMap::iterator HistorySvc::DHMitr
private

Definition at line 97 of file HistorySvc.h.

Definition at line 94 of file HistorySvc.h.

Constructor & Destructor Documentation

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

Definition at line 76 of file HistorySvc.cpp.

77  : base_class( name, svc ),
78  m_log(msgSvc(), name )
79 {
80  declareProperty("Dump",m_dump);
81  declareProperty("Activate", m_activate=true);
82  declareProperty("OutputFile",m_outputFile);
83 
84  // hack to bring in environ
85  vector<string> envtmp = System::getEnv();
86  envtmp.size(); // prevent icc remark #177: X declared but never referenced
87 }
extends base_class
Typedef to this class.
Definition: extends.h:14
std::string m_outputFile
Definition: HistorySvc.h:120
bool m_activate
Definition: HistorySvc.h:104
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:617
MsgStream m_log
Definition: HistorySvc.h:138
bool m_dump
Definition: HistorySvc.h:103
virtual HistorySvc::~HistorySvc ( )
virtualdefault

Member Function Documentation

StatusCode HistorySvc::captureState ( )
virtual

Get all the Algorithms

Get all the AlgTools

Get all the Services

Definition at line 184 of file HistorySvc.cpp.

184  {
185 
186  if (!m_jobHistory ) {
187  m_jobHistory.reset( new JobHistory );
188  IJobOptionsSvc *jo;
189  if (service("JobOptionsSvc",jo).isFailure()) {
190  m_log << MSG::ERROR
191  << "Could not get jobOptionsSvc - "
192  << "not adding properties to JobHistory" << endmsg;
193  } else {
194 
195  bool foundAppMgr(false);
196 
197  for (auto& client: jo->getClients()) {
198  if (client == "ApplicationMgr") foundAppMgr = true;
199  for (auto prop: *jo->getProperties(client)) {
200  m_jobHistory->addProperty(client, prop);
201  }
202  }
203 
204  if (!foundAppMgr) {
205  auto ap = service<IProperty>("ApplicationMgr");
206  if (!ap) {
207  m_log << MSG::ERROR << "could not get the ApplicationMgr" << endmsg;
208  } else {
209  for (auto prop: ap->getProperties()) {
210  m_jobHistory->addProperty("ApplicationMgr", prop);
211  }
212  }
213  }
214 
215  }
216  }
217 
219 
220  auto algMgr = Gaudi::svcLocator()->as<IAlgManager>();
221  if ( !algMgr ) {
222  m_log << MSG::ERROR << "Could not get AlgManager" << endmsg;
223  return StatusCode::FAILURE;
224  }
225 
226  size_t count = 0;
227  for (auto ialg: algMgr->getAlgorithms()) {
228  Algorithm* alg = dynamic_cast<Algorithm*>(ialg);
229  if ( !alg ) {
230  m_log << MSG::WARNING << "Algorithm " << ialg->name()
231  << " does not inherit from Algorithm. Not registering it."
232  << endmsg;
233  } else {
234  ++count;
235  registerAlg( *alg ).ignore();
236  }
237  }
238 
239  m_log << MSG::INFO << "Registered " << count << " Algorithms" << endmsg;
240 
241 
242 
244 
245  m_isInitialized = true;
246  for (auto algtool: m_ialgtools) {
247  (const_cast<IAlgTool*>(algtool))->addRef();
248  registerAlgTool(*algtool).ignore();
249  }
250 
251  m_log << MSG::INFO << "Registered " << m_algtoolmap.size() << " AlgTools"
252  << endmsg;
253 
255 
256  for (auto svc: Gaudi::svcLocator()->getServices()) {
257  svc->addRef();
258  registerSvc(*svc).ignore();
259  }
260 
261  m_log << MSG::INFO;
262  m_log << "Registered " << Gaudi::svcLocator()->getServices().size() << " Services" << endmsg;
263 
264  return StatusCode::SUCCESS;
265 
266 
267 }
virtual const std::vector< const Property * > * getProperties(const std::string &client) const =0
Get the properties associated to a given client.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
virtual std::vector< std::string > getClients() const =0
Get the list of clients.
SmartIF< IFace > as()
Definition: ISvcLocator.h:106
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
JobHistory class definition.
Definition: JobHistory.h:24
Main interface for the JobOptions service.
GAUDI_API ISvcLocator * svcLocator()
bool m_isInitialized
Definition: HistorySvc.h:102
virtual StatusCode registerSvc(const IService &)
Definition: HistorySvc.cpp:600
virtual StatusCode registerAlgTool(const IAlgTool &)
Definition: HistorySvc.cpp:684
virtual StatusCode registerAlg(const Algorithm &)
Definition: HistorySvc.cpp:320
MsgStream m_log
Definition: HistorySvc.h:138
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
virtual const std::list< IService * > & getServices() const =0
Get a reference to a service and create it if it does not exists.
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:110
void ignore() const
Definition: StatusCode.h:108
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:118
void HistorySvc::clearState ( )
private

Definition at line 115 of file HistorySvc.cpp.

115  {
116  clear(m_algmap);
117 
118  m_ialgtools.clear();
119  clear(m_algtoolmap);
120 
121  clear(m_svcmap);
122 }
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:108
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:110
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:112
DataHistory * HistorySvc::createDataHistoryObj ( const CLID id,
const std::string &  key,
const std::string &  store 
)
virtual

Definition at line 495 of file HistorySvc.cpp.

496  {
497 
498  if (!m_activate) return nullptr;
499 
500 
501  AlgorithmHistory *algHist = nullptr;
502 
503  IAlgorithm* ialg = getCurrentIAlg();
504  if ( !ialg ) {
505  ON_DEBUG
506  m_log << MSG::DEBUG
507  << "Could not discover current Algorithm:" << endl
508  << " object CLID: " << id << " key: \"" << key
509  << "\"" << endmsg;
510  algHist = nullptr;
511  } else {
512  Algorithm* alg = dynamic_cast<Algorithm*>(ialg);
513  if ( alg ) {
514  algHist = getAlgHistory( *alg );
515  } else {
517  << "Could not extract concrete Algorithm:"
518  << endl
519  << " object CLID: " << id << " key: \"" << key
520  << "\"" << endmsg;
521  algHist = nullptr;
522  }
523  }
524  return new DataHistory(id, key, algHist);
525 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
AlgorithmHistory class definition.
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:484
bool m_activate
Definition: HistorySvc.h:104
#define ON_DEBUG
Definition: HistorySvc.cpp:40
DataHistory class definition.
Definition: DataHistory.h:23
virtual AlgorithmHistory * getAlgHistory(const Algorithm &) const
Definition: HistorySvc.cpp:381
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:23
MsgStream m_log
Definition: HistorySvc.h:138
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
std::string HistorySvc::dumpProp ( const Property prop,
const bool  isXML = false,
int  indent = 0 
) const
private

Definition at line 797 of file HistorySvc.cpp.

797  {
798  std::ostringstream ost;
799  if (isXML) {
800  while (ind > 0) {
801  ost << " ";
802  ind --;
803  }
804  ost << "<PROPERTY name=\"" << prop->name()
805  << "\" value=\"" << HistoryObj::convert_string(prop->toString())
806  << "\" documentation=\"" << HistoryObj::convert_string(prop->documentation())
807  << "\">";
808  } else {
809  prop->fillStream(ost);
810  }
811  return ost.str();
812 }
virtual std::string toString() const =0
value -> string
const std::string & name() const
property name
Definition: Property.h:45
const std::string & documentation() const
property documentation
Definition: Property.h:47
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:111
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:21
void HistorySvc::dumpProperties ( std::ofstream &  ofs) const
private

Definition at line 456 of file HistorySvc.cpp.

456  {
457 
458  ofs << "GLOBAL" << std::endl;
459  for (const auto & prop : m_jobHistory->propertyPairs() ) {
460  ofs << prop.first << " " << dumpProp(prop.second) << std::endl;
461  }
462 
463  ofs << std::endl << "SERVICES" << std::endl;
464  for (const auto &s : m_svcmap ) dumpProperties( *s.first, ofs );
465 
466  ofs << std::endl << "ALGORITHMS" << std::endl;
467  for (const auto & alg : m_algmap ) dumpProperties( *alg.first, ofs );
468 
469  ofs << std::endl << "ALGTOOLS" << std::endl;
470  for (const auto& tool : m_algtoolmap ) dumpProperties( *tool.first, ofs );
471 
472 }
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:797
void dumpProperties(std::ofstream &) const
Definition: HistorySvc.cpp:456
string s
Definition: gaudirun.py:245
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:108
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:112
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:118
void HistorySvc::dumpProperties ( const IService svc,
std::ofstream &  ofs 
) const
private

Definition at line 669 of file HistorySvc.cpp.

669  {
670 
671  ServiceHistory *hist = getServiceHistory( svc );
672 
673  if ( !hist ) return;
674 
675  for (auto &prop: hist->properties()) {
676  ofs << svc.name() << " " << dumpProp(prop) << std::endl;
677  }
678 
679 }
virtual ServiceHistory * getServiceHistory(const IService &) const
Definition: HistorySvc.cpp:632
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:797
const PropertyList & properties() const
ServiceHistory class definition.
void HistorySvc::dumpProperties ( const Algorithm alg,
std::ofstream &  ofs 
) const
private

Definition at line 364 of file HistorySvc.cpp.

364  {
365 
366  AlgorithmHistory *hist = getAlgHistory( alg );
367 
368  if ( !hist ) {
369  return;
370  }
371 
372  PropertyList::const_iterator itr;
373  for (auto prop: hist->properties()) {
374  ofs << alg.name() << " " << dumpProp(prop) << std::endl;
375  }
376 
377 }
AlgorithmHistory class definition.
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:919
virtual AlgorithmHistory * getAlgHistory(const Algorithm &) const
Definition: HistorySvc.cpp:381
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:797
const PropertyList & properties() const
void HistorySvc::dumpProperties ( const IAlgTool alg,
std::ofstream &  ofs 
) const
private

Definition at line 744 of file HistorySvc.cpp.

744  {
745 
746  AlgToolHistory *hist = getAlgToolHistory( alg );
747 
748  if ( !hist ) return;
749 
750  for (auto& prop: hist->properties()) {
751  ofs << alg.name() << " " << dumpProp(prop) << std::endl;
752  }
753 
754 }
virtual AlgToolHistory * getAlgToolHistory(const IAlgTool &) const
Definition: HistorySvc.cpp:759
const PropertyList & properties() const
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:797
AlgToolHistory class definition.
void HistorySvc::dumpState ( std::ofstream &  ofs) const
private

Definition at line 817 of file HistorySvc.cpp.

817  {
818 
819 
820  if(m_outputFileTypeXML) {
821  //xml header
822  ofs << "<?xml version=\"1.0\" ?> " << std::endl;
823  ofs << "<!--Test-xml-->" << std::endl;
824  ofs << "<SETUP>" << std::endl;
825  ofs << " <GLOBAL>" << std::endl;
826  } else {
827  ofs << "GLOBAL" << std::endl;
828  }
829 
830  std::string client_currently_open = "start";
831  for (auto& item: m_jobHistory->propertyPairs()) {
832  // client is the name of the component of the current property
833  const std::string& client = item.first;
834  const Property* prp = item.second;
835 
836  if (m_outputFileTypeXML) {
837 
838  if (client != client_currently_open) {
839  if(client_currently_open!="start") ofs << " </COMPONENT>" << endl;
840  ofs << " <COMPONENT name=\""
841  << client << "\" class=\"undefined\">" << std::endl;
842  }
843  } else {
844  ofs << client << " ";
845  }
846 
847  ofs << dumpProp(prp,m_outputFileTypeXML,6) << endl;
848 
849  client_currently_open = client;
850 
852  ofs << " </COMPONENT>" << endl;
853  }
854 
855 
856  if(m_outputFileTypeXML) {
857  ofs << "</GLOBAL>" << endl << "<SERVICES>" << endl;
858  } else {
859  ofs << "SERVICES" << std::endl;
860  }
861 
862  for (auto& item: m_svcmap) {
863  const IService* svc = item.first;
864  dumpState(svc, ofs);
865  }
866 
867  if(m_outputFileTypeXML) {
868  ofs << "</SERVICES>" << endl << "<ALGORITHMS> " << endl;
869  } else {
870  ofs << "ALGORITHMS" << std::endl;
871  }
872 
873  for (auto& item: m_algmap) {
874  const Algorithm* alg = item.first;
875  dumpState(alg, ofs);
876  }
877 
878 
879  if(m_outputFileTypeXML) {
880  ofs << "</ALGORITHMS>" << endl << "<ALGTOOLS> " << endl;
881  } else {
882  ofs << "ALGTOOLS" << std::endl;
883  }
884 
885  for (auto& item: m_algtoolmap) {
886  const AlgTool* algtool = item.first;
887  dumpState(algtool, ofs);
888  }
889 
890  if(m_outputFileTypeXML) {
891  ofs << "</ALGTOOLS>" << endl << "</SETUP>" << endl;
892  }
893 
894 }
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
General service interface definition.
Definition: IService.h:18
bool m_outputFileTypeXML
Definition: HistorySvc.h:139
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:797
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:817
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:44
tuple item
print s1,s2
Definition: ana.py:146
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:108
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:112
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:118
void HistorySvc::dumpState ( const INamedInterface in,
std::ofstream &  ofs 
) const
private

Definition at line 899 of file HistorySvc.cpp.

899  {
900 
901  HistoryObj *hist = nullptr;
902  IVersHistoryObj *vhist = nullptr;
903 
904  const IService* is = nullptr;
905  const Algorithm* ia = nullptr;
906  const IAlgTool* it = nullptr;
907  if ( (is=dynamic_cast<const IService*>(in)) != nullptr) {
908  ON_VERBOSE
909  m_log << MSG::VERBOSE << in->name() << " is Service" << endmsg;
910  ServiceHistory* o = getServiceHistory( *is );
911  hist = dynamic_cast<HistoryObj*>( o );
912  vhist = dynamic_cast<IVersHistoryObj*>( o );
913  } else if ( (ia = dynamic_cast<const Algorithm*>(in)) != nullptr ) {
914  ON_VERBOSE
915  m_log << MSG::VERBOSE << in->name() << " is Alg" << endmsg;
916  AlgorithmHistory *o = getAlgHistory( *ia );
917  hist = dynamic_cast<HistoryObj*>( o );
918  vhist = dynamic_cast<IVersHistoryObj*>( o );
919  } else if ( (it = dynamic_cast<const IAlgTool*>(in)) != nullptr ) {
920  ON_VERBOSE
921  m_log << MSG::VERBOSE << in->name() << " is AlgTool" << endmsg;
922  AlgToolHistory *o = getAlgToolHistory( *it );
923  hist = dynamic_cast<HistoryObj*>( o );
924  vhist = dynamic_cast<IVersHistoryObj*>( o );
925  } else {
926  m_log << MSG::ERROR
927  << "Could not dcast interface to accepted History Obj type for "
928  << in->name() << endmsg;
929  return;
930  }
931 
932  if ( !hist || !vhist ) {
933  m_log << MSG::ERROR << "Could not dcast recognized object to HistoryObj or IVersHistoryObj. This should never happen."
934  << endmsg;
935  return;
936  }
937 
938  if (m_outputFileTypeXML) {
939  hist->dump(ofs,true);
940  } else {
941  ofs << ">> " << vhist->name() << endl << *hist << endl;
942  }
943 
944 }
virtual ServiceHistory * getServiceHistory(const IService &) const
Definition: HistorySvc.cpp:632
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual void dump(std::ostream &, const bool isXML=false, int indent=0) const =0
AlgorithmHistory class definition.
Base class for History Objects.
Definition: HistoryObj.h:22
virtual const std::string & name() const =0
Retrieve the name of the instance.
virtual AlgToolHistory * getAlgToolHistory(const IAlgTool &) const
Definition: HistorySvc.cpp:759
General service interface definition.
Definition: IService.h:18
bool m_outputFileTypeXML
Definition: HistorySvc.h:139
virtual AlgorithmHistory * getAlgHistory(const Algorithm &) const
Definition: HistorySvc.cpp:381
MsgStream m_log
Definition: HistorySvc.h:138
AlgToolHistory class definition.
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ServiceHistory class definition.
virtual const std::string & name() const =0
#define ON_VERBOSE
Definition: HistorySvc.cpp:41
Interface for Versioned History Objects.
StatusCode HistorySvc::finalize ( )
virtual

Definition at line 298 of file HistorySvc.cpp.

298  {
299 
300  ON_VERBOSE
301  m_log << MSG::VERBOSE << "HistorySvc::finalize()" << endmsg;
302 
303  clearState();
304 
305  StatusCode status = Service::finalize();
306 
307  if ( status.isSuccess() )
308  m_log << MSG::INFO << "Service finalised successfully" << endmsg;
309 
310  return status;
311 
312 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode finalize() override
Definition: Service.cpp:188
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream m_log
Definition: HistorySvc.h:138
#define ON_VERBOSE
Definition: HistorySvc.cpp:41
void clearState()
Definition: HistorySvc.cpp:115
AlgorithmHistory * HistorySvc::getAlgHistory ( const Algorithm alg) const
virtual

Definition at line 381 of file HistorySvc.cpp.

381  {
382 
383  auto itr = m_algmap.find( &alg );
384  if ( itr == m_algmap.end() ) {
385  m_log << MSG::WARNING << "Algorithm " << alg.name() << " not registered"
386  << endmsg;
387  return nullptr;
388  }
389  return itr->second;
390 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:919
MsgStream m_log
Definition: HistorySvc.h:138
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:108
void HistorySvc::getAlgHistory ( std::set< AlgorithmHistory * > &  algs) const
virtual

Definition at line 394 of file HistorySvc.cpp.

394  {
395  map_to_set(m_algmap, algs);
396 }
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:108
AlgToolHistory * HistorySvc::getAlgToolHistory ( const IAlgTool alg) const
virtual

Definition at line 759 of file HistorySvc.cpp.

759  {
760 
761  const AlgTool *palg = dynamic_cast<const AlgTool*>(&alg);
762  auto itr = m_algtoolmap.find(palg);
763  if ( itr == m_algtoolmap.end() ) {
764  m_log << MSG::WARNING << "AlgTool " << alg.name() << " not registered"
765  << endmsg;
766  return nullptr;
767  }
768  return itr->second;
769 
770 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
MsgStream m_log
Definition: HistorySvc.h:138
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:44
void HistorySvc::getAlgToolHistory ( std::set< AlgToolHistory * > &  algs) const
virtual

Definition at line 775 of file HistorySvc.cpp.

775  {
776  map_to_set(m_algtoolmap, algs);
777 }
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
IAlgorithm * HistorySvc::getCurrentIAlg ( ) const
private

Definition at line 484 of file HistorySvc.cpp.

484  {
485  if ( p_algCtxSvc ) return p_algCtxSvc->currentAlg();
486  m_log << MSG::WARNING << "trying to create DataHistoryObj before "
487  << "HistorySvc has been initialized" << endmsg;
488  return nullptr;
489 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:106
MsgStream m_log
Definition: HistorySvc.h:138
virtual IAlgorithm * currentAlg() const =0
accessor to current algorithm:
DataHistory * HistorySvc::getDataHistory ( const CLID id,
const std::string &  key,
const std::string &  store 
) const
virtual

Definition at line 566 of file HistorySvc.cpp.

567  {
568 
569  DHH dhh(id,key);
570 
571  auto mitr = m_datMap.equal_range(dhh);
572  return (mitr.first != mitr.second) ? mitr.first->second
573  : nullptr ;
574 
575 }
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:114
int HistorySvc::getDataHistory ( const CLID id,
const std::string &  key,
const std::string &  storeName,
std::list< DataHistory * > &  dhlist 
) const
virtual

Definition at line 580 of file HistorySvc.cpp.

582  {
583 
584  DHH dhh(id,key);
585 
586  int n(0);
587 
588  auto mitr = m_datMap.equal_range(dhh);
589  for (auto itr=mitr.first; itr != mitr.second; ++itr) {
590  dhlist.push_back(itr->second);
591  ++n;
592  }
593  return n;
594 
595 }
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:114
JobHistory * HistorySvc::getJobHistory ( ) const
virtual

Definition at line 476 of file HistorySvc.cpp.

476  {
477 
478  return m_jobHistory.get();
479 
480 }
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:118
ServiceHistory * HistorySvc::getServiceHistory ( const IService svc) const
virtual

Definition at line 632 of file HistorySvc.cpp.

632  {
633 
634  const IService *psvc = &svc;
635  auto itr = m_svcmap.find(psvc);
636  if ( itr != m_svcmap.end() ) return itr->second;
637 
638  m_log << MSG::WARNING << "Service " << svc.name() << " not registered"
639  << endmsg;
640  return nullptr;
641 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
General service interface definition.
Definition: IService.h:18
MsgStream m_log
Definition: HistorySvc.h:138
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:112
void HistorySvc::getServiceHistory ( std::set< ServiceHistory * > &  svcs) const
virtual

Definition at line 645 of file HistorySvc.cpp.

645  {
646  map_to_set(m_svcmap, svcs);
647 }
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:112
void HistorySvc::handle ( const Incident inc)
virtual

Definition at line 782 of file HistorySvc.cpp.

782  {
783 
784  if (incident.type() == IncidentType::BeginEvent) {
785  if (captureState().isFailure()) {
786  m_log << MSG::WARNING << "Error capturing state." << endl
787  << "Will try again at next BeginEvent incident" << endmsg;
788  }
789  }
790 
791 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
MsgStream m_log
Definition: HistorySvc.h:138
virtual StatusCode captureState()
Definition: HistorySvc.cpp:184
StatusCode HistorySvc::initialize ( )
virtual

Definition at line 127 of file HistorySvc.cpp.

127  {
128 
129  StatusCode status = Service::initialize();
130  m_log.setLevel( m_outputLevel.value() );
131 
132  if (status.isFailure()) {
133 
134  ON_DEBUG
135  m_log << MSG::DEBUG << "Failed to initialize the base class (Service)"
136  << endmsg;
137  return status;
138  }
139 
140  ON_DEBUG
141  m_log << MSG::DEBUG << "Initializing HistorySvc" << endmsg;
142 
143  if (!m_activate) return StatusCode::SUCCESS;
144 
145  static const bool CREATEIF(true);
146 
147  if ( service("AlgContextSvc",p_algCtxSvc,CREATEIF).isFailure() ) {
148  m_log << MSG::ERROR << "unable to get the AlgContextSvc" << endmsg;
149  return StatusCode::FAILURE;
150  }
151 
152  if (service("IncidentSvc", m_incidentSvc, CREATEIF).isFailure()) {
153  m_log << MSG::ERROR << "unable to get the IncidentSvc" << endmsg;
154  return StatusCode::FAILURE;
155  }
156 
157  // create a weak dependency on the ToolSvc, so that it doesn't get deleted
158  // before we're done with it in finalize
159  m_toolSvc = serviceLocator()->service("ToolSvc");
160  if (! m_toolSvc) {
161  m_log << MSG::ERROR << "could not retrieve the ToolSvc handle !"
162  << endmsg;
163  return StatusCode::FAILURE;
164  }
165 
166  // add listener to be triggered by first BeginEvent with low priority
167  // so it gets called first
168  const bool rethrow = false;
169  const bool oneShot = true; // make the listener called only once
170  m_incidentSvc->addListener(this,IncidentType::BeginEvent,
171  std::numeric_limits<long>::min(),rethrow,oneShot);
172 
173  m_outputFileTypeXML = ba::iends_with( m_outputFile, ".xml");
175  m_log << MSG::DEBUG << "output format is XML" << endmsg;
176  }
177 
178  m_isInitialized = true;
179 
180  return StatusCode::SUCCESS;
181 }
StatusCode initialize() override
Definition: Service.cpp:63
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IToolSvc > m_toolSvc
Definition: HistorySvc.h:136
std::string m_outputFile
Definition: HistorySvc.h:120
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
bool m_activate
Definition: HistorySvc.h:104
bool m_isInitialized
Definition: HistorySvc.h:102
#define ON_DEBUG
Definition: HistorySvc.cpp:40
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
bool m_outputFileTypeXML
Definition: HistorySvc.h:139
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:106
MsgStream m_log
Definition: HistorySvc.h:138
IIncidentSvc * m_incidentSvc
Definition: HistorySvc.h:135
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
void setLevel(int level)
Update outputlevel.
Definition: MsgStream.h:106
StatusCode HistorySvc::listProperties ( ) const
virtual

Definition at line 412 of file HistorySvc.cpp.

412  {
413 
414  m_log << MSG::INFO;
416  m_log << "Dumping properties for all Algorithms (" << m_algmap.size()
417  << ")" << endmsg;
418 
419  for (auto& alg: m_algmap) {
420  listProperties(*alg.first).ignore();
421  }
422 
423  m_log << MSG::INFO;
425  m_log << "Dumping properties for all AlgTools (" << m_algtoolmap.size()
426  << ")" << endmsg;
427 
428  for (auto& algtool: m_algtoolmap) {
429  ON_DEBUG
430  m_log << MSG::DEBUG << " --> " << algtool.second->algtool_name() << endmsg;
431  listProperties(*algtool.first).ignore();
432  }
433 
434  m_log << MSG::INFO;
436  m_log << "Dumping properties for all Services (" << m_svcmap.size()
437  << ")" << endmsg;
438 
439  for (auto& svc: m_svcmap) {
440  listProperties(*svc.first).ignore();
441  }
442 
443  m_log << MSG::INFO;
445  m_log << "Dumping properties for Job";
446  m_log.resetColor();
447 
448  m_log << std::endl << *m_jobHistory << endmsg;
449 
450  return StatusCode(StatusCode::SUCCESS,true);
451 
452 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API void resetColor()
Reset the colors to defaults.
Definition: MsgStream.cpp:108
virtual StatusCode listProperties() const
Definition: HistorySvc.cpp:412
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
GAUDI_API void setColor(MSG::Color col)
Set the text color.
Definition: MsgStream.cpp:81
#define ON_DEBUG
Definition: HistorySvc.cpp:40
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream m_log
Definition: HistorySvc.h:138
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:108
void ignore() const
Definition: StatusCode.h:108
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:112
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:118
StatusCode HistorySvc::listProperties ( const IService svc) const
virtual

Definition at line 652 of file HistorySvc.cpp.

652  {
653 
654  m_log << MSG::INFO << "Dumping properties for " << svc.name() << endl;
655 
656  ServiceHistory *hist = getServiceHistory( svc );
657 
658  if ( !hist ) return StatusCode::FAILURE;
659 
660  m_log << MSG::INFO << svc.name() << " --> " << endl << *hist << endmsg;
661 
662  return StatusCode(StatusCode::SUCCESS,true);
663 
664 }
virtual ServiceHistory * getServiceHistory(const IService &) const
Definition: HistorySvc.cpp:632
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream m_log
Definition: HistorySvc.h:138
ServiceHistory class definition.
StatusCode HistorySvc::listProperties ( const Algorithm alg) const
virtual

Definition at line 346 of file HistorySvc.cpp.

346  {
347 
348  m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl;
349 
350  AlgorithmHistory *hist = getAlgHistory( alg );
351 
352  if ( !hist ) {
353  return StatusCode::FAILURE;
354  }
355 
356  m_log << MSG::INFO << alg.name() << " --> " << endl << *hist << endmsg;
357 
358  return StatusCode(StatusCode::SUCCESS,true);
359 
360 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
AlgorithmHistory class definition.
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:919
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual AlgorithmHistory * getAlgHistory(const Algorithm &) const
Definition: HistorySvc.cpp:381
MsgStream m_log
Definition: HistorySvc.h:138
StatusCode HistorySvc::listProperties ( const IAlgTool alg) const
virtual

Definition at line 727 of file HistorySvc.cpp.

727  {
728 
729  m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl;
730 
731  AlgToolHistory *hist = getAlgToolHistory( alg );
732 
733  if ( !hist ) return StatusCode::FAILURE;
734 
735 
736  m_log << MSG::INFO << alg.name() << " --> " << endl << *hist << endmsg;
737 
738  return StatusCode::SUCCESS;
739 
740 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual AlgToolHistory * getAlgToolHistory(const IAlgTool &) const
Definition: HistorySvc.cpp:759
MsgStream m_log
Definition: HistorySvc.h:138
AlgToolHistory class definition.
StatusCode HistorySvc::registerAlg ( const Algorithm alg)
virtual

Definition at line 320 of file HistorySvc.cpp.

320  {
321 
322  JobHistory *job = getJobHistory();
323  if (m_algmap.find(&alg) != m_algmap.end()) {
324  m_log << MSG::WARNING << "Algorithm " << alg.name()
325  << " already registered with HistorySvc" << endmsg;
326  return StatusCode::SUCCESS;
327  }
328 
329  (const_cast<Algorithm*>(&alg))->addRef();
330 
331  m_algmap[&alg] = new AlgorithmHistory(alg, job);
332 
333  ON_DEBUG {
334  m_log << MSG::DEBUG << "Registering algorithm: ";
336  m_log << alg.name() << endmsg;
337  m_log.resetColor();
338  }
339 
340  return StatusCode(StatusCode::SUCCESS,true);
341 
342 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API void resetColor()
Reset the colors to defaults.
Definition: MsgStream.cpp:108
AlgorithmHistory class definition.
JobHistory class definition.
Definition: JobHistory.h:24
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:919
GAUDI_API void setColor(MSG::Color col)
Set the text color.
Definition: MsgStream.cpp:81
#define ON_DEBUG
Definition: HistorySvc.cpp:40
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream m_log
Definition: HistorySvc.h:138
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:108
virtual JobHistory * getJobHistory() const
Definition: HistorySvc.cpp:476
StatusCode HistorySvc::registerAlgTool ( const IAlgTool ialg)
virtual

Definition at line 684 of file HistorySvc.cpp.

684  {
685 
686  if (! m_isInitialized) {
687  if ( !p_algCtxSvc ) {
688  if ( service("AlgContextSvc",p_algCtxSvc,true).isFailure() ) {
689  m_log << MSG::ERROR << "unable to get the AlgContextSvc" << endmsg;
690  return StatusCode::FAILURE;
691  }
692  }
693  m_ialgtools.insert(&ialg);
694  return StatusCode::SUCCESS;
695  }
696 
697  const AlgTool *alg = dynamic_cast<const AlgTool*>( &ialg );
698  if ( !alg ) {
699  m_log << MSG::ERROR << "Could not dcast IAlgTool \"" << ialg.name()
700  << "\" to an AlgTool" << endmsg;
701  return StatusCode::FAILURE;
702  }
703 
704  if (m_algtoolmap.find(alg) != m_algtoolmap.end()) {
705  m_log << MSG::WARNING << "AlgTool " << ialg.name()
706  << " already registered in HistorySvc" << endmsg;
707  return StatusCode::SUCCESS;
708  }
709 
710  const JobHistory *job = getJobHistory();
711  m_algtoolmap[alg] = new AlgToolHistory(*alg, job);
712 
713  if (m_log.level() <= MSG::DEBUG) {
714  m_log << MSG::DEBUG << "Registering algtool: ";
716  m_log << alg->name() << endmsg;
717  m_log.resetColor();
718  }
719 
720  return StatusCode::SUCCESS;
721 
722 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API void resetColor()
Reset the colors to defaults.
Definition: MsgStream.cpp:108
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:111
JobHistory class definition.
Definition: JobHistory.h:24
GAUDI_API void setColor(MSG::Color col)
Set the text color.
Definition: MsgStream.cpp:81
bool m_isInitialized
Definition: HistorySvc.h:102
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:106
MsgStream m_log
Definition: HistorySvc.h:138
AlgToolHistory class definition.
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:44
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:110
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:64
virtual JobHistory * getJobHistory() const
Definition: HistorySvc.cpp:476
StatusCode HistorySvc::registerDataHistory ( const CLID id,
const std::string &  key,
const std::string &  store 
)
virtual

Definition at line 529 of file HistorySvc.cpp.

530  {
531 
532  DHH dhh(id,key);
533 
534  auto boundaries = m_datMap.equal_range(dhh);
535  auto match = boundaries.second;
536 
537  if (boundaries.first != boundaries.second) {
538  // there is something in the map, let's look for the specific entry
539 
540  std::string algName;
541  IAlgorithm *ialg = getCurrentIAlg();
542  if (ialg) {
543  algName = ialg->name();
544  } else {
545  algName = "UNKNOWN";
546  }
547 
548  match = std::find_if(boundaries.first, boundaries.second,
549  [&algName](decltype(boundaries)::first_type::reference p) -> bool {
550  return p.second->algorithmHistory()->algorithm_name() == algName;
551  });
552  }
553 
554  if (match == boundaries.second) { // not found, crete the entry
555  DataHistory *dh = createDataHistoryObj(id, key, storeName);
556  m_datMap.insert(pair<DHH, DataHistory*>(dhh,dh));
557  }
558 
559  return StatusCode::SUCCESS;
560 
561 }
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:114
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:484
DataHistory class definition.
Definition: DataHistory.h:23
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:23
virtual DataHistory * createDataHistoryObj(const CLID &id, const std::string &key, const std::string &store)
Definition: HistorySvc.cpp:495
TO * reference(FROM *from)
Definition: KeyedObject.cpp:20
StatusCode HistorySvc::registerJob ( )
virtual

Definition at line 401 of file HistorySvc.cpp.

401  {
402 
403 
404  return StatusCode(StatusCode::SUCCESS,true);
405 
406 
407 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode HistorySvc::registerSvc ( const IService svc)
virtual

Definition at line 600 of file HistorySvc.cpp.

600  {
601 
602  if ( svc.name() == "HistoryStore" ) {
603  // m_log << MSG::WARNING << "not registering store" << endmsg;
604  return StatusCode(StatusCode::SUCCESS,true);
605  }
606 
607  JobHistory *job = getJobHistory();
608  const IService* psvc = &svc;
609  auto itr = m_svcmap.find(psvc);
610  if (itr == m_svcmap.end()) {
611 
612  if (m_log.level() <= MSG::DEBUG) {
613  m_log << MSG::DEBUG << "Registering Service: ";
615  m_log << svc.name() << endmsg;
616  }
617 
618  m_svcmap[psvc] = new ServiceHistory(&svc, job);
619 
620  (const_cast<IService*>(psvc))->addRef();
621 
622  }
623 
624  m_log.resetColor();
625  return StatusCode(StatusCode::SUCCESS,true);
626 
627 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API void resetColor()
Reset the colors to defaults.
Definition: MsgStream.cpp:108
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
JobHistory class definition.
Definition: JobHistory.h:24
GAUDI_API void setColor(MSG::Color col)
Set the text color.
Definition: MsgStream.cpp:81
General service interface definition.
Definition: IService.h:18
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream m_log
Definition: HistorySvc.h:138
ServiceHistory class definition.
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:112
virtual JobHistory * getJobHistory() const
Definition: HistorySvc.cpp:476
StatusCode HistorySvc::reinitialize ( )
virtual

Definition at line 91 of file HistorySvc.cpp.

91  {
92 
93  clearState();
95  return initialize();
96 
97 }
virtual StatusCode initialize()
Definition: HistorySvc.cpp:127
void clearState()
Definition: HistorySvc.cpp:115
StatusCode HistorySvc::stop ( )
virtual

Definition at line 271 of file HistorySvc.cpp.

271  {
272 
273  if (!m_activate) return StatusCode::SUCCESS;
274 
275  if (m_dump) {
277  }
278 
279  if (!m_outputFile.empty()) {
280  std::ofstream ofs(m_outputFile);
281  if (!ofs) {
282  m_log << MSG::ERROR << "Unable to open output file \"m_outputFile\""
283  << endmsg;
284  } else {
285  // dumpProperties(ofs);
286  dumpState(ofs);
287  }
288  }
289 
290  clearState();
291 
292  return StatusCode::SUCCESS;
293 
294 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode listProperties() const
Definition: HistorySvc.cpp:412
std::string m_outputFile
Definition: HistorySvc.h:120
bool m_activate
Definition: HistorySvc.h:104
MsgStream m_log
Definition: HistorySvc.h:138
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:817
bool m_dump
Definition: HistorySvc.h:103
void ignore() const
Definition: StatusCode.h:108
void clearState()
Definition: HistorySvc.cpp:115

Member Data Documentation

bool HistorySvc::m_activate = true
private

Definition at line 104 of file HistorySvc.h.

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

Definition at line 108 of file HistorySvc.h.

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

Definition at line 111 of file HistorySvc.h.

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

Definition at line 114 of file HistorySvc.h.

bool HistorySvc::m_dump = false
private

Definition at line 103 of file HistorySvc.h.

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

Definition at line 110 of file HistorySvc.h.

IIncidentSvc* HistorySvc::m_incidentSvc = nullptr
private

Definition at line 135 of file HistorySvc.h.

bool HistorySvc::m_isInitialized = false
private

Definition at line 102 of file HistorySvc.h.

std::unique_ptr<JobHistory> HistorySvc::m_jobHistory
private

Definition at line 118 of file HistorySvc.h.

MsgStream HistorySvc::m_log
mutableprivate

Definition at line 138 of file HistorySvc.h.

std::string HistorySvc::m_outputFile
private

Definition at line 120 of file HistorySvc.h.

bool HistorySvc::m_outputFileTypeXML = false
private

Definition at line 139 of file HistorySvc.h.

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

Definition at line 112 of file HistorySvc.h.

SmartIF<IToolSvc> HistorySvc::m_toolSvc
private

Definition at line 136 of file HistorySvc.h.

IAlgContextSvc* HistorySvc::p_algCtxSvc = nullptr
private

Definition at line 106 of file HistorySvc.h.


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