refactor: simplifying message queue

This commit is contained in:
2025-04-08 00:35:46 +02:00
parent 407c155c4d
commit d1f582e6ba
20 changed files with 268 additions and 345 deletions
+22 -15
View File
@@ -76,6 +76,17 @@ class SPIT_Message {
public:
Header *getHeader() const { return m_Header.get(); }
int getBytesCount() const { return m_BytesCount; }
void setServerInfoInHeader(string clientId, string serverId) {
if (!m_Header)
return;
m_Header->setClientID(clientId);
m_Header->setServerID(serverId);
}
void setMessageNumber(uint8_t no) {
if (!m_Header)
return;
m_Header->setMessageNumber(no);
}
const string getServerID() const {
if (!m_Header) {
@@ -131,7 +142,6 @@ class SPIT_Message {
// Members
private:
std::vector<char> m_MessageBytes{};
unique_ptr<OPPart> m_OPPart{};
// Receive
@@ -148,13 +158,11 @@ class SPIT_Message {
const OPPart *getOPPart() const { return m_OPPart.get(); }
private:
bool parse();
bool parse(std::vector<char> message);
// Send
public:
SPIT_Message(unique_ptr<OPPart> p_OPPart);
bool fillBytes();
const std::vector<char> *getMessageBytes();
static std::vector<char> createMessage(OPPart & p_OPPart);
//------------------------------ Connection ----------------------------------
@@ -387,15 +395,15 @@ class SPIT_Message {
static constexpr int BYTESLENGTH = 168;
private:
bool m_Confirmed {};
string m_SPITTypeID {};
bool m_Fixed {};
bool m_ServerRemote {};
bool m_ServerProjectIndepended {};
string m_SPITTypeGroupName {};
string m_SPITTypeName {};
long long m_Delay {};
long long m_Duration {};
bool m_Confirmed{};
string m_SPITTypeID{};
bool m_Fixed{};
bool m_ServerRemote{};
bool m_ServerProjectIndepended{};
string m_SPITTypeGroupName{};
string m_SPITTypeName{};
long long m_Delay{};
long long m_Duration{};
public:
ReportSPITType(const ReportSPITType &orig);
@@ -528,7 +536,6 @@ class SPIT_Message {
void setDuration(long long p_Duration);
void setActionAssigned(bool p_ActionAssigned) { m_ActionAssigned = p_ActionAssigned; }
bool fillBytes(std::vector<char> &message);
};
//----------- RemoveSPITObject -----------