LCOV - code coverage report
Current view: top level - oksutils/apps - oks_refresh.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 41 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  *  \file oks_validate_repository.cpp
       3              :  *
       4              :  *  This file is part of the OKS package.
       5              :  *  Author: <Igor.Soloviev@cern.ch>
       6              :  */
       7              : 
       8              : #include <stdlib.h>
       9              : 
      10              : #include <boost/program_options.hpp>
      11              : 
      12              : #include "oks/kernel.hpp"
      13              : 
      14              : using namespace dunedaq;
      15              : using namespace dunedaq::oks;
      16              : 
      17              : int
      18            0 : main(int argc, char **argv)
      19              : {
      20            0 :   boost::program_options::options_description desc("This program opens and saves oks files to refresh their format");
      21              : 
      22            0 :   std::vector<std::string> include;
      23            0 :   std::vector<std::string> files;
      24            0 :   bool show_hidden_attributes = false;
      25              : 
      26            0 :   try
      27              :     {
      28            0 :       desc.add_options()
      29            0 :         ("files,f", boost::program_options::value<std::vector<std::string> >(&files)->multitoken()->required(), "oks files")
      30            0 :         ("include,i", boost::program_options::value<std::vector<std::string> >(&include)->multitoken(), "preload oks files (to fix missing includes)")
      31            0 :         ("show-all-attributes,x", "show hidden attributes with values equal to defaults")
      32            0 :         ("help,h", "Print help message");
      33              : 
      34            0 :       boost::program_options::variables_map vm;
      35            0 :       boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
      36              : 
      37            0 :       boost::program_options::notify(vm);
      38              : 
      39            0 :       if (vm.count("help"))
      40              :         {
      41            0 :           std::cout << desc << std::endl;
      42            0 :           return EXIT_SUCCESS;
      43              :         }
      44              : 
      45            0 :       if (vm.count("show-all-attributes"))
      46            0 :         show_hidden_attributes = true;
      47            0 :     }
      48            0 :   catch (std::exception& ex)
      49              :     {
      50            0 :       std::cerr << "Command line parsing errors occurred:\n" << ex.what() << std::endl;
      51            0 :       return EXIT_FAILURE;
      52            0 :     }
      53              : 
      54            0 :   for (const auto &x : files)
      55            0 :     try
      56              :       {
      57            0 :         std::cout << "processing file " << x  << std::endl;
      58            0 :         OksKernel kernel(false, false, false, false);
      59              : 
      60            0 :         for(const auto& i : include)
      61            0 :           kernel.load_file(i);
      62              : 
      63            0 :         auto f = kernel.load_file(x);
      64              : 
      65            0 :         if (f->get_oks_format() == "schema")
      66            0 :           kernel.save_schema(f);
      67              :         else
      68            0 :           kernel.save_data(f, true, nullptr, show_hidden_attributes);
      69            0 :       }
      70            0 :     catch (oks::exception &ex)
      71              :       {
      72            0 :         oks::log_timestamp(oks::Error) << "Caught oks exception:\n" << ex << std::endl;
      73            0 :         return EXIT_FAILURE;
      74            0 :       }
      75              : 
      76            0 :   return EXIT_SUCCESS;
      77            0 : }
        

Generated by: LCOV version 2.0-1