emlabcpp
modern opinionated embedded C++ library
quantity.h File Reference
#include "./concepts.h"
#include <cmath>
#include <functional>
#include <limits>
#include <ratio>
#include <string>
#include <type_traits>
+ Include dependency graph for quantity.h:

Go to the source code of this file.

Classes

class  emlabcpp::quantity< Derived, ValueType >
 Class representing generic quantity. More...
 
class  emlabcpp::tagged_quantity< Tag, ValueType >
 Class represents a quantity that uses tags to distinguish quantities instead of inheritance. More...
 
struct  std::numeric_limits< T >
 The quantity has defined partital specialization of std::numeric_limits, works as std::numeric_limits<ValueType>;. More...
 
struct  std::hash< T >
 Hash of quantity is hash of it's value and Derived::get_unit() xored. More...
 

Namespaces

 emlabcpp
 MIT License.
 
 emlabcpp::detail
 

Functions

template<typename Derived , typename ValueType >
constexpr bool emlabcpp::detail::quantity_derived_test (quantity< Derived, ValueType > const &)
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::operator+ (quantity< Derived, ValueType > lhs, quantity< Derived, ValueType > const rhs)
 Sum of quantities with same Derived and value_type. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::operator- (quantity< Derived, ValueType > lhs, quantity< Derived, ValueType > const rhs)
 Subtraction of quantities with same Derived and value_type. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::operator- (quantity< Derived, ValueType > const val)
 Provides negation of the quantity. More...
 
template<typename Derived , typename ValueType , arithmetic_like RhValueType>
constexpr bool emlabcpp::operator< (quantity< Derived, ValueType > const lhs, RhValueType const rhs)
 Provides abillity to compare quantity with non-quantity arithmetic value. More...
 
template<typename Derived , typename ValueType , arithmetic_like LhValueType>
constexpr bool emlabcpp::operator< (LhValueType const lhs, quantity< Derived, ValueType > const rhs)
 Provides abillity to compare quantity with non-quantity arithmetic value. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::operator* (quantity< Derived, ValueType > q, arithmetic auto const val)
 Multiplication of quantity by it's value_type. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::operator/ (quantity< Derived, ValueType > q, arithmetic auto const val)
 Division of quantity by it's value_type. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::abs (quantity< Derived, ValueType > const q)
 Quantity with absolute value of internal value. More...
 
template<typename Derived , typename ValueType >
constexpr auto emlabcpp::cos (quantity< Derived, ValueType > const u)
 Returns cosinus of the quantity as scalar. More...
 
template<typename Derived , typename ValueType >
constexpr auto emlabcpp::sin (quantity< Derived, ValueType > const u)
 Returns sinus of the quantity as scalar. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::max (quantity< Derived, ValueType > const lh, quantity< Derived, ValueType > const rh)
 Quantity with maximum value of one of the quantities. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::min (quantity< Derived, ValueType > const lh, quantity< Derived, ValueType > const rh)
 Quantity with minimum value of one of the quantities. More...
 
template<typename Derived , typename ValueType >
constexpr Derived emlabcpp::operator* (ValueType const val, quantity< Derived, ValueType > const q)
 Multiplication of value_type by quantity returns quantity. More...
 
template<typename Derived , typename ValueType >
constexpr ValueType emlabcpp::operator/ (ValueType const val, quantity< Derived, ValueType > const q)
 Division of value_type by quantity returns quantity. More...
 

Variables

template<typename T >
concept emlabcpp::quantity_derived = requires( T val ) { detail::quantity_derived_test( val ); }
 Concept satisfies any type T that inherits from any form of quantity<U>. More...