LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
QPressure.hpp
Go to the documentation of this file.
1/*
2 * This code is a modified version of Benjamin Jurke's work in 2015. You can read his blog post
3 * here:
4 * https://benjaminjurke.com/content/articles/2015/compile-time-numerical-unit-dimension-checking/
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
10#pragma once
11
16
17namespace okapi {
18QUANTITY_TYPE(1, -1, -2, 0, QPressure)
19
20constexpr QPressure pascal(1.0);
21constexpr QPressure bar = 100000 * pascal;
22constexpr QPressure psi = pound * G / inch2;
23
24inline namespace literals {
25constexpr QPressure operator"" _Pa(long double x) {
26 return QPressure(x);
27}
28constexpr QPressure operator"" _Pa(unsigned long long int x) {
29 return QPressure(static_cast<double>(x));
30}
31constexpr QPressure operator"" _bar(long double x) {
32 return static_cast<double>(x) * bar;
33}
34constexpr QPressure operator"" _bar(unsigned long long int x) {
35 return static_cast<double>(x) * bar;
36}
37constexpr QPressure operator"" _psi(long double x) {
38 return static_cast<double>(x) * psi;
39}
40constexpr QPressure operator"" _psi(unsigned long long int x) {
41 return static_cast<double>(x) * psi;
42}
43} // namespace literals
44} // namespace okapi
#define QUANTITY_TYPE(_Mdim, _Ldim, _Tdim, _Adim, name)
Definition RQuantity.hpp:84
constexpr QPressure bar
Definition QPressure.hpp:21
constexpr QMass pound
Definition QMass.hpp:21
constexpr QAcceleration G
@ x
Roll Axis.
constexpr QArea inch2
Definition QArea.hpp:23
constexpr QPressure psi
Definition QPressure.hpp:22
constexpr QPressure pascal(1.0)