LCOV - code coverage report
Current view: top level - Source - option.hpp (source / functions) Coverage Total Hit
Test: coverage Lines: 81.8 % 11 9
Test Date: 2026-03-02 16:42:41 Functions: 100.0 % 6 6

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include "definition.hpp"
       4              : #include "logging.hpp"
       5              : 
       6              : /*!
       7              :  * This is a convenient oldy from Weini to let the user specify some configuration from CLI
       8              :  * CLI interaction is kept for debug purpose
       9              :  */
      10              : namespace Options {
      11              : 
      12              : extern std::vector<std::string> args;
      13              : 
      14              : [[nodiscard]] bool SetValue(const std::string& key, const std::string& value);
      15              : 
      16              : void displayOptionsXBoard();
      17              : 
      18              : void displayOptionsUCI();
      19              : 
      20              : void displayOptionsSPSA();
      21              : 
      22              : // from argv
      23          792 : template<typename T> inline bool getOption(T& value, const std::string& key) {
      24         1584 :    auto it = std::ranges::find(args, std::string("-") + key);
      25          792 :    if (it == args.end()) { /*Logging::LogIt(Logging::logWarn) << "ARG key not given, " << key;*/
      26              :       return false;
      27              :    }
      28           22 :    std::stringstream str;
      29              :    ++it;
      30           22 :    if (it == args.end()) {
      31            0 :       Logging::LogIt(Logging::logError) << "ARG value not given, " << key;
      32            0 :       return false;
      33              :    }
      34              :    str << *it;
      35           22 :    str >> value;
      36           22 :    Logging::LogIt(Logging::logInfo) << "From ARG, " << key << " : " << value;
      37           22 :    return true;
      38           22 : }
      39              : 
      40              : void initOptions(int argc, char** argv);
      41              : 
      42              : } // namespace Options
        

Generated by: LCOV version 2.0-1