Parallel numerical verification of the σ_odd problem
October 6, 2018
|
Some generic helper functions for programs. More...
Functions | |
std::string | concat_path (std::string path1, std::string path2) |
Return the path composed by path1/path2. More... | |
std::string | duration_ms_to_string (double duration_ms) |
Return a string with the duration expressed in milliseconds, seconds, minutes and hours, separated by tabulation. More... | |
std::string | duration_to_string (std::chrono::duration< double > duration_second) |
Return a string with the duration expressed in milliseconds, seconds, minutes and hours, separated by tabulation. More... | |
std::string | file_to_string (std::string filename) |
Read the file and return its content to a string. If failed then print a error message and exit. More... | |
std::string | get_string (int argc, const char *const argv[], unsigned int i, void(*help_and_exit_function)()=nullptr) |
Return argv[i] converted in string. More... | |
unsigned int | get_uint (int argc, const char *const argv[], unsigned int i, void(*help_and_exit_function)()=nullptr) |
Return argv[i] converted in integer. More... | |
unsigned long | get_ulong (int argc, const char *const argv[], unsigned int i, void(*help_and_exit_function)()=nullptr) |
Return argv[i] converted in integer. More... | |
bool | is_file_exists (std::string filename) |
Return true iff the file (or directory) exists. More... | |
void | print_intern_config_compiler () |
Print to stdcout the intern configuration of the compiler. More... | |
std::string | remove_last_if_null (const std::string &s) |
If s terminates by a null character then return a copy of s without this last character, else return s. More... | |
std::string | to_string (bool b) |
Return the string "true" if b, else "false". More... | |
Variables | |
const char | sep_ = '/' |
Some generic helper functions for programs.
std::string helper::concat_path | ( | std::string | path1, |
std::string | path2 | ||
) |
Return the path composed by path1/path2.
path1 | a valid path |
path2 | a valid relative path |
Definition at line 29 of file helper.cpp.
std::string helper::duration_ms_to_string | ( | double | duration_ms | ) |
Return a string with the duration expressed in milliseconds, seconds, minutes and hours, separated by tabulation.
Definition at line 48 of file helper.cpp.
std::string helper::duration_to_string | ( | std::chrono::duration< double > | duration_second | ) |
Return a string with the duration expressed in milliseconds, seconds, minutes and hours, separated by tabulation.
Definition at line 61 of file helper.cpp.
std::string helper::file_to_string | ( | std::string | filename | ) |
Read the file and return its content to a string. If failed then print a error message and exit.
Definition at line 75 of file helper.cpp.
std::string helper::get_string | ( | int | argc, |
const char *const | argv[], | ||
unsigned int | i, | ||
void(*)() | help_and_exit_function = nullptr |
||
) |
Return argv[i] converted in string.
If (help_and_exit_function != nullptr) and (i is not a valid index) then call help_and_exit_function().
Definition at line 92 of file helper.cpp.
unsigned int helper::get_uint | ( | int | argc, |
const char *const | argv[], | ||
unsigned int | i, | ||
void(*)() | help_and_exit_function = nullptr |
||
) |
Return argv[i] converted in integer.
If (help_and_exit_function != nullptr) and (i is not a valid index) then call help_and_exit_function().
Definition at line 108 of file helper.cpp.
unsigned long helper::get_ulong | ( | int | argc, |
const char *const | argv[], | ||
unsigned int | i, | ||
void(*)() | help_and_exit_function = nullptr |
||
) |
Return argv[i] converted in integer.
If (help_and_exit_function != nullptr) and (i is not a valid index) then call help_and_exit_function().
Definition at line 124 of file helper.cpp.
bool helper::is_file_exists | ( | std::string | filename | ) |
Return true iff the file (or directory) exists.
Definition at line 140 of file helper.cpp.
void helper::print_intern_config_compiler | ( | ) |
Print to stdcout the intern configuration of the compiler.
Definition at line 148 of file helper.cpp.
std::string helper::remove_last_if_null | ( | const std::string & | s | ) |
If s terminates by a null character then return a copy of s without this last character, else return s.
Definition at line 169 of file helper.cpp.
std::string helper::to_string | ( | bool | b | ) |
Return the string "true" if b, else "false".
Definition at line 177 of file helper.cpp.
const char helper::sep_ = '/' |
Definition at line 21 of file helper.cpp.