OpenPit C++ SDK
C++17 SDK for the OpenPit pre-trade risk engine
openpit::param::detail::ExactValue< Derived, Traits > Class Template Reference

Public Member Functions

Derived CheckedAdd (const Derived &other) const
 Adds another value and throws openpit::Error on overflow. More...
 
Derived CheckedDivFloat (double divisor) const
 Divides by an imprecise boundary double. More...
 
Derived CheckedDivInt (std::int64_t divisor) const
 Divides by a signed integer and throws openpit::Error on failure. More...
 
Derived CheckedDivUint (std::uint64_t divisor) const
 Divides by an unsigned integer and throws openpit::Error on failure. More...
 
Derived CheckedMulFloat (double scalar) const
 Multiplies by an imprecise boundary double. More...
 
Derived CheckedMulInt (std::int64_t scalar) const
 Multiplies by a signed integer and throws openpit::Error on failure. More...
 
Derived CheckedMulUint (std::uint64_t scalar) const
 Multiplies by an unsigned integer and throws openpit::Error on failure. More...
 
Derived CheckedRemFloat (double divisor) const
 Computes the remainder for an imprecise boundary double divisor. More...
 
Derived CheckedRemInt (std::int64_t divisor) const
 Computes the remainder for a signed integer divisor. More...
 
Derived CheckedRemUint (std::uint64_t divisor) const
 Computes the remainder for an unsigned integer divisor. More...
 
Derived CheckedSubtract (const Derived &other) const
 Subtracts another value and throws openpit::Error on failure. More...
 
int Compare (const Derived &other) const
 Compares this value with another value of the same domain type. More...
 
::openpit::param::Decimal Decimal () const noexcept
 Returns the lossless decimal representation. More...
 
bool IsZero () const
 Returns whether the value is exactly zero. More...
 
bool operator!= (const Derived &other) const
 
bool operator< (const Derived &other) const
 
bool operator<= (const Derived &other) const
 
bool operator== (const Derived &other) const
 
bool operator> (const Derived &other) const
 
bool operator>= (const Derived &other) const
 
double ToDouble () const
 Converts to an imprecise boundary double. More...
 
std::string ToString () const
 Formats the exact value as a decimal string. More...
 

Static Public Member Functions

static Derived FromDecimal (Decimal value)
 Validates an exact decimal representation. More...
 
static Derived FromDecimalRounded (Decimal value, std::uint32_t scale, RoundingStrategy rounding)
 Rounds an exact decimal representation to scale digits. More...
 
static Derived FromDouble (double value)
 Creates a value from an imprecise boundary double. More...
 
static Derived FromDoubleRounded (double value, std::uint32_t scale, RoundingStrategy rounding)
 Converts and rounds an imprecise boundary double. More...
 
static Derived FromInt64 (std::int64_t value)
 Creates a value from a signed integer. More...
 
static Derived FromString (std::string_view value)
 Parses an exact decimal string. More...
 
static Derived FromStringRounded (std::string_view value, std::uint32_t scale, RoundingStrategy rounding)
 Parses and rounds an exact decimal string to scale digits. More...
 
static Derived FromUint64 (std::uint64_t value)
 Creates a value from an unsigned integer. More...
 

Member Function Documentation

◆ CheckedAdd()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedAdd ( const Derived &  other) const
inline

Adds another value and throws openpit::Error on overflow.

◆ CheckedDivFloat()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedDivFloat ( double  divisor) const
inline

Divides by an imprecise boundary double.

◆ CheckedDivInt()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedDivInt ( std::int64_t  divisor) const
inline

Divides by a signed integer and throws openpit::Error on failure.

◆ CheckedDivUint()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedDivUint ( std::uint64_t  divisor) const
inline

Divides by an unsigned integer and throws openpit::Error on failure.

◆ CheckedMulFloat()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedMulFloat ( double  scalar) const
inline

Multiplies by an imprecise boundary double.

◆ CheckedMulInt()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedMulInt ( std::int64_t  scalar) const
inline

Multiplies by a signed integer and throws openpit::Error on failure.

◆ CheckedMulUint()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedMulUint ( std::uint64_t  scalar) const
inline

