A utility class for parsing command line arguments within generated query programs.
More...
#include <CompiledOptions.h>
|
bool | existDir (const std::string &name) const |
| Check whether a directory exists in the file system. More...
|
|
bool | existFile (const std::string &name) const |
| Check whether a file exists in the file system. More...
|
|
void | printHelpPage (const std::string &exec_name) const |
| Prints the help page if it has been requested or there was a typo in the command line arguments. More...
|
|
A utility class for parsing command line arguments within generated query programs.
Definition at line 40 of file CompiledOptions.h.
◆ CmdOptions()
souffle::CmdOptions::CmdOptions |
( |
const char * |
s, |
|
|
const char * |
id, |
|
|
const char * |
od, |
|
|
bool |
pe, |
|
|
const char * |
pfn, |
|
|
size_t |
nj |
|
) |
| |
|
inline |
◆ existDir()
bool souffle::CmdOptions::existDir |
( |
const std::string & |
name | ) |
const |
|
inlineprivate |
Check whether a directory exists in the file system.
Definition at line 256 of file CompiledOptions.h.
◆ existFile()
bool souffle::CmdOptions::existFile |
( |
const std::string & |
name | ) |
const |
|
inlineprivate |
Check whether a file exists in the file system.
Definition at line 243 of file CompiledOptions.h.
245 if ((buffer.st_mode & S_IFDIR) != 0) {
◆ getInputFileDir()
const std::string& souffle::CmdOptions::getInputFileDir |
( |
| ) |
const |
|
inline |
◆ getNumJobs()
size_t souffle::CmdOptions::getNumJobs |
( |
| ) |
const |
|
inline |
◆ getOutputFileDir()
const std::string& souffle::CmdOptions::getOutputFileDir |
( |
| ) |
const |
|
inline |
◆ getProfileName()
const std::string& souffle::CmdOptions::getProfileName |
( |
| ) |
const |
|
inline |
◆ getSourceFileName()
const std::string& souffle::CmdOptions::getSourceFileName |
( |
| ) |
const |
|
inline |
◆ isProfiling()
bool souffle::CmdOptions::isProfiling |
( |
| ) |
const |
|
inline |
◆ parse()
bool souffle::CmdOptions::parse |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
inline |
Parses the given command line parameters, handles -h help requests or errors and returns whether the parsing was successful or not.
Definition at line 130 of file CompiledOptions.h.
131 {
nullptr,
false,
nullptr, 0}};
137 while ((c = getopt_long(argc, argv,
"D:F:hp:j:i:", longOptions,
nullptr)) != EOF) {
142 printf(
"Fact directory %s does not exists!\n", optarg);
150 printf(
"Output directory %s does not exists!\n", optarg);
157 std::cerr <<
"\nError: profiling was not enabled in compilation\n\n";
165 if (std::string(optarg) ==
"auto") {
168 int num = atoi(optarg);
172 std::cerr <<
"Invalid number of jobs [-j]: " << optarg <<
"\n";
177 std::cerr <<
"\nWarning: OpenMP was not enabled in compilation\n\n";
197 std::cerr <<
"====================================================================\n";
198 std::cerr <<
" Datalog Program: " <<
src <<
"\n";
199 std::cerr <<
" Usage: " << exec_name <<
" [OPTION]\n\n";
200 std::cerr <<
" Options:\n";
201 std::cerr <<
" -D <DIR>, --output=<DIR> -- Specify directory for output relations\n";
202 std::cerr <<
" (default: " <<
output_dir <<
")\n";
203 std::cerr <<
" (suppress output with \"\")\n";
204 std::cerr <<
" -F <DIR>, --facts=<DIR> -- Specify directory for fact files\n";
◆ printHelpPage()
void souffle::CmdOptions::printHelpPage |
( |
const std::string & |
exec_name | ) |
const |
|
inlineprivate |
Prints the help page if it has been requested or there was a typo in the command line arguments.
Definition at line 210 of file CompiledOptions.h.
213 std::cerr <<
" (default: " <<
num_jobs <<
")\n";
215 std::cerr <<
" (default: auto)\n";
218 std::cerr <<
" -h -- prints this help page.\n";
219 std::cerr <<
"--------------------------------------------------------------------\n";
220 std::cout <<
" Copyright (c) 2016-20 The Souffle Developers." << std::endl;
221 std::cout <<
" Copyright (c) 2013-16 Oracle and/or its affiliates." << std::endl;
222 std::cerr <<
" All rights reserved.\n";
223 std::cerr <<
"====================================================================\n";
229 inline bool existFile(
const std::string& name)
const {
231 if (stat(name.c_str(), &buffer) == 0) {
232 if ((buffer.st_mode & S_IFREG) != 0) {
References num_jobs.
◆ input_dir
std::string souffle::CmdOptions::input_dir |
|
protected |
◆ num_jobs
size_t souffle::CmdOptions::num_jobs |
|
protected |
◆ output_dir
std::string souffle::CmdOptions::output_dir |
|
protected |
◆ profile_name
std::string souffle::CmdOptions::profile_name |
|
protected |
◆ profiling
bool souffle::CmdOptions::profiling |
|
protected |
◆ src
std::string souffle::CmdOptions::src |
|
protected |
The documentation for this class was generated from the following file: