ATLAS Offline Software
Loading...
Searching...
No Matches
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
20using namespace asg;
21using namespace asg::msgComponentConfig;
22
44
45int 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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
static const std::vector< std::string > types
int main()
Definition hello.cxx:18