MeshLib C++ Docs
Loading...
Searching...
No Matches
MRUnitInfo.h File Reference
#include "MRVectorTraits.h"
#include "MRMacros.h"
#include <cassert>
#include <optional>

Go to the source code of this file.

Classes

class  MR::UnitInfo
 

Namespaces

namespace  MR
 
namespace  MR::detail
 
namespace  MR::detail::Units
 

Concepts

concept  MR::UnitEnum
 
concept  MR::detail::Units::Scalar
 

Macros

#define DETAIL_MR_UNIT_ENUMS(X)   X(NoUnit) X(LengthUnit) X(AngleUnit) X(PixelSizeUnit) X(RatioUnit) X(TimeUnit) X(MovementSpeedUnit) X(AreaUnit) X(VolumeUnit) X(InvLengthUnit)
 
#define DETAIL_MR_UNIT_VALUE_TYPES(X, ...)
 
#define MR_X(E)   || std::same_as<T, E>
 
#define MR_X(E)   template <> [[nodiscard]] MRMESH_API MR_BIND_IGNORE const UnitInfo& getUnitInfo( E unit );
 

Typedefs

template<typename T >
using MR::detail::Units::MakeFloatingPoint = std::conditional_t<std::is_integral_v<typename VectorTraits<T>::BaseType>, typename VectorTraits<T>::template ChangeBaseType<float>, T>
 

Functions

template<UnitEnum E>
const UnitInfoMR::getUnitInfo (E unit)=delete
 
template<UnitEnum E>
bool MR::unitsAreEquivalent (E a, E b)
 
template<UnitEnum E>
bool MR::unitsAreEquivalent (const std::optional< E > &a, const std::optional< E > &b)
 
template<UnitEnum E, typename T >
detail::Units::MakeFloatingPoint< T > MR::convertUnits (E from, E to, const T &value)
 
template<UnitEnum E, typename T >
detail::Units::MakeFloatingPoint< T > MR::convertUnits (const std::optional< E > &from, const std::optional< E > &to, const T &value)
 

Macro Definition Documentation

◆ DETAIL_MR_UNIT_ENUMS

#define DETAIL_MR_UNIT_ENUMS ( X)    X(NoUnit) X(LengthUnit) X(AngleUnit) X(PixelSizeUnit) X(RatioUnit) X(TimeUnit) X(MovementSpeedUnit) X(AreaUnit) X(VolumeUnit) X(InvLengthUnit)

◆ DETAIL_MR_UNIT_VALUE_TYPES

#define DETAIL_MR_UNIT_VALUE_TYPES ( X,
... )
Value:
X(float ,__VA_ARGS__) X(double ,__VA_ARGS__) X(long double ,__VA_ARGS__) \
X(signed char ,__VA_ARGS__) X(unsigned char ,__VA_ARGS__) \
X(short ,__VA_ARGS__) X(unsigned short ,__VA_ARGS__) \
X(int ,__VA_ARGS__) X(unsigned int ,__VA_ARGS__) \
X(long ,__VA_ARGS__) X(unsigned long ,__VA_ARGS__) \
X(long long ,__VA_ARGS__) X(unsigned long long ,__VA_ARGS__)

◆ MR_X [1/2]

#define MR_X ( E)    || std::same_as<T, E>

◆ MR_X [2/2]

#define MR_X ( E)    template <> [[nodiscard]] MRMESH_API MR_BIND_IGNORE const UnitInfo& getUnitInfo( E unit );