32 #include "boost/algorithm/string/predicate.hpp"
33 namespace ba = boost::algorithm;
40 #define ON_DEBUG if (msgLevel(MSG::DEBUG))
41 #define ON_VERBOSE if (msgLevel(MSG::VERBOSE))
53 template <
typename MAP,
typename SET>
54 inline void map_to_set(
const MAP&
m,
SET&
s) {
71 return (key < rhs.
key);
102 constexpr
struct clear_t {
103 template <
typename T1,
typename T2>
105 const_cast<T1*
>(p.first)->release();
145 static const bool CREATEIF(
true);
168 const bool rethrow =
false;
169 const bool oneShot =
true;
189 if (
service(
"JobOptionsSvc",jo).isFailure()) {
191 <<
"Could not get jobOptionsSvc - "
192 <<
"not adding properties to JobHistory" <<
endmsg;
195 bool foundAppMgr(
false);
198 if (client ==
"ApplicationMgr") foundAppMgr =
true;
205 auto ap = service<IProperty>(
"ApplicationMgr");
209 for (
auto prop: ap->getProperties()) {
227 for (
auto ialg: algMgr->getAlgorithms()) {
231 <<
" does not inherit from Algorithm. Not registering it."
247 (
const_cast<IAlgTool*
>(algtool))->addRef();
325 <<
" already registered with HistorySvc" <<
endmsg;
329 (
const_cast<Algorithm*
>(&alg))->addRef();
372 PropertyList::const_iterator itr;
445 m_log <<
"Dumping properties for Job";
463 ofs << std::endl <<
"SERVICES" <<
std::endl;
466 ofs << std::endl <<
"ALGORITHMS" <<
std::endl;
469 ofs << std::endl <<
"ALGTOOLS" <<
std::endl;
487 <<
"HistorySvc has been initialized" <<
endmsg;
507 <<
"Could not discover current Algorithm:" <<
endl
508 <<
" object CLID: " <<
id <<
" key: \"" << key
517 <<
"Could not extract concrete Algorithm:"
519 <<
" object CLID: " <<
id <<
" key: \"" << key
535 auto match = boundaries.second;
537 if (boundaries.first != boundaries.second) {
543 algName = ialg->name();
548 match =
std::find_if(boundaries.first, boundaries.second,
550 return p.second->algorithmHistory()->algorithm_name() == algName;
554 if (match == boundaries.second) {
572 return (mitr.first != mitr.second) ? mitr.first->second
589 for (
auto itr=mitr.first; itr != mitr.second; ++itr) {
602 if ( svc.name() ==
"HistoryStore" ) {
620 (
const_cast<IService*
>(psvc))->addRef();
700 <<
"\" to an AlgTool" <<
endmsg;
706 <<
" already registered in HistorySvc" <<
endmsg;
784 if (incident.
type() == IncidentType::BeginEvent) {
787 <<
"Will try again at next BeginEvent incident" <<
endmsg;
804 ost <<
"<PROPERTY name=\"" << prop->
name()
822 ofs <<
"<?xml version=\"1.0\" ?> " <<
std::endl;
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;
844 ofs << client <<
" ";
849 client_currently_open = client;
852 ofs <<
" </COMPONENT>" << endl;
857 ofs <<
"</GLOBAL>" <<
endl <<
"<SERVICES>" <<
endl;
868 ofs <<
"</SERVICES>" <<
endl <<
"<ALGORITHMS> " <<
endl;
880 ofs <<
"</ALGORITHMS>" <<
endl <<
"<ALGTOOLS> " <<
endl;
891 ofs <<
"</ALGTOOLS>" <<
endl <<
"</SETUP>" <<
endl;
907 if ( (is=dynamic_cast<const IService*>(in)) !=
nullptr) {
913 }
else if ( (ia = dynamic_cast<const Algorithm*>(in)) !=
nullptr ) {
919 }
else if ( (it = dynamic_cast<const IAlgTool*>(in)) !=
nullptr ) {
927 <<
"Could not dcast interface to accepted History Obj type for "
932 if ( !hist || !vhist ) {
933 m_log <<
MSG::ERROR <<
"Could not dcast recognized object to HistoryObj or IVersHistoryObj. This should never happen."
939 hist->
dump(ofs,
true);
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
virtual StatusCode stop()
StatusCode initialize() override
IntegerProperty m_outputLevel
Service output level.
virtual const std::vector< const Property * > * getProperties(const std::string &client) const =0
Get the properties associated to a given client.
virtual ServiceHistory * getServiceHistory(const IService &) const
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
const std::string & type() const
Access to the incident type.
Gaudi::StateMachine::State m_state
Service state.
SmartIF< IToolSvc > m_toolSvc
GAUDI_API void resetColor()
Reset the colors to defaults.
StatusCode finalize() override
virtual std::string toString() const =0
value -> string
MSG::Level level()
Retrieve output level.
const std::string & name() const
property name
virtual void dump(std::ostream &, const bool isXML=false, int indent=0) const =0
AlgorithmHistory class definition.
bool isSuccess() const
Test for a status code of SUCCESS.
virtual StatusCode registerDataHistory(const CLID &id, const std::string &key, const std::string &store)
virtual StatusCode listProperties() const
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
virtual StatusCode registerJob()
virtual std::vector< std::string > getClients() const =0
Get the list of clients.
Base class for History Objects.
HistorySvc class definition.
DHH(const CLID &i, std::string k)
std::multimap< DHH, DataHistory * > m_datMap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
const std::string & documentation() const
property documentation
JobHistory class definition.
bool isFailure() const
Test for a status code of FAILURE.
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
IAlgorithm * getCurrentIAlg() const
#define DECLARE_COMPONENT(type)
virtual const std::string & name() const =0
Retrieve the name of the instance.
const std::string & name() const override
The identifying name of the algorithm object.
GAUDI_API void setColor(MSG::Color col)
Set the text color.
virtual AlgToolHistory * getAlgToolHistory(const IAlgTool &) const
virtual void handle(const Incident &inc)
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Main interface for the JobOptions service.
GAUDI_API ISvcLocator * svcLocator()
General service interface definition.
virtual StatusCode registerSvc(const IService &)
This class is used for returning status codes from appropriate routines.
HistorySvc(const std::string &name, ISvcLocator *svc)
virtual StatusCode registerAlgTool(const IAlgTool &)
DataHistory class definition.
IAlgContextSvc * p_algCtxSvc
virtual StatusCode registerAlg(const Algorithm &)
virtual StatusCode initialize()
virtual AlgorithmHistory * getAlgHistory(const Algorithm &) const
virtual StatusCode finalize()
const PropertyList & properties() const
unsigned int CLID
Class ID definition.
void addProperty(const std::string &, const Property *)
The IAlgorithm is the interface implemented by the Algorithm base class.
const TYPE & value() const
explicit conversion
const PropertyPairList & propertyPairs() const
std::string dumpProp(const Property *, const bool isXML=false, int indent=0) const
AlgToolHistory class definition.
void dumpState(std::ofstream &) const
const PropertyList & properties() const
IIncidentSvc * m_incidentSvc
virtual DataHistory * createDataHistoryObj(const CLID &id, const std::string &key, const std::string &store)
Base class from which all concrete algorithm classes should be derived.
IInterface compliant class extending IInterface with the name() method.
bool operator<(DHH const &rhs) const
Property base class allowing Property* collections to be "homogeneous".
virtual DataHistory * getDataHistory(const CLID &id, const std::string &key, const std::string &store) const
const PropertyList & properties() const
void dumpProperties(std::ofstream &) const
static std::string convert_string(const std::string &)
Base class for all Incidents (computing events).
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.
ServiceHistory class definition.
virtual const std::string & name() const =0
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
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.
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
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Interface for Versioned History Objects.
virtual IAlgorithm * currentAlg() const =0
accessor to current algorithm:
virtual StatusCode captureState()
TO * reference(FROM *from)
std::map< const IService *, ServiceHistory * > m_svcmap
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual StatusCode reinitialize()
virtual JobHistory * getJobHistory() const
std::unique_ptr< JobHistory > m_jobHistory