35 if ( it !=
m_algs.end() ) {
47 if ( checkIfExists ) {
55 if ( ( actualalgtype.
size() > 8 ) && ( actualalgtype.
compare( 0, 8,
"unalias:" ) == 0 ) ) {
56 actualalgtype = actualalgtype.
substr( 8 );
60 actualalgtype = typeAlias->second;
63 algorithm = Algorithm::Factory::create( actualalgtype, algname,
serviceLocator().
get() ).release();
65 this->
error() <<
"Algorithm of type " << actualalgtype <<
" is unknown (No factory available)." <<
endmsg;
72 this->
error() <<
"More information may be available by setting the global jobOpt \"PluginDebugLevel\" to 1" 78 fatal() <<
"Incompatible interface IAlgorithm version for " << actualalgtype <<
endmsg;
81 m_algs.emplace_back( algorithm, managed );
97 this->
error() <<
"Failed to initialize algorithm: [" << algname <<
"]" <<
endmsg;
106 if ( it !=
m_algs.end() ) {
107 return it->algorithm;
137 for (
auto& it :
m_algs ) {
138 if ( !it.managed )
continue;
139 rc = it.algorithm->sysInitialize();
148 for (
auto& it :
m_algs ) {
149 if ( !it.managed )
continue;
150 rc = it.algorithm->sysStart();
159 for (
auto& it :
m_algs ) {
160 if ( !it.managed )
continue;
161 rc = it.algorithm->sysStop();
171 while ( it !=
m_algs.end() ) {
173 rc = it->algorithm->sysFinalize();
186 for (
auto& it :
m_algs ) {
187 if ( !it.managed )
continue;
188 rc = it.algorithm->sysReinitialize();
190 this->
error() <<
"Unable to re-initialize algorithm: " << it.algorithm->name() <<
endmsg;
202 fatal() <<
"Error retrieving AlgExecStateSvc" <<
endmsg;
208 for (
auto& it :
m_algs ) {
209 if ( !it.managed )
continue;
210 rc = it.algorithm->sysRestart();
213 this->
error() <<
"Unable to re-initialize algorithm: " << it.algorithm->name() <<
endmsg;
223 for (
auto& algItem :
m_algs ) {
224 const auto alg =
dynamic_cast<Algorithm*
>( algItem.algorithm.get() );
void outputLevelUpdate() override
Function to call to update the outputLevel of the components (after a change in MessageSvc).
StatusCode initialize() override
Initialization (from CONFIGURED to INITIALIZED).
constexpr static const auto FAILURE
StatusCode addAlgorithm(IAlgorithm *alg) override
implementation of IAlgManager::addAlgorithm
StatusCode start() override
Start (from INITIALIZED to RUNNING).
const std::string & name() const override
Return the name of the manager (implementation of INamedInterface)
const std::vector< IAlgorithm * > & getAlgorithms() const override
implementation of IAlgManager::getAlgorithms
virtual StatusCode sysStart()=0
Startup method invoked by the framework.
AlgTypeAliasesMap m_algTypeAliases
std::vector< AlgorithmItem > m_algs
algorithms maintained by AlgorithmManager
MSG::Level resetMessaging()
Reinitialize internal states.
std::vector< IAlgorithm * > m_listOfPtrs
List of pointers to the know services used to implement getAlgorithms()
Gaudi::StateMachine::State FSMState() const override
Get the current state.
StatusCode reinitialize() override
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
bool isValidInterface(I *i)
Templated function that throws an exception if the version if the interface implemented by the object...
SmartIF< ISvcLocator > & serviceLocator() const override
StatusCode stop() override
Stop (from RUNNING to INITIALIZED).
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode finalize() override
Finalize (from INITIALIZED to CONFIGURED).
virtual StatusCode sysInitialize()=0
Initialization method invoked by the framework.
TYPE * get() const
Get interface pointer.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Helper class to parse a string of format "type/name".
bool existsAlgorithm(const std::string &name) const override
implementation of IAlgManager::existsAlgorithm
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
StatusCode removeAlgorithm(IAlgorithm *alg) override
implementation of IAlgManager::removeAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
constexpr static const auto SUCCESS
virtual void setType(const std::string &)=0
Base class from which all concrete algorithm classes should be derived.
bool isValid() const
Allow for check if smart pointer is valid.
T back_inserter(T...args)
const std::string & type() const
AlgorithmManager(IInterface *iface)
default creator
SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
const std::string & name() const
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
std::string typeName(const std::type_info &typ)
virtual void resetErrorCount(const IAlgorithm *iAlg)=0
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode createAlgorithm(const std::string &algtype, const std::string &algname, IAlgorithm *&algorithm, bool managed=false, bool checkIfExists=true) override
implementation of IAlgManager::createAlgorithm
SmartIF< IAlgorithm > algorithm
StatusCode restart() override
Initialization (from RUNNING to RUNNING, via INITIALIZED).