This repository has been archived on 2018-12-13. You can view files and clone it, but cannot push or open issues or pull requests.
arma-flow/src/args.hpp

85 lines
1.9 KiB
C++
Raw Normal View History

2018-04-08 15:21:54 +00:00
//
// arma-flow/args.hpp
//
// @author CismonX
//
2018-04-05 11:01:10 +00:00
#pragma once
#include <options.h>
namespace flow
{
2018-04-08 15:21:54 +00:00
/// Provides CLI argument parsing utility.
2018-04-05 11:01:10 +00:00
class args
{
2018-04-08 15:21:54 +00:00
/// The argument parser.
2018-04-05 11:01:10 +00:00
options::ArgParser arg_parser_;
public:
2018-04-08 15:21:54 +00:00
/**
* Constructor.
*/
2018-04-05 11:01:10 +00:00
explicit args();
2018-04-08 15:21:54 +00:00
/**
* Parse arguments.
*
* @param argc Number of arguments.
* @param argv Arguments.
*/
2018-04-05 11:01:10 +00:00
void parse(int argc, char** argv);
2018-04-08 15:21:54 +00:00
/**
* Get input file path from arguments.
*
* @param nodes Path to node data file.
* @param edges Path to edge data file.
* @return Whether argument is provided.
*/
2018-04-05 11:01:10 +00:00
bool input_file_path(std::string& nodes, std::string& edges);
2018-04-08 15:21:54 +00:00
/**
* Get output file path prefix from arguments.
*
* @param output Path prefix to output files.
* @return Whether argument is provided.
*/
2018-04-05 11:01:10 +00:00
bool output_file_path(std::string& output);
2018-04-08 15:21:54 +00:00
/**
* Check whether to remove the first line from input files.
*
* @return Whether argument is provided.
*/
2018-04-05 11:01:10 +00:00
bool remove_first_line();
2018-04-08 15:21:54 +00:00
/**
* Check max number of iterations before aborting calculation.
*
* @return Whether argument is provided.
*/
bool max_iterations(unsigned& max);
2018-04-05 11:01:10 +00:00
2018-04-08 15:21:54 +00:00
/**
* Check max deviation to be tolerated.
*
* @return Whether argument is provided.
*/
bool accuracy(double& epsilon);
2018-04-05 11:01:10 +00:00
2018-04-08 15:21:54 +00:00
/**
* Check whether to enable verbose output.
*
* @return Whether argument is provided.
*/
2018-04-05 11:01:10 +00:00
bool verbose();
2018-04-08 15:21:54 +00:00
/**
* Pring help message and exit.
*
* @return Whether argument is provided.
*/
2018-04-05 11:01:10 +00:00
void help();
};
}