ATLAS Offline Software
Loading...
Searching...
No Matches
FactoryPreloadModule.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8//
9// includes
10//
11
13
15#include <TInterpreter.h>
16#include <TSystem.h>
17#include <ranges>
18
19//
20// method implementations
21//
22
23namespace EL
24{
25 namespace Detail
26 {
28 {
29 std::vector<std::string> preloaderList;
30 for (auto&& part : std::views::split(preloader.value(), ',')) preloaderList.emplace_back(part.begin(), part.end());
31
32 if (preloaderList.size() % 2 != 0)
33 {
34 ANA_MSG_ERROR ("Invalid preloader list");
35 return StatusCode::FAILURE;
36 }
37
38 for (std::size_t iter = 0; iter < preloaderList.size(); iter += 2)
39 {
40 const std::string& libName = preloaderList[iter];
41 const std::string& funcName = preloaderList[iter + 1];
42
43 // TSystem::Load returns 1 when the library is already loaded (e.g.
44 // pulled in via dictionary auto-loading), which is not an error;
45 // only a negative return value indicates an actual failure.
46 if (gSystem->Load(libName.c_str()) < 0)
47 {
48 ANA_MSG_ERROR ("Failed to load library " << libName);
49 return StatusCode::FAILURE;
50 }
51 if (gInterpreter->Calc((funcName + "()").c_str()) != 1)
52 {
53 ANA_MSG_ERROR ("Failed to call function " << funcName << " from library " << libName);
54 return StatusCode::FAILURE;
55 }
56 }
57
58 return StatusCode::SUCCESS;
59 }
60 }
61}
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
Gaudi::Property< std::string > preloader
StatusCode onInitialize(ModuleData &data) override
action just before algorithms are initialized
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
the data the EventLoop core classes are sharing with the Module implementation
Definition ModuleData.h:64