Skip to content

Commit

Permalink
Merge pull request #87 from bernedom/documentation/remove-bintray-links
Browse files Browse the repository at this point in the history
Documentation/remove bintray links
  • Loading branch information
bernedom authored Mar 12, 2021
2 parents 417e517 + 5c01160 commit b490c65
Show file tree
Hide file tree
Showing 43 changed files with 90 additions and 108 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.5

* Fixed typos in documentation

## 2.0.4

* Add literals for ton types up to peta ton
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)

project(
"SI"
VERSION 2.0.4
VERSION 2.0.5
DESCRIPTION
"A header only c++ library that provides type safety and user defined literals for handling pyhsical values defined in the International System of Units."
HOMEPAGE_URL "https://github.com/bernedom/SI"
Expand Down Expand Up @@ -61,8 +61,8 @@ if(SI_INSTALL_LIBRARY)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" INSTALL_DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)

install(
EXPORT ${PROJECT_NAME}_Targets
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ The typedefs are prefixed (or in rare cases interfixed) with the standard metric
| --------------------------- | ---------------- | ----------- | --------------------------------------------------- | --------------------------------- |
| Length | L | m | 10<sup>-18</sup> to 10<sup>18</sup> | `*_metre_t` |
| Time | T | s | 10<sup>-18</sup> to 10<sup>0</sup> and 60/1, 3600/1 | `*_seconds_t, minutes_t, hours_t` |
| Mass* | M | kg | 10<sup>-15</sup> to 10<sup>18</sup> | `*_gram_t`, `*_ton_t` |
| Mass* | M | kg | 10<sup>-15</sup> to 10<sup>18</sup> | `*_gram_t`, `*_ton_t` |
| Electric current | I | A | 10<sup>-18</sup> to 10<sup>18</sup> | `*_ampere_t` |
| Thermodynamic temperature** | t | K | 10<sup>-18</sup> to 10<sup>18</sup> | `*_kelvin_t` |
| Amount of substance | N | mol | 10<sup>-18</sup> to 10<sup>18</sup> | `*_mol_t` |
| Luminousity | J | cd | 10<sup>-18</sup> to 10<sup>18</sup> | `*_candela_t` |
| Luminosity | J | cd | 10<sup>-18</sup> to 10<sup>18</sup> | `*_candela_t` |
\* for mass the base ratio is `kg` (not `g`) as defined in the SI unit table. So there is a mismatch between the literal prefix and the internal representation.
Expand All @@ -76,7 +76,7 @@ The typedefs are prefixed (or in rare cases interfixed) with the standard metric
All units that can be built from other units decay to the respective units by inverting the mathematical operation. I.e if `Q = I * T` then `Q / I = T` and `Q / T = I`
| Unit | Dimension Symbol | Unit Symbol | builable from | implemented literals | unit typedefs |
| Unit | Dimension Symbol | Unit Symbol | buildable from | implemented literals | unit typedefs |
| -------------------- | ---------------- | ----------- | ---------------- | ----------------------- | ------------------------------------------------------------------ |
| Velocity | v | m/s | L / T | `m_p_s`, `km_p_h`, `_c` | `metre_per_second_t`, `kilometre_per_second_t`, `speed_of_light_t` |
| Acceleration | a | m/s^2 | v / T, v^2 / L | none | none |
Expand Down Expand Up @@ -135,7 +135,7 @@ See [the installation guide](doc/installation-guide.md) for detailed instruction

## Packaging

SI is available as 'raw' download from this repo but also as [conan package](https://bintray.com/bernedom/conan/si%3ASI/_latestVersion). All releases are available from `SI/stable` from bintray. Getting SI from there is the preferred way.
SI is available as 'raw' download from this repository but also as [conan package](https://conan.io/center/si). Getting SI from conan-center is the preferred way.

## Implementation details

Expand Down
2 changes: 1 addition & 1 deletion doc/installation-guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installing `SI`

The default installation location for SI is `/usr/local/lib/SI`. SI can be installed using raw cmake, cpack (cmakes package mechanism), or as a conan.io package provided from [Bintray](https://bintray.com/bernedom/conan/SI%3ASI)
The default installation location for SI is `/usr/local/lib/si`. SI can be installed using raw cmake, cpack (cmakes package mechanism), or as a conan.io package provided from [conan center](https://conan.io/center/si). Early access to conan packages for unstable versions is available from [Bintray](https://bintray.com/bernedom/conan/si%3ASI)

## Installing using cmake

Expand Down
2 changes: 1 addition & 1 deletion include/SI/absorbed_dose.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
2 changes: 1 addition & 1 deletion include/SI/acceleration.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
2 changes: 1 addition & 1 deletion include/SI/angle.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
2 changes: 1 addition & 1 deletion include/SI/area.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
2 changes: 1 addition & 1 deletion include/SI/astronomic.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
2 changes: 1 addition & 1 deletion include/SI/catalytic_activity.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
5 changes: 2 additions & 3 deletions include/SI/detail/detail.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down Expand Up @@ -31,8 +31,7 @@ struct is_ratio<std::ratio<_num, _den>> : std::true_type {};
template <typename _type>
inline constexpr bool is_ratio_v = is_ratio<_type>::value;

template <typename T,
std::enable_if_t<std::is_floating_point_v<T>> * = nullptr>
template <typename T, std::enable_if_t<std::is_floating_point_v<T>> * = nullptr>
constexpr bool epsEqual(const T &lhs, const T &rhs) {

return (lhs - rhs) < std::numeric_limits<T>::epsilon() &&
Expand Down
2 changes: 1 addition & 1 deletion include/SI/detail/number_parser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
2 changes: 1 addition & 1 deletion include/SI/detail/operator_helpers.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
99 changes: 39 additions & 60 deletions include/SI/detail/unit.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down Expand Up @@ -51,10 +51,8 @@ template <typename _unit_lhs, typename _unit_rhs> struct unit_with_common_ratio;
template <char _symbol, typename _exponent, typename _type,
typename _ratio = std::ratio<1>>
struct unit_t {
static_assert(std::is_arithmetic_v<_type>,
"Type is an arithmetic value");
static_assert(detail::is_ratio_v<_exponent>,
"_exponent is a ratio type");
static_assert(std::is_arithmetic_v<_type>, "Type is an arithmetic value");
static_assert(detail::is_ratio_v<_exponent>, "_exponent is a ratio type");
static_assert(detail::is_ratio_v<_ratio>, "_ratio is a std::ratio");
using ratio = _ratio;
using internal_type = _type;
Expand All @@ -81,8 +79,7 @@ struct unit_t {
constexpr unit_t(const unit_t<_symbol, _exponent, _rhs_type, _rhs_ratio> &rhs)
: value_{
unit_cast<unit_t<_symbol, _exponent, _type, _ratio>>(rhs).value()} {
static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -94,8 +91,7 @@ struct unit_t {
: value_{
std::move(unit_cast<unit_t<_symbol, _exponent, _type, _ratio>>(rhs)
.value())} {
static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -115,14 +111,13 @@ struct unit_t {
constexpr unit_t &operator=(unit_t &&rhs) = default;

/// Assignment of same unit but different ratio
template <typename _rhs_ratio,
std::enable_if_t<!std::ratio_equal_v<_rhs_ratio, _ratio>> * =
nullptr>
template <
typename _rhs_ratio,
std::enable_if_t<!std::ratio_equal_v<_rhs_ratio, _ratio>> * = nullptr>
constexpr unit_t &
operator=(const unit_t<_symbol, _exponent, _type, _rhs_ratio> &rhs) {

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -133,14 +128,13 @@ struct unit_t {
}

/// Move assignment of same unit but different ratio
template <typename _rhs_ratio,
std::enable_if_t<!std::ratio_equal_v<_rhs_ratio, _ratio>> * =
nullptr>
template <
typename _rhs_ratio,
std::enable_if_t<!std::ratio_equal_v<_rhs_ratio, _ratio>> * = nullptr>
constexpr unit_t &
operator=(unit_t<_symbol, _exponent, _type, _rhs_ratio> &&rhs) {

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -162,10 +156,8 @@ struct unit_t {
std::ratio_equal_v<ratio, _rhs_ratio>,
"Implicit ratio conversion disabled, convert before comparing");

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(std::is_integral_v<_type> ||
std::is_floating_point_v<_type>,
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(std::is_integral_v<_type> || std::is_floating_point_v<_type>,
"Is integral or floating point");
using gcd_unit = typename unit_with_common_ratio<
typename std::remove_reference<decltype(rhs)>::type,
Expand All @@ -185,16 +177,14 @@ struct unit_t {
template <typename _rhs_type, typename _rhs_ratio>
constexpr bool operator!=(
const unit_t<_symbol, _exponent, _rhs_type, _rhs_ratio> &rhs) const {
static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
return !(*this == rhs);
}

template <typename _rhs_type, typename _rhs_ratio>
constexpr bool operator<(
const unit_t<_symbol, _exponent, _rhs_type, _rhs_ratio> &rhs) const {
static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -216,8 +206,7 @@ struct unit_t {
template <typename _rhs_type, typename _rhs_ratio>
constexpr bool operator>(
const unit_t<_symbol, _exponent, _rhs_type, _rhs_ratio> &rhs) const {
static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand Down Expand Up @@ -260,8 +249,7 @@ struct unit_t {
const unit_t<_symbol, _rhs_exponent, _rhs_type, _rhs_ratio> &rhs) const {
static_assert(detail::is_ratio_v<_rhs_exponent>,
"rhs exponent is a ratio type");
static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");

static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
Expand All @@ -283,10 +271,9 @@ struct unit_t {

/// divide with same unit with same ratio but not the same exponent
/// @returns unit with exponents subtracted from each others
template <
typename _rhs_exponent, typename _rhs_type,
std::enable_if_t<std::ratio_not_equal_v<_rhs_exponent, _exponent>>
* = nullptr>
template <typename _rhs_exponent, typename _rhs_type,
std::enable_if_t<std::ratio_not_equal_v<_rhs_exponent, _exponent>>
* = nullptr>
constexpr auto operator/(
const unit_t<_symbol, _rhs_exponent, _rhs_type, _ratio> &rhs) const {
static_assert(detail::is_ratio_v<_rhs_exponent>,
Expand All @@ -302,14 +289,12 @@ struct unit_t {
/// divide with a same unit but different ratios
/// the ratio of the result is the gcd of the two ratios and the exponents are
/// subtracted
template <
typename _rhs_exponent, typename _rhs_type, typename _rhs_ratio,
std::enable_if_t<std::ratio_not_equal_v<_rhs_exponent, _exponent>>
* = nullptr>
template <typename _rhs_exponent, typename _rhs_type, typename _rhs_ratio,
std::enable_if_t<std::ratio_not_equal_v<_rhs_exponent, _exponent>>
* = nullptr>
constexpr auto operator/(
const unit_t<_symbol, _rhs_exponent, _rhs_type, _rhs_ratio> &rhs) const {
static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_exponent>,
"rhs exponent is a ratio type");
static_assert(
Expand All @@ -330,18 +315,17 @@ struct unit_t {

/// if the same units of the same exponent but different ratio are divided
/// then the result is a scalar
template <typename _rhs_exponent, typename _rhs_type, typename _rhs_ratio,
std::enable_if_t<std::ratio_equal_v<_rhs_exponent, exponent>>
* = nullptr>
template <
typename _rhs_exponent, typename _rhs_type, typename _rhs_ratio,
std::enable_if_t<std::ratio_equal_v<_rhs_exponent, exponent>> * = nullptr>
constexpr _type operator/(
const unit_t<_symbol, _rhs_exponent, _rhs_type, _rhs_ratio> &rhs) const {
static_assert(SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<_rhs_ratio, _ratio>,
"Implicit ratio conversion disabled, convert to same ratio "
"before dividing");

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");

static_assert(detail::is_ratio_v<_rhs_exponent>,
"rhs exponent is a ratio type");
Expand All @@ -364,8 +348,7 @@ struct unit_t {
constexpr unit_t operator+(
const unit_t<_symbol, _exponent, _rhs_type, _rhs_ratio> &rhs) const {

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -383,14 +366,13 @@ struct unit_t {
}

/// add value of the same type but possibly different ratio
template <typename _rhs_type, typename _rhs_ratio,
std::enable_if_t<!std::ratio_equal_v<_rhs_ratio, _ratio>> * =
nullptr>
template <
typename _rhs_type, typename _rhs_ratio,
std::enable_if_t<!std::ratio_equal_v<_rhs_ratio, _ratio>> * = nullptr>
constexpr unit_t &
operator+=(const unit_t<_symbol, _exponent, _rhs_type, _rhs_ratio> &rhs) {

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -406,8 +388,7 @@ struct unit_t {
constexpr unit_t operator-(
const unit_t<_symbol, _exponent, _rhs_type, _rhs_ratio> &rhs) const {

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand All @@ -425,14 +406,12 @@ struct unit_t {
}

/// subtract value of the same type but possibly different ratio
template <
typename _rhs_type, typename _rhs_ratio,
std::enable_if<!std::ratio_equal_v<_rhs_ratio, _ratio>> * = nullptr>
template <typename _rhs_type, typename _rhs_ratio,
std::enable_if<!std::ratio_equal_v<_rhs_ratio, _ratio>> * = nullptr>
constexpr unit_t &
operator-=(const unit_t<_symbol, _exponent, _type, _rhs_ratio> &rhs) {

static_assert(detail::is_ratio_v<_rhs_ratio>,
"_rhs_ratio is a std::ratio");
static_assert(detail::is_ratio_v<_rhs_ratio>, "_rhs_ratio is a std::ratio");
static_assert(
SI_ENABLE_IMPLICIT_RATIO_CONVERSION ||
std::ratio_equal_v<ratio, _rhs_ratio>,
Expand Down
2 changes: 1 addition & 1 deletion include/SI/detail/unit_symbol.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
2 changes: 1 addition & 1 deletion include/SI/electric_capacity.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is part of "SI" version 2.0.4
* This file is part of "SI" version 2.0.5
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
Expand Down
Loading

1 comment on commit b490c65

@bernedom
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Catch2 Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.0.

Benchmark suite Current: b490c65 Previous: 417e517 Ratio
long double by unit division 145.729 us (+/- 3.754) 57.787 us (+/- 38.039) 2.5218301694152667

This comment was automatically generated by workflow using github-action-benchmark.

CC: @bernedom

Please sign in to comment.