OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
FloatingPointDecimal< MantissaType, ExponentType > Class Template Reference

Classes

struct  MemberTraits

Public Types

enum  
typedef MantissaType Mantissa
typedef ExponentType Exponent

Public Member Functions

std::string toString () const
constexpr FloatingPointDecimal () noexcept
constexpr FloatingPointDecimal (Mantissa mantissa, Exponent exponent) noexcept
constexpr FloatingPointDecimal (const FloatingPointDecimal &other) noexcept
Mantissa mantissa () const noexcept
Exponent exponent () const noexcept
FloatingPointDecimaloperator= (const FloatingPointDecimal &other) noexcept
template<class OtherMantissa, class OtherExponent>
 FloatingPointDecimal (const FloatingPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
template<class OtherMantissa, class OtherExponent>
 FloatingPointDecimal (const FixedPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
template<class OtherMantissa, class OtherExponent>
FloatingPointDecimaloperator= (const FloatingPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
template<class OtherMantissa, class OtherExponent>
FloatingPointDecimaloperator= (const FixedPointDecimal< OtherMantissa, OtherExponent > &other) noexcept
void serialize (void *addr) const noexcept

Detailed Description

template<class MantissaType, class ExponentType>
class OnixS::ICE::BOE::Messaging::FloatingPointDecimal< MantissaType, ExponentType >

Definition at line 38 of file Decimal.h.

Member Typedef Documentation

◆ Exponent

template<class MantissaType, class ExponentType>
typedef ExponentType Exponent

Exponent component type.

Definition at line 59 of file Decimal.h.

◆ Mantissa

template<class MantissaType, class ExponentType>
typedef MantissaType Mantissa

Mantissa component type.

Definition at line 56 of file Decimal.h.

Member Enumeration Documentation

◆ anonymous enum

template<class MantissaType, class ExponentType>
anonymous enum

Traits.

Enumerator
Size sizeof(Mantissa) + sizeof(Exponent) 

Size of the class in bytes.

Definition at line 62 of file Decimal.h.

63 {
65 Size = sizeof(Mantissa) + sizeof(Exponent)
66 };

Constructor & Destructor Documentation

◆ FloatingPointDecimal() [1/5]

template<class MantissaType, class ExponentType>
FloatingPointDecimal ( )
inlineconstexprnoexcept

Default (zero) initialization.

Definition at line 77 of file Decimal.h.

78 : mantissa_()
79 , exponent_()
80 {
81 }

◆ FloatingPointDecimal() [2/5]

template<class MantissaType, class ExponentType>
FloatingPointDecimal ( Mantissa mantissa,
Exponent exponent )
inlineconstexprnoexcept

Explicitly initializes the instance from the mantissa and exponent values.

Definition at line 85 of file Decimal.h.

86 : mantissa_(mantissa)
87 , exponent_(exponent)
88 {
89 }

◆ FloatingPointDecimal() [3/5]

template<class MantissaType, class ExponentType>
FloatingPointDecimal ( const FloatingPointDecimal< MantissaType, ExponentType > & other)
inlineconstexprnoexcept

Initializes the instance as a copy of the given one.

Definition at line 93 of file Decimal.h.

95 : mantissa_(other.mantissa_)
96 , exponent_(other.exponent_)
97 {
98 }

◆ FloatingPointDecimal() [4/5]

template<class MantissaType, class ExponentType>
template<class OtherMantissa, class OtherExponent>
FloatingPointDecimal ( const FloatingPointDecimal< OtherMantissa, OtherExponent > & other)
inlineexplicitnoexcept

Initializes the instance from the floating point decimal.

Definition at line 124 of file Decimal.h.

125 : mantissa_(other.mantissa())
126 , exponent_(other.exponent())
127 {
128 }

◆ FloatingPointDecimal() [5/5]

template<class MantissaType, class ExponentType>
template<class OtherMantissa, class OtherExponent>
FloatingPointDecimal ( const FixedPointDecimal< OtherMantissa, OtherExponent > & other)
inlineexplicitnoexcept

Initializes the instance from the fixed point decimal.

Definition at line 132 of file Decimal.h.

133 : mantissa_(other.mantissa())
134 , exponent_(other.exponent())
135 {
136 }

Member Function Documentation

◆ exponent()

template<class MantissaType, class ExponentType>
Exponent exponent ( ) const
inlinenoexcept
Returns
exponent.

Definition at line 107 of file Decimal.h.

108 {
109 return exponent_;
110 }

◆ mantissa()

template<class MantissaType, class ExponentType>
Mantissa mantissa ( ) const
inlinenoexcept
Returns
mantissa.

Definition at line 101 of file Decimal.h.

102 {
103 return mantissa_;
104 }

◆ operator=() [1/3]

template<class MantissaType, class ExponentType>
template<class OtherMantissa, class OtherExponent>
FloatingPointDecimal & operator= ( const FixedPointDecimal< OtherMantissa, OtherExponent > & other)
inlinenoexcept

Re-initializes instance as a copy of the fixed point value.

Definition at line 161 of file Decimal.h.

162 {
163 mantissa_ = other.mantissa();
164 exponent_ = other.exponent();
165
166 return *this;
167 }

◆ operator=() [2/3]

template<class MantissaType, class ExponentType>
FloatingPointDecimal & operator= ( const FloatingPointDecimal< MantissaType, ExponentType > & other)
inlinenoexcept

Re-initializes the instance as copy of the given one.

Definition at line 113 of file Decimal.h.

114 {
115 mantissa_ = other.mantissa_;
116 exponent_ = other.exponent_;
117
118 return *this;
119 }

◆ operator=() [3/3]

template<class MantissaType, class ExponentType>
template<class OtherMantissa, class OtherExponent>
FloatingPointDecimal & operator= ( const FloatingPointDecimal< OtherMantissa, OtherExponent > & other)
inlinenoexcept

Re-initializes instance as a copy of the floating point value.

Definition at line 145 of file Decimal.h.

148 {
149 mantissa_ = other.mantissa();
150 exponent_ = other.exponent();
151
152 return *this;
153 }

◆ serialize()

template<class MantissaType, class ExponentType>
void serialize ( void * addr) const
inlinenoexcept

Serializes to the given data buffer.

Definition at line 170 of file Decimal.h.

171 {
172 assert(addr);
173
174 std::memcpy(addr, &mantissa_, sizeof(mantissa_));
175 addr = advanceByBytes(addr, sizeof(mantissa_));
176
177 std::memcpy(addr, &exponent_, sizeof(exponent_));
178 }
ONIXS_ICEBOE_FORCEINLINE Type * advanceByBytes(Type *pointer, ptrdiff_t distance) noexcept
Advances the pointer to a given offset (distance) in bytes.
Definition Memory.h:110

◆ toString()

template<class MantissaType, class ExponentType>
std::string toString ( ) const
inline
Returns
a human-readable presentation.

Definition at line 70 of file Decimal.h.

71 {
72 return toStr(*this);
73 }
std::string toStr(Order::PriceOptional value)
Definition Order.cpp:34