scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
|
#include "./scalar_unit.hpp"
#include "./conversion.hpp"
#include "./base_units.hpp"
#include "./prefix.hpp"
#include "../util/types.hpp"
#include "boost/algorithm/string/erase.hpp"
#include "boost/algorithm/string.hpp"
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
Go to the source code of this file.
Namespaces | |
namespace | scifir |
The namespace scifir contains all scifir-units, excepting the string literals, which are outside. | |
Functions | |
string | scifir::to_string (const scalar_unit &x) |
Generates a string representation of the scalar_unit, it uses the display of the scalar_unit with 2 decimals, without brackets and without a close prefix. | |
bool | scifir::is_scalar_unit (const string &init_scalar) |
Checks if an string is an initialization string of a scalar_unit. | |
float | scifir::abs (const scalar_unit &x) |
Returns the absolute value of the scalar_unit, without dimensions. | |
scalar_unit | scifir::pow (const scalar_unit &x, int exponent) |
Exponentiates a scalar_unit to some numeric type, the dimensions are also exponentiated. | |
scalar_unit | scifir::sqrt (const scalar_unit &x) |
Square root of a scalar_unit, it squares the dimensions too. | |
scalar_unit | scifir::sqrt_nth (const scalar_unit &x, int index) |
Nth root of a scalar_unit to any numeric value, it squares the dimensions too. | |
bool | operator!= (const scifir::scalar_unit &x, scifir::scalar_unit y) |
Returns true if two scalar_unit classes doesn't have the same value when changed to same dimensions. If their basic dimensions are different, it returns false. | |
bool | operator< (const scifir::scalar_unit &x, const scifir::scalar_unit &y) |
Returns true if x has a lower value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison. | |
bool | operator> (const scifir::scalar_unit &x, const scifir::scalar_unit &y) |
Returns true if x has a greather value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison. | |
bool | operator<= (const scifir::scalar_unit &x, const scifir::scalar_unit &y) |
Returns true if x has a lower or equal value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison. | |
bool | operator>= (const scifir::scalar_unit &x, const scifir::scalar_unit &y) |
Returns true if x has a greather or equal value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison. | |
bool | operator== (const scifir::scalar_unit &x, const string &init_scalar) |
Returns true if x is equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers. | |
bool | operator!= (const scifir::scalar_unit &x, const string &init_scalar) |
Returns true if x is not equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers. | |
bool | operator< (const scifir::scalar_unit &x, const string &init_scalar) |
Returns true if x is lower than the scalar_unit initialized with the string being compared. | |
bool | operator> (const scifir::scalar_unit &x, const string &init_scalar) |
Returns true if x is greather than the scalar_unit initialized with the string being compared. | |
bool | operator<= (const scifir::scalar_unit &x, const string &init_scalar) |
Returns true if x is lower or equal to the scalar_unit initialized with the string being compared. | |
bool | operator>= (const scifir::scalar_unit &x, const string &init_scalar) |
Returns true if x is greather or equal to the scalar_unit initialized with the string being compared. | |
bool | operator== (const string &init_scalar, const scifir::scalar_unit &x) |
Returns true if x is equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers. | |
bool | operator!= (const string &init_scalar, const scifir::scalar_unit &x) |
Returns true if x is not equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers. | |
bool | operator< (const string &init_scalar, const scifir::scalar_unit &x) |
Returns true if x is greather than the scalar_unit initialized with the string being compared. | |
bool | operator> (const string &init_scalar, const scifir::scalar_unit &x) |
Returns true if x is lower than the scalar_unit initialized with the string being compared. | |
bool | operator<= (const string &init_scalar, const scifir::scalar_unit &x) |
Returns true if x is greather or equal to the scalar_unit initialized with the string being compared. | |
bool | operator>= (const string &init_scalar, const scifir::scalar_unit &x) |
Returns true if x is lower or equal to the scalar_unit initialized with the string being compared. | |
void | operator+= (string &x, const scifir::scalar_unit &y) |
Concatenates the string representation of the scalar_unit y to the string x. | |
string | operator+ (const string &x, const scifir::scalar_unit &y) |
Creates a new string as the concatenation of the string x with the representation string of the scalar_unit y. | |
string | operator+ (const scifir::scalar_unit &y, const string &x) |
Creates a new string as the concatenation of the string x with the representation string of the scalar_unit y. | |
ostream & | operator<< (ostream &os, const scifir::scalar_unit &x) |
Adds the string representation of the scalar_unit x to an output stream os. | |
istream & | operator>> (istream &is, scifir::scalar_unit &x) |
Allows that an istream initializes by string a scalar_unit x. | |
bool operator!= | ( | const scifir::scalar_unit & | x, |
const string & | init_scalar | ||
) |
Returns true if x is not equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers.
Definition at line 1021 of file scalar_unit.cpp.
bool operator!= | ( | const scifir::scalar_unit & | x, |
scifir::scalar_unit | y | ||
) |
Returns true if two scalar_unit classes doesn't have the same value when changed to same dimensions. If their basic dimensions are different, it returns false.
Definition at line 964 of file scalar_unit.cpp.
bool operator!= | ( | const string & | init_scalar, |
const scifir::scalar_unit & | x | ||
) |
Returns true if x is not equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers.
Definition at line 1053 of file scalar_unit.cpp.
string operator+ | ( | const scifir::scalar_unit & | y, |
const string & | x | ||
) |
Creates a new string as the concatenation of the string x with the representation string of the scalar_unit y.
Definition at line 1095 of file scalar_unit.cpp.
string operator+ | ( | const string & | x, |
const scifir::scalar_unit & | y | ||
) |
Creates a new string as the concatenation of the string x with the representation string of the scalar_unit y.
Definition at line 1087 of file scalar_unit.cpp.
void operator+= | ( | string & | x, |
const scifir::scalar_unit & | y | ||
) |
Concatenates the string representation of the scalar_unit y to the string x.
Definition at line 1080 of file scalar_unit.cpp.
bool operator< | ( | const scifir::scalar_unit & | x, |
const scifir::scalar_unit & | y | ||
) |
Returns true if x has a lower value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison.
Definition at line 969 of file scalar_unit.cpp.
bool operator< | ( | const scifir::scalar_unit & | x, |
const string & | init_scalar | ||
) |
Returns true if x is lower than the scalar_unit initialized with the string being compared.
Definition at line 1026 of file scalar_unit.cpp.
bool operator< | ( | const string & | init_scalar, |
const scifir::scalar_unit & | x | ||
) |
Returns true if x is greather than the scalar_unit initialized with the string being compared.
Definition at line 1058 of file scalar_unit.cpp.
ostream & operator<< | ( | ostream & | os, |
const scifir::scalar_unit & | x | ||
) |
Adds the string representation of the scalar_unit x to an output stream os.
Definition at line 1103 of file scalar_unit.cpp.
bool operator<= | ( | const scifir::scalar_unit & | x, |
const scifir::scalar_unit & | y | ||
) |
Returns true if x has a lower or equal value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison.
Definition at line 1005 of file scalar_unit.cpp.
bool operator<= | ( | const scifir::scalar_unit & | x, |
const string & | init_scalar | ||
) |
Returns true if x is lower or equal to the scalar_unit initialized with the string being compared.
Definition at line 1038 of file scalar_unit.cpp.
bool operator<= | ( | const string & | init_scalar, |
const scifir::scalar_unit & | x | ||
) |
Returns true if x is greather or equal to the scalar_unit initialized with the string being compared.
Definition at line 1070 of file scalar_unit.cpp.
bool operator== | ( | const scifir::scalar_unit & | x, |
const string & | init_scalar | ||
) |
Returns true if x is equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers.
Definition at line 1015 of file scalar_unit.cpp.
bool operator== | ( | const string & | init_scalar, |
const scifir::scalar_unit & | x | ||
) |
Returns true if x is equal to the scalar_unit initialized with the string being compared. The display() function is not used, and so the values are compared with all its decimal numbers.
Definition at line 1048 of file scalar_unit.cpp.
bool operator> | ( | const scifir::scalar_unit & | x, |
const scifir::scalar_unit & | y | ||
) |
Returns true if x has a greather value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison.
Definition at line 987 of file scalar_unit.cpp.
bool operator> | ( | const scifir::scalar_unit & | x, |
const string & | init_scalar | ||
) |
Returns true if x is greather than the scalar_unit initialized with the string being compared.
Definition at line 1032 of file scalar_unit.cpp.
bool operator> | ( | const string & | init_scalar, |
const scifir::scalar_unit & | x | ||
) |
Returns true if x is lower than the scalar_unit initialized with the string being compared.
Definition at line 1064 of file scalar_unit.cpp.
bool operator>= | ( | const scifir::scalar_unit & | x, |
const scifir::scalar_unit & | y | ||
) |
Returns true if x has a greather or equal value than y, compared with the same dimensions. If their dimensions are not equal, they are changed to be equal in order to do the comparison.
Definition at line 1010 of file scalar_unit.cpp.
bool operator>= | ( | const scifir::scalar_unit & | x, |
const string & | init_scalar | ||
) |
Returns true if x is greather or equal to the scalar_unit initialized with the string being compared.
Definition at line 1043 of file scalar_unit.cpp.
bool operator>= | ( | const string & | init_scalar, |
const scifir::scalar_unit & | x | ||
) |
Returns true if x is lower or equal to the scalar_unit initialized with the string being compared.
Definition at line 1075 of file scalar_unit.cpp.
istream & operator>> | ( | istream & | is, |
scifir::scalar_unit & | x | ||
) |
Allows that an istream initializes by string a scalar_unit x.
Definition at line 1108 of file scalar_unit.cpp.