Go to the documentation of this file.
40 auto itm = std::find_if(
range.first,
range.second, [&](
auto const& p ) { return p.second == alg; } );
49 IAlgorithm*& algorithm,
bool managed,
bool checkIfExists ) {
51 if ( checkIfExists ) {
57 std::string actualalgtype( algtype );
59 if ( ( actualalgtype.size() > 8 ) && ( actualalgtype.compare( 0, 8,
"unalias:" ) == 0 ) ) {
60 actualalgtype = actualalgtype.substr( 8 );
63 if ( typeAlias !=
m_algTypeAliases.end() ) { actualalgtype = typeAlias->second; }
67 this->error() <<
"Algorithm of type " << actualalgtype <<
" is unknown (No factory available)." <<
endmsg;
71 if ( !err.empty() ) this->error() << err <<
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;
84 algorithm->setType( std::move( actualalgtype ) );
95 if ( !
rc.isSuccess() ) { this->error() <<
"Failed to initialize algorithm: [" << algname <<
"]" <<
endmsg; }
119 std::vector<IAlgorithm*> listOfPtrs;
120 listOfPtrs.reserve(
m_algs.size() );
128 for (
auto& it :
m_algs ) {
130 rc = it.algorithm->sysInitialize();
131 if (
rc.isFailure() )
return rc;
138 for (
auto& it :
m_algs ) {
140 rc = it.algorithm->sysStart();
141 if (
rc.isFailure() )
return rc;
148 for (
auto& it :
m_algs ) {
149 if ( !it.managed )
continue;
150 rc = it.algorithm->sysStop();
151 if (
rc.isFailure() )
return rc;
159 while ( it !=
m_algs.end() ) {
162 auto itm = std::find_if(
range.first,
range.second, [&](
auto const& p ) { return p.second == it->algorithm; } );
165 rc = it->algorithm->sysFinalize();
166 if (
rc.isFailure() )
return rc;
179 for (
auto& it :
m_algs ) {
180 if ( !it.managed )
continue;
181 rc = it.algorithm->sysReinitialize();
182 if (
rc.isFailure() ) {
183 this->error() <<
"Unable to re-initialize algorithm: " << it.algorithm->name() <<
endmsg;
194 fatal() <<
"Error retrieving AlgExecStateSvc" <<
endmsg;
200 for (
auto& it :
m_algs ) {
201 if ( !it.managed )
continue;
202 rc = it.algorithm->sysRestart();
203 m_aess->resetErrorCount( it.algorithm );
204 if (
rc.isFailure() ) {
205 this->error() <<
"Unable to re-initialize algorithm: " << it.algorithm->name() <<
endmsg;
214 for (
auto& algItem :
m_algs ) {
216 if (
alg )
alg->resetMessaging();
Gaudi::StateMachine::State targetFSMState() const override
When we are in the middle of a transition, get the state where the transition is leading us.
AlgTypeAliasesMap m_algTypeAliases
std::unordered_multimap< std::string, SmartIF< IAlgorithm > > m_algsMap
algorithms maintained by AlgorithmManager
bool existsAlgorithm(std::string_view name) const override
implementation of IAlgManager::existsAlgorithm
StatusCode restart() override
Initialization (from RUNNING to RUNNING, via INITIALIZED).
MSG::Level resetMessaging()
Reinitialize internal states.
void outputLevelUpdate() override
Function to call to update the outputLevel of the components (after a change in MessageSvc).
get
decorate the vector of properties
StatusCode finalize() override
Finalize (from INITIALIZED to CONFIGURED).
AttribStringParser::Iterator begin(const AttribStringParser &parser)
bool isValid() const
Allow for check if smart pointer is valid.
Helper class to parse a string of format "type/name".
Base class from which all concrete algorithm classes should be derived.
StatusCode initialize() override
Initialization (from CONFIGURED to INITIALIZED).
std::vector< IAlgorithm * > getAlgorithms() const override
implementation of IAlgManager::getAlgorithms
StatusCode removeAlgorithm(IAlgorithm *alg) override
implementation of IAlgManager::removeAlgorithm
StatusCode start() override
Start (from INITIALIZED to RUNNING).
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
SmartIF< ISvcLocator > & serviceLocator() const override
std::vector< AlgorithmItem > m_algs
algorithms maintained by AlgorithmManager
const std::string & name() const override
Return the name of the manager (implementation of INamedInterface)
SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override
StatusCode addAlgorithm(IAlgorithm *alg) override
implementation of IAlgManager::addAlgorithm
constexpr static const auto SUCCESS
std::string typeName(const std::type_info &typ)
bool isValidInterface(IFace *i)
Templated function that throws an exception if the version if the interface implemented by the object...
AlgorithmManager(IInterface *iface)
default creator
constexpr static const auto FAILURE
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
StatusCode reinitialize() override
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
StatusCode stop() override
Stop (from RUNNING to INITIALIZED).
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
StatusCode createAlgorithm(const std::string &algtype, const std::string &algname, IAlgorithm *&algorithm, bool managed=false, bool checkIfExists=true) override
implementation of IAlgManager::createAlgorithm