Program Listing for File ApplicationSettings.h

Return to documentation for file (src/smartpeak/include/SmartPeak/cli/ApplicationSettings.h)

// --------------------------------------------------------------------------
//   SmartPeak -- Fast and Accurate CE-, GC- and LC-MS(/MS) Data Processing
// --------------------------------------------------------------------------
// Copyright The SmartPeak Team -- Novo Nordisk Foundation
// Center for Biosustainability, Technical University of Denmark 2018-2021.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// --------------------------------------------------------------------------
// $Maintainer: Krzysztof Abram, Douglas McCloskey $
// $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $
// --------------------------------------------------------------------------
#pragma once
#include <iostream>
#include <algorithm>
#include <vector>

#include <SmartPeak/cli/Parser.h>


namespace SmartPeak {
namespace cli {

struct ApplicationSettings {

    explicit ApplicationSettings(Parser& parser) : m_parser {parser} {}
    virtual ~ApplicationSettings() = default;

    virtual void define_options();

    virtual void load_options();

    virtual void process_options();

    virtual void validate() const;

    virtual std::string usage() const { return m_parser.usage(); }

    virtual Parser& get_parser() { return m_parser; }
    virtual const Parser& get_parser() const { return m_parser; }

    static bool contains_option(
        const std::vector<std::string>& list,
        const std::string& option,
        std::string log_msg="");

    static std::pair<std::string, std::string> get_key_value_from_option(
      const std::string& option);

public:
    /* options */
    std::string load_session;
    std::vector<std::string> report;
    std::vector<std::string> report_sample_types;
    std::vector<std::string> report_metadata;
    std::vector<std::string> workflow;
    std::vector<std::string> integrity;
    bool allow_inconsistent;
    bool verbose;
    bool disable_colors;
    bool disable_progressbar;
    std::string log_dir;
    std::string features_out_dir;
    std::string features_in_dir;
    std::vector<std::string> input_files;
    std::vector<std::string> parameters;
    std::string mzml_dir;
    std::string reports_out_dir;

public:
    void validate_report() const;
    void validate_report_sample_types() const;
    void validate_report_metadata() const;
    void validate_workflow() const;
    void validate_integrity() const;

private:
    Parser& m_parser;
};

} /* namespace cli */
} /* namespace SmartPeak */