ATLAS Offline Software
asg_component_factory_scanner.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 //
9 // includes
10 //
11 
14 #include <fstream>
15 
16 //
17 // program implementation
18 //
19 
20 using namespace asg;
21 using namespace asg::msgComponentConfig;
22 
44 
45 int main (int argc, char **argv)
46 {
47  if (argc != 3)
48  {
49  ATH_MSG_ERROR ("usage: " << argv[0] << " <module path> <output file>");
50  return 1;
51  }
52 
53  const std::string modulePathName = argv[1];
54  const std::string outputFile = argv[2];
55 
56  std::string modulePath, moduleName;
57  {
58  const auto pos = modulePathName.find_last_of ('/');
59  if (pos != std::string::npos)
60  {
61  modulePath = modulePathName.substr (0, pos);
62  moduleName = modulePathName.substr (pos + 1);
63  }
64  else
65  {
66  modulePath = ".";
67  moduleName = modulePathName;
68  }
69  }
70 
71  if (auto types = getLoadedComponentFactoryTypes (); !types.empty())
72  {
73  ANA_MSG_ERROR ("already loaded component factory types:");
74  for (const auto& type : types)
75  ANA_MSG_ERROR (" " << type);
76  return 1;
77  }
78 
79  ATH_MSG_DEBUG ("loading component factory preloader module from " << modulePath << " with name " << moduleName);
80  loadComponentFactoryModule (moduleName, modulePath);
81 
82  std::ofstream outputStream (outputFile);
83  for (auto& type : getLoadedComponentFactoryTypes ())
84  {
85  ANA_MSG_DEBUG ("module loaded type " << type);
86  outputStream << moduleName << " " << type << "\n";
87  }
88 
89  return 0;
90 }
asg
Definition: DataHandleTestTool.h:28
RunGeantinoStepRecordingITk.outputStream
outputStream
Definition: RunGeantinoStepRecordingITk.py:126
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:19
main
int main(int argc, char **argv)
Definition: asg_component_factory_scanner.cxx:45
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
AsgComponentFactories.h
MessageCheckAsgTools.h
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288