carl
24.04
Computer ARithmetic Library
|
Data Structures | |
struct | Settings |
Base class for central settings class. More... | |
struct | duration |
Helper type to parse duration as std::chrono values with boost::program_options. More... | |
struct | binary_quantity |
Helper type to parse quantities with binary SI-style suffixes. More... | |
struct | metric_quantity |
Helper type to parse quantities with SI-style suffixes. More... | |
struct | OptionPrinter |
Helper class to nicely print the options that are available. More... | |
struct | SettingsPrinter |
Helper class to nicely print the settings that were parsed. More... | |
class | SettingsParser |
Base class for a settings parser. More... | |
Functions | |
void | validate (boost::any &v, const std::vector< std::string > &values, carl::settings::duration *, int) |
Custom validator for duration that wraps some std::chrono::duration. More... | |
void | validate (boost::any &v, const std::vector< std::string > &values, carl::settings::binary_quantity *, int) |
Custom validator for binary quantities. More... | |
void | validate (boost::any &v, const std::vector< std::string > &values, carl::settings::metric_quantity *, int) |
Custom validator for metric quantities. More... | |
template<typename Array > | |
std::pair< std::intmax_t, std::size_t > | get_proper_suffix (std::intmax_t value, const Array &a) |
Helper method to obtain proper (unit) suffix entry from a value and a given set of possible suffixes. More... | |
std::ostream & | operator<< (std::ostream &os, const duration &d) |
Streaming operator for duration. Auto-detects proper time suffix. More... | |
constexpr bool | operator== (binary_quantity lhs, binary_quantity rhs) |
Compare two binary quantities for equality. More... | |
constexpr bool | operator< (binary_quantity lhs, binary_quantity rhs) |
Compare two binary quantities. More... | |
std::ostream & | operator<< (std::ostream &os, const binary_quantity &q) |
Streaming operator for binary quantity. Auto-detects proper suffix. More... | |
constexpr bool | operator== (metric_quantity lhs, metric_quantity rhs) |
Compare two metric quantities for equality. More... | |
constexpr bool | operator< (metric_quantity lhs, metric_quantity rhs) |
Compare two metric quantities. More... | |
std::ostream & | operator<< (std::ostream &os, const metric_quantity &q) |
Streaming operator for metric quantity. Auto-detects proper suffix. More... | |
std::ostream & | operator<< (std::ostream &os, const boost::any &val) |
std::ostream & | operator<< (std::ostream &os, OptionPrinter op) |
Streaming operator for a option printer. More... | |
std::ostream & | operator<< (std::ostream &os, SettingsPrinter sp) |
Streaming operator for a settings printer. More... | |
template<typename T > | |
void | default_to (po::variables_map &values, const std::string &name, const T &value) |
Inserts value into variables_map if it is not yet set. More... | |
template<typename T > | |
void | overwrite_to (po::variables_map &values, const std::string &name, const T &value) |
Inserts or overwrites value into variables_map. More... | |
void carl::settings::default_to | ( | po::variables_map & | values, |
const std::string & | name, | ||
const T & | value | ||
) |
Inserts value into variables_map if it is not yet set.
This method is intended as a helper for finalizer functions.
Definition at line 36 of file SettingsParser.h.
std::pair<std::intmax_t,std::size_t> carl::settings::get_proper_suffix | ( | std::intmax_t | value, |
const Array & | a | ||
) |
Helper method to obtain proper (unit) suffix entry from a value and a given set of possible suffixes.
Can be called, for example, with a value of nanoseconds and the following array a = { {"ns", 1000}, {"µs", 1000}, {"ms", 1000}, {"s", 60}, {"m", 60}, {"h", 1} }
. This method will find the largest suffix such that the value will not be zero if represented with respect to this suffix. The return value is the value converted to this unit suffix and the index into the array to retrieve the appropriate suffix string. For the above example, get_proper_suffix(30000000000, a) = {30, 3}
, that is 30s
.
Definition at line 25 of file settings_utils.h.
|
constexpr |
Compare two binary quantities.
Definition at line 96 of file settings_utils.h.
|
constexpr |
Compare two metric quantities.
Definition at line 142 of file settings_utils.h.
|
inline |
Streaming operator for binary quantity. Auto-detects proper suffix.
Definition at line 101 of file settings_utils.h.
std::ostream& carl::settings::operator<< | ( | std::ostream & | os, |
const boost::any & | val | ||
) |
Definition at line 17 of file SettingsParser.cpp.
|
inline |
Streaming operator for duration. Auto-detects proper time suffix.
Definition at line 55 of file settings_utils.h.
|
inline |
Streaming operator for metric quantity. Auto-detects proper suffix.
Definition at line 147 of file settings_utils.h.
std::ostream & carl::settings::operator<< | ( | std::ostream & | os, |
OptionPrinter | op | ||
) |
Streaming operator for a option printer.
Definition at line 37 of file SettingsParser.cpp.
std::ostream & carl::settings::operator<< | ( | std::ostream & | os, |
SettingsPrinter | sp | ||
) |
Streaming operator for a settings printer.
Definition at line 49 of file SettingsParser.cpp.
|
constexpr |
Compare two binary quantities for equality.
Definition at line 92 of file settings_utils.h.
|
constexpr |
Compare two metric quantities for equality.
Definition at line 138 of file settings_utils.h.
void carl::settings::overwrite_to | ( | po::variables_map & | values, |
const std::string & | name, | ||
const T & | value | ||
) |
Inserts or overwrites value into variables_map.
This method is intended as a helper for finalizer functions.
Definition at line 50 of file SettingsParser.h.
void carl::settings::validate | ( | boost::any & | v, |
const std::vector< std::string > & | values, | ||
carl::settings::binary_quantity * | , | ||
int | |||
) |
Custom validator for binary quantities.
Accepts the format <number><suffix>
where suffix is one of the following: Ki,Mi,Gi,Ti,Pi,Ei
.
Definition at line 35 of file settings_utils.cpp.
void carl::settings::validate | ( | boost::any & | v, |
const std::vector< std::string > & | values, | ||
carl::settings::duration * | , | ||
int | |||
) |
Custom validator for duration that wraps some std::chrono::duration.
Accepts the format <number><suffix>
where suffix is one of the following: ns,µs,us,ms,s,m,h
.
Definition at line 10 of file settings_utils.cpp.
void carl::settings::validate | ( | boost::any & | v, |
const std::vector< std::string > & | values, | ||
carl::settings::metric_quantity * | , | ||
int | |||
) |
Custom validator for metric quantities.
Accepts the format <number><suffix>
where suffix is one of the following: K,M,G,T,P,E
.
Definition at line 65 of file settings_utils.cpp.