Line data Source code
1 : #include "CLI/CLI.hpp"
2 : #include <fmt/core.h>
3 : #include <fmt/ranges.h>
4 : #include <dlfcn.h>
5 :
6 : #include "conffwk/Configuration.hpp"
7 : #include "conffwk/DalFactory.hpp"
8 : #include "conffwk/Schema.hpp"
9 :
10 :
11 :
12 : int
13 0 : main(int argc, char const* argv[])
14 : {
15 :
16 0 : using namespace dunedaq;
17 :
18 0 : CLI::App app{ "App description" };
19 :
20 0 : std::string file;
21 0 : app.add_option("-f,--file", file, "Schema file")->required()->check(CLI::ExistingFile);
22 :
23 0 : CLI11_PARSE(app, argc, argv);
24 :
25 0 : fmt::print("Configuration database file: {}\n", file);
26 :
27 0 : conffwk::Configuration db("oksconflibs:" + file);
28 :
29 :
30 0 : for ( const auto& class_name : db.get_class_list()) {
31 :
32 0 : auto& c = db.get_class_info(class_name);
33 0 : fmt::print("- {} '{}'\n", class_name, c.p_schema_path);
34 :
35 0 : std::string file = c.p_schema_path;
36 0 : std::string search {"/schema/"};
37 0 : auto start = file.rfind(search) + search.size();
38 0 : auto end = file.find("/", start);
39 :
40 0 : std::string package = file.substr(start,end-start);
41 0 : std::string library = "lib"+package+"_dal.so";
42 0 : fmt::print("Loading library {} from {}\n", library, package);
43 :
44 0 : auto handle = dlopen(library.c_str(), RTLD_LAZY|RTLD_GLOBAL);
45 0 : if (handle == nullptr) {
46 0 : fmt::print("Failed to load {}\n", library);
47 :
48 : // throw (LoadDalFailed(ERS_HERE, library));
49 : }
50 :
51 0 : }
52 0 : }
|