BetaTrader
A HFT Eco-System
Loading...
Searching...
No Matches
SeqNumStore.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <cstdint>
9#include <string>
10#include <mutex>
11
12namespace fix_client {
13
22 public:
28 SeqNumStore(const std::string& senderCompId, const std::string& directory = "seq_store");
29
33 uint32_t getNextTargetSeqNum() const;
34
38 uint32_t getNextSenderSeqNum() const;
39
45 void setSeqNums(uint32_t inSeq, uint32_t outSeq);
46
50 void reset();
51
52 private:
53 void load();
54 void save() const;
55
56 std::string mFilePath;
57 mutable std::mutex mMutex; // Mutable to lock during const getters
58
59 uint32_t mInSeqNum = 1;
60 uint32_t mOutSeqNum = 1;
61 };
62
63} // namespace fix_client
A thread-safe, file-backed repository for FIX Sequence Numbers.
Definition SeqNumStore.h:21
std::mutex mMutex
Definition SeqNumStore.h:57
std::string mFilePath
Definition SeqNumStore.h:56
void setSeqNums(uint32_t inSeq, uint32_t outSeq)
Sets both sequence numbers and persists them to disk.
Definition SeqNumStore.cpp:28
uint32_t mOutSeqNum
Definition SeqNumStore.h:60
uint32_t getNextTargetSeqNum() const
Gets the next expected incoming sequence number.
Definition SeqNumStore.cpp:18
void reset()
Resets the sequence numbers to 1 (e.g., on a new day or clean Logon).
Definition SeqNumStore.cpp:35
void save() const
Definition SeqNumStore.cpp:66
void load()
Definition SeqNumStore.cpp:43
uint32_t getNextSenderSeqNum() const
Gets the next expected outgoing sequence number.
Definition SeqNumStore.cpp:23
uint32_t mInSeqNum
Definition SeqNumStore.h:59
Definition AuthManager.h:13