Class find_constants (o2scl)

O2scl : Class List

class o2scl::find_constants

Find constant values which match a search term.

Return values for find_nothrow()

static const int one_exact_match_unit_match = 0
static const int one_exact_match_unit_diff = 1
static const int exact_matches_no_unit = 2
static const int exact_matches_unit_match = 3
static const int exact_matches_unit_diff = 4
static const int one_pattern_match_unit_match = 5
static const int one_pattern_match_unit_diff = 6
static const int pattern_matches_no_unit = 7
static const int pattern_matches_unit_match = 8
static const int pattern_matches_unit_diff = 9
static const int no_matches = 10
std::vector<find_constants_list> list

Database of constant values.

bool unit_match_logic(std::string unit, const find_constants_list &f)

The function which decides if the requested unit matches the specified list entry.

Units match if

  • the unit is unspecified (string of length zero)

  • the unit is equal to “any” (case-insensitive comparison)

  • the unit flag for the list entry is fc_unknown

  • the unit is equal to the list unit (case-insensitive comparison)

  • the unit is “mks” (case-insensitive comparison) and the unit flag is either o2scl_mks or fc_none

  • the unit is “cgs” (case-insensitive comparison) and the unit flag is either o2scl_cgs or fc_none

find_constants()

Other possible values of the unit flag

static const int fc_unknown = 0
static const int fc_none = 3
static const int fc_other = 4
int find_nothrow(std::string name, std::string unit, std::vector<find_constants_list> &matches, int verbose = 0)

Search for constants matching name with unit unit (possibly empty) and store matches in indexes.

void find_print(std::string name, std::string unit = "", size_t prec = 6, int verbose = 0)

Search for constants matching name with unit unit and output result(s) with precision prec.

double find_unique(std::string name, std::string unit = "")

Find a unique match and return the numerical value.

void output_list(std::ostream &os)

Output the full list of constants to os.

void add_constant(const find_constants_list &f, int verbose = 0)

Add a constant.

void del_constant(std::string &name, int verbose = 0)

Remove a constant.

Public Types

typedef struct o2scl::find_constants::find_constants_list_s find_constants_list

Type for constant database (also used for list of matches)

struct find_constants_list_s

Type for constant database (also used for list of matches)

Public Members

std::vector<std::string> names

List of names for the constant, with the preferred name first.

std::string unit

Unit.

int unit_flag

Flag (either 0, o2scl_mks, or o2scl_cgs)

double val

Value.

std::string source

Source or reference for value.

int m

Power of length.

int k

Power of mass.

int s

Power of time.

int K

Power of temperature.

int A

Power of current.

int mol

Power of moles.

int cd

Power of luminous intensity.