1 #ifndef jb_itch5_price_field_hpp 2 #define jb_itch5_price_field_hpp 7 #include <boost/io/ios_state.hpp> 8 #include <boost/operators.hpp> 33 template <
typename wire_type_t, std::
intmax_t denom_v>
35 :
public boost::equality_comparable<price_field<wire_type_t, denom_v>>,
36 public boost::less_than_comparable<price_field<wire_type_t, denom_v>> {
42 constexpr
static std::intmax_t
denom = denom_v;
48 typedef std::ratio<1, denom>
tick;
77 return value_ / double(denom);
109 template <
bool val
idate,
typename wire_type_t, std::
intmax_t denom_v>
113 r(std::size_t
size,
void const* buf, std::size_t offset) {
121 template <
typename wire_type_t, std::
intmax_t denom_v>
123 operator<<(std::ostream& os, price_field<wire_type_t, denom_v>
const& x) {
124 boost::io::ios_flags_saver saver(os);
125 auto d = std::div(x.as_integer(), x.denom);
126 return os << d.quot <<
"." << std::setw(x.denom_digits - 1)
127 << std::setfill(
'0') << d.rem;
136 template <
typename price_field>
138 auto v = std::numeric_limits<typename price_field::wire_type>::max();
150 template <
typename price_field>
160 #endif // jb_itch5_price_field_hpp price_field()
Default constructor.
constexpr int static_digits(std::intmax_t value)
Compute (at compile time if possible) the number of digits in a number.
Define a class used to represent prices in the ITCH-5.0 feed.
std::ratio< 1, denom > tick
The minimum quotation tick for this price.
price_field< std::uint64_t, 100000000 > price8_t
Convenience definition for Price(8) fields.
price_field(wire_type rhs)
Constructor from a price.
wire_type value_
The value as an integer.
static price_field dollar_price()
price_field operator+(price_field const &lhs, price_field const &rhs)
non-member addition operator
price_field max_price_field_value()
price_field & operator=(wire_type rhs)
Assignment from.
Define the interface to decode ITCH-5.0 messages and message fields.
wire_type as_integer() const
price_field & operator+=(price_field const &rhs)
Addition assignment operator.
static constexpr int denom_digits
The number of digits in the denominator.
bool operator==(price_field const &rhs) const
Base comparison operators.
wire_type_t wire_type
The wire type.
static price_field< wire_type_t, denom_v > r(std::size_t size, void const *buf, std::size_t offset)
Please see the generic documentation for jb::itch5::decoder<>::r()
price_field< std::uint32_t, 10000 > price4_t
Convenience definition for Price(4) fields.
bool operator<(price_field const &rhs) const
static constexpr std::intmax_t denom
The denominator.
The top-level namespace for the JayBeams library.