<commit_before>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <assert.h>

#include <log4cxx/logger.h>
#include <log4cxx/xml/domconfigurator.h>
using namespace log4cxx;
using namespace log4cxx::xml;

#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <boost/any.hpp>
using boost::any_cast;

#include "swmr-reader.h"

using namespace std;

void option_dependency(const po::variables_map& vm,
                       const char* for_what,
                       const char* required_option)
{
    if (vm.count(for_what) && !vm[for_what].defaulted())
        if (vm.count(required_option) == 0 || vm[required_option].defaulted())
            throw logic_error(string("Option '") + for_what
                              + "' requires option '"
                              + required_option + "'.");
}


int get_options(int ac, char* av[], po::variables_map& vm)
{
    try {
        string desc_string = "Usage:\n  swmr-reader [options] [DATAFILE]\n\n"
                             "    DATAFILE: The HDF5 SWMR datafile to read from.\n\n"
                             "Options";
        po::options_description desc(desc_string);
        desc.add_options()
            ("help,h", "Produce help message and quit")
            ("dataset,s", po::value<string>()->default_value("data"),
                    "Name of HDF5 SWMR dataset to monitor")
            ("testdatafile,f", po::value<string>(),
                    "HDF5 reference test data file name")
            ("testdataset,s", po::value<string>()->default_value("data"),
                    "HDF5 reference dataset name")
            ("nframes,n", po::value<int>()->default_value(-1),
                    "Number of frames to expect in input dataset (-1: unknown)")
            ("timeout,t", po::value<double>()->default_value(2.0),
                    "Timeout [sec] waiting for new data")
            ("polltime,p", po::value<double>()->default_value(0.20),
                    "Monitor polling time [sec]")
        ;

        // Hidden options, will be allowed both on command line and
        // in config file, but will not be shown to the user.
        po::options_description hidden("Hidden options");
        hidden.add_options()
            ("datafile", po::value<string>()->default_value("swmr.h5"),
                    "HDF5 SWMR input filename")
        ;

        po::options_description cmdline_options;
        cmdline_options.add(desc).add(hidden);

        po::positional_options_description p;
        p.add("datafile", -1);
        store(po::command_line_parser(ac, av).
              options(cmdline_options).positional(p).run(), vm);
        notify(vm);
<commit_msg>Fixing option nameclash in CLI reader app<commit_after>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <assert.h>

#include <log4cxx/logger.h>
#include <log4cxx/xml/domconfigurator.h>
using namespace log4cxx;
using namespace log4cxx::xml;

#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <boost/any.hpp>
using boost::any_cast;

#include "swmr-reader.h"

using namespace std;

void option_dependency(const po::variables_map& vm,
                       const char* for_what,
                       const char* required_option)
{
    if (vm.count(for_what) && !vm[for_what].defaulted())
        if (vm.count(required_option) == 0 || vm[required_option].defaulted())
            throw logic_error(string("Option '") + for_what
                              + "' requires option '"
                              + required_option + "'.");
}


int get_options(int ac, char* av[], po::variables_map& vm)
{
    try {
        string desc_string = "Usage:\n  swmr-reader [options] [DATAFILE]\n\n"
                             "    DATAFILE: The HDF5 SWMR datafile to read from.\n\n"
                             "Options";
        po::options_description desc(desc_string);
        desc.add_options()
            ("help,h", "Produce help message and quit")
            ("dataset,s", po::value<string>()->default_value("data"),
                    "Name of HDF5 SWMR dataset to monitor")
            ("testdatafile,f", po::value<string>(),
                    "HDF5 reference test data file name")
            ("testdataset,d", po::value<string>()->default_value("data"),
                    "HDF5 reference dataset name")
            ("nframes,n", po::value<int>()->default_value(-1),
                    "Number of frames to expect in input dataset (-1: unknown)")
            ("timeout,t", po::value<double>()->default_value(2.0),
                    "Timeout [sec] waiting for new data")
            ("polltime,p", po::value<double>()->default_value(0.20),
                    "Monitor polling time [sec]")
        ;

        // Hidden options, will be allowed both on command line and
        // in config file, but will not be shown to the user.
        po::options_description hidden("Hidden options");
        hidden.add_options()
            ("datafile", po::value<string>()->default_value("swmr.h5"),
                    "HDF5 SWMR input filename")
        ;

        po::options_description cmdline_options;
        cmdline_options.add(desc).add(hidden);

        po::positional_options_description p;
        p.add("datafile", -1);
        store(po::command_line_parser(ac, av).
              options(cmdline_options).positional(p).run(), vm);
        notify(vm);

{'fraction_non_alphanumeric': 0.135843484680694, 'fraction_numerical': 0.0070136581764488745, 'mean_word_length': 2.2624924744130044, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5796511', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1545, 'n_words': 366}