Multiplies by an unsigned integer and throws openpit::Error on failure.

◆ CheckedRemFloat()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedRemFloat ( double  divisor) const
inline

Computes the remainder for an imprecise boundary double divisor.

◆ CheckedRemInt()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedRemInt ( std::int64_t  divisor) const
inline

Computes the remainder for a signed integer divisor.

◆ CheckedRemUint()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedRemUint ( std::uint64_t  divisor) const
inline

Computes the remainder for an unsigned integer divisor.

◆ CheckedSubtract()

template<typename Derived , typename Traits >
Derived openpit::param::detail::ExactValue< Derived, Traits >::CheckedSubtract ( const Derived &  other) const
inline

Subtracts another value and throws openpit::Error on failure.

◆ Compare()

template<typename Derived , typename Traits >
int openpit::param::detail::ExactValue< Derived, Traits >::Compare ( const Derived &  other) const
inline

Compares this value with another value of the same domain type.

◆ Decimal()

template<typename Derived , typename Traits >
::openpit::param::Decimal openpit::param::detail::ExactValue< Derived, Traits >::Decimal ( ) const
inlinenoexcept

Returns the lossless decimal representation.

◆ FromDecimal()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromDecimal ( Decimal  value)
inlinestatic

Validates an exact decimal representation.

◆ FromDecimalRounded()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromDecimalRounded ( Decimal  value,
std::uint32_t  scale,
RoundingStrategy  rounding 
)
inlinestatic

Rounds an exact decimal representation to scale digits.

◆ FromDouble()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromDouble ( double  value)
inlinestatic

Creates a value from an imprecise boundary double.

Prefer FromString or FromDecimal for financial input.

◆ FromDoubleRounded()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromDoubleRounded ( double  value,
std::uint32_t  scale,
RoundingStrategy  rounding 
)
inlinestatic

Converts and rounds an imprecise boundary double.

◆ FromInt64()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromInt64 ( std::int64_t  value)
inlinestatic

Creates a value from a signed integer.

◆ FromString()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromString ( std::string_view  value)
inlinestatic

Parses an exact decimal string.

◆ FromStringRounded()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromStringRounded ( std::string_view  value,
std::uint32_t  scale,
RoundingStrategy  rounding 
)
inlinestatic

Parses and rounds an exact decimal string to scale digits.

◆ FromUint64()

template<typename Derived , typename Traits >
static Derived openpit::param::detail::ExactValue< Derived, Traits >::FromUint64 ( std::uint64_t  value)
inlinestatic

Creates a value from an unsigned integer.

◆ IsZero()

template<typename Derived , typename Traits >
bool openpit::param::detail::ExactValue< Derived, Traits >::IsZero ( ) const
inline

Returns whether the value is exactly zero.

◆ operator!=()

template<typename Derived , typename Traits >
bool openpit::param::detail::ExactValue< Derived, Traits >::operator!= ( const Derived &  other) const
inline

◆ operator<()

template<typename Derived , typename Traits >
bool openpit::param::detail::ExactValue< Derived, Traits >::operator< ( const Derived &  other) const
inline

◆ operator<=()

template<typename Derived , typename Traits >
bool openpit::param::detail::ExactValue< Derived, Traits >::operator<= ( const Derived &  other) const
inline

◆ operator==()

template<typename Derived , typename Traits >
bool openpit::param::detail::ExactValue< Derived, Traits >::operator== ( const Derived &  other) const
inline

◆ operator>()

template<typename Derived , typename Traits >
bool openpit::param::detail::ExactValue< Derived, Traits >::operator> ( const Derived &  other) const
inline

◆ operator>=()

template<typename Derived , typename Traits >
bool openpit::param::detail::ExactValue< Derived, Traits >::operator>= ( const Derived &  other) const
inline

◆ ToDouble()

template<typename Derived , typename Traits >
double openpit::param::detail::ExactValue< Derived, Traits >::ToDouble ( ) const
inline

Converts to an imprecise boundary double.

◆ ToString()

template<typename Derived , typename Traits >
std::string openpit::param::detail::ExactValue< Derived, Traits >::ToString ( ) const
inline

Formats the exact value as a decimal string.