46 const std::string& algname,
55 std::string actualalgtype(algtype);
57 if ((actualalgtype.size() > 8) && (actualalgtype.substr(0, 8) ==
"unalias:")) {
58 actualalgtype = actualalgtype.substr(8);
62 actualalgtype = typeAlias->second;
65 algorithm = Algorithm::Factory::create(actualalgtype, algname,
serviceLocator().
get());
69 fatal() <<
"Incompatible interface IAlgorithm version for " << actualalgtype <<
endmsg;
86 this->
error() <<
"Failed to initialize algorithm: [" << algname <<
"]" <<
endmsg;
91 this->
error() <<
"Algorithm of type " << actualalgtype
92 <<
" is unknown (No factory available)." <<
endmsg;
100 this->
error() <<
"More information may be available by setting the global jobOpt \"PluginDebugLevel\" to 1" <<
endmsg;
108 return it->algorithm;
132 [](ListAlg::const_reference alg) {
133 return const_cast<IAlgorithm*
>(alg.algorithm.get());
140 ListAlg::iterator it;
142 if (!it->managed)
continue;
143 rc = it->algorithm->sysInitialize();
151 ListAlg::iterator it;
153 if (!it->managed)
continue;
154 rc = it->algorithm->sysStart();
162 ListAlg::iterator it;
164 if (!it->managed)
continue;
165 rc = it->algorithm->sysStop();
173 ListAlg::iterator it =
m_listalg.begin();
176 rc = it->algorithm->sysFinalize();
188 ListAlg::iterator it;
190 if (!it->managed)
continue;
191 rc = it->algorithm->sysReinitialize();
193 this->
error() <<
"Unable to re-initialize algorithm: " << it->algorithm->name() <<
endmsg;
202 ListAlg::iterator it;
204 if (!it->managed)
continue;
205 rc = it->algorithm->sysRestart();
207 this->
error() <<
"Unable to re-initialize algorithm: " << it->algorithm->name() <<
endmsg;
const std::string & name() const
Return the name of the manager (implementation of INamedInterface)
virtual SmartIF< ISvcLocator > & serviceLocator() const
Needed to locate the message service.
virtual StatusCode sysStart()=0
Startup method invoked by the framework.
AlgTypeAliasesMap m_algTypeAliases
bool isSuccess() const
Test for a status code of SUCCESS.
std::vector< IAlgorithm * > m_listOfPtrs
List of pointers to the know services used to implement getAlgorithms()
bool isValidInterface(I *i)
Templated function that throws an exception if the version if the interface implemented by the object...
virtual SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
Returns a smart pointer to a service.
bool isFailure() const
Test for a status code of FAILURE.
virtual bool existsAlgorithm(const std::string &name) const
implementation of IAlgManager::existsAlgorithm
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
virtual StatusCode sysInitialize()=0
Initialization method invoked by the framework.
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual const std::vector< IAlgorithm * > & getAlgorithms() const
implementation of IAlgManager::getAlgorithms
ListAlg m_listalg
List of algorithms maintained by AlgorithmManager.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Helper class to parse a string of format "type/name".
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
virtual StatusCode addAlgorithm(IAlgorithm *alg)
implementation of IAlgManager::addAlgorithm
virtual StatusCode restart()
Initialization (from RUNNING to RUNNING, via INITIALIZED).
The IAlgorithm is the interface implemented by the Algorithm base class.
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
virtual StatusCode removeAlgorithm(IAlgorithm *alg)
implementation of IAlgManager::removeAlgorithm
virtual unsigned long release()=0
Release Interface instance.
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
const std::string & type() const
virtual StatusCode createAlgorithm(const std::string &algtype, const std::string &algname, IAlgorithm *&algorithm, bool managed=false)
implementation of IAlgManager::createAlgorithm
Templated class to add the standard messaging functionalities.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
AlgorithmManager(IInterface *iface)
default creator
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
const std::string & name() const
std::string typeName(const std::type_info &typ)
virtual ~AlgorithmManager()
virtual destructor
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.