Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
slick::sim::order_gateway::RetransmitRing< MessageCapacity > Class Template Reference

The application messages a binary session has sent, kept by sequence number so a client can ask for them again. More...

#include <order_gateway/retransmit_ring.hpp>

Collaboration diagram for slick::sim::order_gateway::RetransmitRing< MessageCapacity >:

Classes

struct  Slot

Public Member Functions

 RetransmitRing ()=default
 Empty, with no slots: holds nothing until resized.
 RetransmitRing (size_t capacity)
Slot & claim (uint32_t seq) noexcept
 Claims seq's slot and returns it for the message to be encoded into.
const Slot * find (uint32_t seq) const noexcept
 The message sent as seq, or null when it never was or has been overwritten.
bool holds (uint32_t from, uint32_t count) const noexcept
 True when every message in [from, from + count) is still held.
void clear () noexcept
 Forgets every message, keeping the slots.
void resize (size_t capacity)
void swap (RetransmitRing &other) noexcept
bool empty () const noexcept
size_t capacity () const noexcept

Detailed Description

template<size_t MessageCapacity>
class slick::sim::order_gateway::RetransmitRing< MessageCapacity >

The application messages a binary session has sent, kept by sequence number so a client can ask for them again.

Fixed slots, indexed by seq % capacity: a message is encoded straight into its slot, and the oldest is overwritten once capacity newer ones have been sent. Only construction and resize() allocate.

Sequence numbers start at 1; 0 marks an empty slot.

Definition at line 19 of file retransmit_ring.hpp.

Constructor & Destructor Documentation

◆ RetransmitRing() [1/2]

template<size_t MessageCapacity>
slick::sim::order_gateway::RetransmitRing< MessageCapacity >::RetransmitRing ( )
default

Empty, with no slots: holds nothing until resized.

Referenced by swap().

◆ RetransmitRing() [2/2]

template<size_t MessageCapacity>
slick::sim::order_gateway::RetransmitRing< MessageCapacity >::RetransmitRing ( size_t capacity)
inlineexplicit

Definition at line 32 of file retransmit_ring.hpp.

References capacity().

Member Function Documentation

◆ capacity()

template<size_t MessageCapacity>
size_t slick::sim::order_gateway::RetransmitRing< MessageCapacity >::capacity ( ) const
inlinenodiscardnoexcept

Definition at line 77 of file retransmit_ring.hpp.

Referenced by RetransmitRing(), and resize().

◆ claim()

template<size_t MessageCapacity>
Slot & slick::sim::order_gateway::RetransmitRing< MessageCapacity >::claim ( uint32_t seq)
inlinenoexcept

Claims seq's slot and returns it for the message to be encoded into.

Definition at line 35 of file retransmit_ring.hpp.

◆ clear()

template<size_t MessageCapacity>
void slick::sim::order_gateway::RetransmitRing< MessageCapacity >::clear ( )
inlinenoexcept

Forgets every message, keeping the slots.

Definition at line 67 of file retransmit_ring.hpp.

◆ empty()

template<size_t MessageCapacity>
bool slick::sim::order_gateway::RetransmitRing< MessageCapacity >::empty ( ) const
inlinenodiscardnoexcept

Definition at line 76 of file retransmit_ring.hpp.

◆ find()

template<size_t MessageCapacity>
const Slot * slick::sim::order_gateway::RetransmitRing< MessageCapacity >::find ( uint32_t seq) const
inlinenodiscardnoexcept

The message sent as seq, or null when it never was or has been overwritten.

Definition at line 45 of file retransmit_ring.hpp.

Referenced by holds().

◆ holds()

template<size_t MessageCapacity>
bool slick::sim::order_gateway::RetransmitRing< MessageCapacity >::holds ( uint32_t from,
uint32_t count ) const
inlinenodiscardnoexcept

True when every message in [from, from + count) is still held.

Counted by offset rather than by from + count, so a range that runs over the end of the 32-bit sequence space neither wraps the bound nor ends the loop early.

Definition at line 57 of file retransmit_ring.hpp.

References find().

◆ resize()

template<size_t MessageCapacity>
void slick::sim::order_gateway::RetransmitRing< MessageCapacity >::resize ( size_t capacity)
inline

Definition at line 73 of file retransmit_ring.hpp.

References capacity().

◆ swap()

template<size_t MessageCapacity>
void slick::sim::order_gateway::RetransmitRing< MessageCapacity >::swap ( RetransmitRing< MessageCapacity > & other)
inlinenoexcept

Definition at line 74 of file retransmit_ring.hpp.

References RetransmitRing().


The documentation for this class was generated from the following file: