|
Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
|
A null-terminated character buffer of fixed capacity, stored inline. More...
#include <utils/fixed_string.hpp>
Public Member Functions | |
| fixed_string ()=default | |
| fixed_string (std::string_view value) noexcept | |
| fixed_string (const char *value) noexcept | |
| fixed_string & | operator= (std::string_view value) noexcept |
| fixed_string & | operator= (const char *value) noexcept |
| void | assign (std::string_view value) noexcept |
| Truncates anything that does not fit and zero-fills the tail, so the buffer is always null-terminated and a recycled object can never leak the previous value past the terminator. | |
| void | clear () noexcept |
| const char * | c_str () const noexcept |
| const char * | data () const noexcept |
| char * | data () noexcept |
| size_t | size () const noexcept |
| bool | empty () const noexcept |
| std::string_view | view () const noexcept |
| operator std::string_view () const noexcept | |
| std::string | str () const |
Static Public Member Functions | |
| static constexpr size_t | capacity () noexcept |
| static constexpr size_t | buffer_size () noexcept |
Friends | |
| bool | operator== (const fixed_string &lhs, std::string_view rhs) noexcept |
| bool | operator== (const fixed_string &lhs, const fixed_string &rhs) noexcept |
| std::ostream & | operator<< (std::ostream &os, const fixed_string &value) |
A null-terminated character buffer of fixed capacity, stored inline.
Order and Symbol use it for identity fields bounded by their wire formats. These fields are written once and read often; inline storage avoids heap allocations on pooled objects in the order path.
The layout is exactly char[N], with no size field or pointer. Consecutive fields therefore match a wire header byte for byte and can be copied with one memcpy. size() scans at most N bytes with strnlen, so avoid calling it repeatedly in a hot loop.
Values are truncated to N-1 characters, matching the wire fields' limit.
Definition at line 48 of file fixed_string.hpp.
|
default |
|
inlinenoexcept |
Definition at line 55 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 56 of file fixed_string.hpp.
|
inlinenoexcept |
Truncates anything that does not fit and zero-fills the tail, so the buffer is always null-terminated and a recycled object can never leak the previous value past the terminator.
Definition at line 67 of file fixed_string.hpp.
Referenced by slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::fixed_string(), slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::fixed_string(), slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::operator=(), and slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::operator=().
|
inlinestaticconstexprnoexcept |
Definition at line 78 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 71 of file fixed_string.hpp.
Referenced by slick::sim::order_gateway::coinbase::to_json().
|
inlinestaticconstexprnoexcept |
Definition at line 77 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 69 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 72 of file fixed_string.hpp.
Referenced by slick::sim::exch::Exchange::publishLevelUpdate(), slick::sim::exch::Exchange::publishMDBookUpdate(), slick::sim::exch::Exchange::publishMDOrderUpdate(), slick::sim::exch::Exchange::publishMdSubscriptionResponse(), slick::sim::exch::Exchange::publishTradeSubscriptionResponse(), and slick::sim::exch::Exchange::publishTradeSummary().
|
inlinenoexcept |
Definition at line 73 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 76 of file fixed_string.hpp.
Referenced by slick::sim::OrderBook::addOrder(), slick::sim::OrderBook::deleteOrder(), slick::sim::OrderBook::deleteOrder(), and slick::sim::OrderBook::modifyOrder().
|
inlinenoexcept |
Definition at line 81 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 59 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 58 of file fixed_string.hpp.
|
inlinenoexcept |
Definition at line 75 of file fixed_string.hpp.
Referenced by slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::view().
|
inline |
Definition at line 82 of file fixed_string.hpp.
Referenced by slick::sim::order_gateway::OrderStore::apply().
|
inlinenoexcept |
Definition at line 80 of file fixed_string.hpp.
Referenced by slick::sim::exch::Symbol::addOrder(), slick::sim::exch::Symbol::cancelOrder(), slick::sim::engine::detail::cancelUnrestableRemainder(), slick::sim::engine::detail::canFillCompletely(), slick::sim::engine::detail::fillResting(), slick::sim::engine::detail::fillRestingFromFeed(), std::formatter< slick::sim::utils::fixed_string< N >, CharT >::format(), slick::sim::engine::detail::handleSelfMatch(), slick::sim::exch::Symbol::modifyOrder(), slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::operator std::string_view(), slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::operator<<, slick::sim::engine::detail::prepareOrder(), and slick::sim::utils::fixed_string< sizeof(MarketDataUpdate::symbol)>::str().
|
friend |
Definition at line 91 of file fixed_string.hpp.
|
friend |
Definition at line 87 of file fixed_string.hpp.
|
friend |
Definition at line 84 of file fixed_string.hpp.