LibSWOC++ 1.5.14
Solid Wall of C++
Loading...
Searching...
No Matches
Scalar.h File Reference
#include <cstdint>
#include <ratio>
#include <ostream>
#include <type_traits>
#include "swoc/swoc_version.h"
#include "swoc/swoc_meta.h"
Include dependency graph for Scalar.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  swoc::Scalar< N, C, T >
 
struct  std::common_type< swoc::Scalar< N, C, T >, swoc::Scalar< S, I, T > >
 

Namespaces

namespace  swoc
 For template deduction guides.
 
namespace  std
 STL namespace.
 

Functions

template<typename C>
Scalar_INTERNAL constexpr detail::scalar_unit_round_up_t< C > swoc::round_up (C n)
 
template<intmax_t N, typename C, typename T>
constexpr detail::scalar_round_up_t< N, C, T > swoc::round_up (Scalar< N, C, T > v)
 
template<typename C>
constexpr detail::scalar_unit_round_down_t< C > swoc::round_down (C n)
 
template<intmax_t N, typename C, typename T>
constexpr detail::scalar_round_down_t< N, C, T > swoc::round_down (Scalar< N, C, T > v)
 
template<intmax_t N, typename C1, intmax_t S, typename I, typename T>
bool swoc::operator< (Scalar< N, C1, T > const &lhs, Scalar< S, I, T > const &rhs)
 
template<intmax_t N, typename C1, intmax_t S, typename I, typename T>
bool swoc::operator== (Scalar< N, C1, T > const &lhs, Scalar< S, I, T > const &rhs)
 
template<intmax_t N, typename C1, intmax_t S, typename I, typename T>
bool swoc::operator<= (Scalar< N, C1, T > const &lhs, Scalar< S, I, T > const &rhs)
 
template<intmax_t N, typename C, intmax_t S, typename I, typename T>
bool swoc::operator> (Scalar< N, C, T > const &lhs, Scalar< S, I, T > const &rhs)
 
template<intmax_t N, typename C, intmax_t S, typename I, typename T>
bool swoc::operator>= (Scalar< N, C, T > const &lhs, Scalar< S, I, T > const &rhs)
 
template<intmax_t N, typename C, intmax_t S, typename I, typename T>
auto swoc::operator+ (Scalar< N, C, T > lhs, Scalar< S, I, T > const &rhs) -> typename std::common_type< Scalar< N, C, T >, Scalar< S, I, T > >::type
 
template<intmax_t N, typename C, typename T>
Scalar< N, C, T > swoc::operator+ (Scalar< N, C, T > const &lhs, Scalar< N, C, T > const &rhs)
 
template<intmax_t N, typename C, intmax_t S, typename I, typename T>
auto swoc::operator- (Scalar< N, C, T > lhs, Scalar< S, I, T > const &rhs) -> typename std::common_type< Scalar< N, C, T >, Scalar< S, I, T > >::type
 
template<intmax_t N, typename C, typename T>
Scalar< N, C, T > swoc::operator- (Scalar< N, C, T > const &lhs, Scalar< N, C, T > const &rhs)
 
template<intmax_t N, typename C, typename T>
Scalar< N, C, T > swoc::operator* (Scalar< N, C, T > const &lhs, C n)
 
template<intmax_t N, typename C, typename T>
Scalar< N, C, T > swoc::operator* (C n, Scalar< N, C, T > const &rhs)
 
template<intmax_t N, typename C, typename T>
Scalar< N, C, T > swoc::operator* (Scalar< N, C, T > const &lhs, int n)
 
template<intmax_t N, typename C, typename T>
Scalar< N, C, T > swoc::operator* (int n, Scalar< N, C, T > const &rhs)
 
template<intmax_t N>
Scalar< N, int > swoc::operator* (Scalar< N, int > const &lhs, int n)
 
template<intmax_t N>
Scalar< N, int > swoc::operator* (int n, Scalar< N, int > const &rhs)
 
template<intmax_t N, typename C, intmax_t S, typename I, typename T>
auto swoc::operator/ (Scalar< N, C, T > lhs, Scalar< S, I, T > rhs) -> typename std::common_type< C, I >::type
 
template<intmax_t N, typename C, typename T, typename I>
Scalar< N, C, T > swoc::operator/ (Scalar< N, C, T > lhs, I n)
 
template<intmax_t N, typename C>
swoc::round_up (C value)
 
template<intmax_t N, typename C>
swoc::round_down (C value)
 
template<typename T>
auto swoc::detail::tag_label (std::ostream &, const meta::CaseTag< 0 > &) -> void
 
template<typename T>
auto swoc::detail::tag_label (std::ostream &w, const meta::CaseTag< 1 > &) -> decltype(T::label, meta::TypeFunc< void >())
 
template<typename T>
std::ostream & swoc::detail::tag_label (std::ostream &w)
 
template<intmax_t N, typename C, typename T>
ostream & std::operator<< (ostream &s, swoc::Scalar< N, C, T > const &x)
 

Detailed Description

Scaled integral values.

In many situations it is desirable to define scaling factors or base units (a "metric"). This template enables this to be done in a type and scaling safe manner where the defined factors carry their scaling information as part of the type.

Definition in file Scalar.h.

Function Documentation

◆ tag_label() [1/3]

template<typename T>
auto swoc::detail::tag_label ( std::ostream & ,
const meta::CaseTag< 0 > &  ) -> void

Definition at line 1041 of file Scalar.h.

◆ tag_label() [2/3]

template<typename T>
std::ostream & swoc::detail::tag_label ( std::ostream & w)
inline

Definition at line 1051 of file Scalar.h.

◆ tag_label() [3/3]

template<typename T>
auto swoc::detail::tag_label ( std::ostream & w,
const meta::CaseTag< 1 > &  ) -> decltype(T::label, meta::TypeFunc<void>())

Definition at line 1045 of file Scalar.h.