Program Listing for File Luminosity.hpp

Return to documentation for file (src/LouLib/Units/Luminosity.hpp)

#ifndef LOULIB_LUMINOSITY_HPP
#define LOULIB_LUMINOSITY_HPP

#include "BaseUnit.hpp"
#include "UnitMath.hpp"

namespace LouLib{
    namespace Units{
        DEFINE_NEW_UNIT(0, 0, 0, 0, 0, 0, 1, 0, Luminosity);

        //base unit
        constexpr Luminosity CANDELA(1.0);

        inline namespace literals{
            #define CREATE_LUMINOSITY_STRING_LITERAL(literal, unit)             \
            constexpr Luminosity operator"" literal(long double x){             \
                return static_cast<double>(x)*unit;                         \
            }                                                               \
            constexpr Luminosity operator"" literal(unsigned long long int x){  \
                return static_cast<double>(x)*unit;                         \
            }

            CREATE_LUMINOSITY_STRING_LITERAL(_cd, CANDELA);
        }
    }
}

#endif //LOULIB_LUMINOSITY_HPP