src/core/config/OptionParser.hpp

Option parser for additional command line options. More…

Namespaces

Name
allpix
Helper class to hold support layers for a detector model.

Classes

Name
class allpix::OptionParser
Option parser responsible for parsing and caching command line arguments.

Detailed Description

Option parser for additional command line options.

Copyright: Copyright (c) 2018-2025 CERN and the Allpix Squared authors. This software is distributed under the terms of the MIT License, copied verbatim in the file “LICENSE.md”. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. SPDX-License-Identifier: MIT

Source code


#ifndef ALLPIX_OPTION_PARSER_H
#define ALLPIX_OPTION_PARSER_H

#include <set>
#include <string>
#include <vector>

#include "Configuration.hpp"

namespace allpix {

    class OptionParser {
    public:
        OptionParser() = default;
        ~OptionParser() = default;


        OptionParser(const OptionParser&) = delete;
        OptionParser& operator=(const OptionParser&) = delete;


        OptionParser(OptionParser&&) noexcept = default; // NOLINT
        OptionParser& operator=(OptionParser&&) = default;

        void parseOption(std::string line);

        bool applyGlobalOptions(Configuration& config);

        bool applyOptions(const std::string& identifier, Configuration& config);

    private:
        std::vector<std::pair<std::string, std::string>> global_options_{};

        std::map<std::string, std::vector<std::pair<std::string, std::string>>> identifier_options_{};
    };
} // namespace allpix

#endif /* ALLPIX_OPTION_PARSER_H */

Updated on 2025-04-30 at 14:49:41 +0000