LCOV - code coverage report
Current view: top level - dbe/apps - SchemaMain.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 39 0
Test Date: 2026-07-12 15:23:06 Functions: 0.0 % 2 0

            Line data    Source code
       1              : // DUNE DAQ modification notice:
       2              : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
       3              : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
       4              : // Renamed since fork: yes (from src/SchemaEditor/SchemaMain.cpp to apps/SchemaMain.cpp).
       5              : 
       6              : #include "dbe/SchemaMainWindow.hpp"
       7              : #include <QApplication>
       8              : #include <boost/program_options.hpp>
       9              : #include <iostream>
      10              : #include <string>
      11              : 
      12              : namespace bop = boost::program_options;
      13              : 
      14            0 : int main(int argc, char *argv[]) {
      15            0 :     std::string oksfn;
      16              : 
      17            0 :     bop::options_description options_description("Allowed options", 128);
      18              : 
      19            0 :     options_description.add_options()("help,h", "Provide help message")
      20            0 :                                      ("file,f", bop::value<std::string>(&oksfn)->default_value(oksfn), "OKS schema file name");
      21              : 
      22            0 :     bop::variables_map options_map;
      23              : 
      24            0 :     try {
      25            0 :         bop::parsed_options parsed = bop::command_line_parser(argc, argv).options(options_description).allow_unregistered().run();
      26              : 
      27              :         // This is to properly catch any positional argument (not supported)
      28            0 :         const auto& unknown = bop::collect_unrecognized(parsed.options, bop::include_positional);
      29            0 :         if(unknown.size() != 0) {
      30            0 :             std::cerr << "Incorrect command line argument, unrecognized options: ";
      31            0 :             for(const auto& o : unknown) {
      32            0 :                 std::cerr << o << " ";
      33              :             }
      34            0 :             std::cerr << std::endl;
      35              : 
      36              :             return EXIT_FAILURE;
      37              :         }
      38              : 
      39            0 :         bop::store(parsed, options_map);
      40            0 :         bop::notify(options_map);
      41              : 
      42            0 :         auto display_help_message = [&options_description]()
      43              :         {
      44            0 :             std::cout
      45            0 :             << "TDAQ online database schema editor"
      46            0 :             << std::endl
      47            0 :             << std::endl
      48            0 :             << "Usage: schemaeditor [options]"
      49            0 :             << std::endl
      50            0 :             << std::endl
      51            0 :             << options_description
      52            0 :             << std::endl;
      53            0 :         };
      54              : 
      55            0 :         if(options_map.count("help")) {
      56            0 :             display_help_message();
      57              :             return EXIT_SUCCESS;
      58              :         }
      59            0 :     }
      60            0 :     catch(std::exception const & e) {
      61            0 :         std::cerr << "Incorrect command line argument: " << e.what() << std::endl;
      62            0 :         return EXIT_FAILURE;
      63            0 :     }
      64              : 
      65              : 
      66            0 :     QApplication a(argc, argv);
      67              : 
      68            0 :     dbse::SchemaMainWindow w(QString::fromStdString(oksfn));
      69              : 
      70            0 :     w.show();
      71              : 
      72            0 :     return a.exec();
      73            0 : }
        

Generated by: LCOV version 2.0-1