Further refactoring for better safety and maintainability

This commit is contained in:
2025-04-06 22:46:06 +02:00
parent 47694df8a3
commit 3231120a1e
11 changed files with 291 additions and 406 deletions
+5 -8
View File
@@ -52,11 +52,8 @@ class SPIT_Client : I_SAD_Client {
void (*onServerEvent)(ServerEvent event, const SAD_DetectedServer &p_DetectedServer){};
void (*onConnectionStatus)(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime, int p_ConnectionStatus, int p_OldConnectionStatus){};
void (*onProjectUpdate)(ProjUpdate state, string projectId){};
void (*onSpitType)(ObjectEvent event, const SPITType &p_SPITType){};
void (*onSpitTypeRemote)(ObjectEvent event, const SPITType &p_SPITType){};
void (*onSpitObject)(ObjectEvent event, const SPITType &p_SPITType, const SPITObject &p_SPITObject){};
void (*onSpitObjectRemote)(ObjectEvent event, const SPITType &p_SPITType, const SPITObject &p_SPITObject){};
void (*onSpitType)(ObjectEvent event, bool isRemote, const SPITType &p_SPITType){};
void (*onSpitObject)(ObjectEvent event, bool isRemote, const SPITType &p_SPITType, const SPITObject &p_SPITObject){};
void (*onPlay)(string p_PlayerID, string p_PlayerName, char p_PlayerType, bool p_PlayerIsRunning, long long p_TimeFrames){};
void (*onPlaySpitType)(string p_PlayerID, string p_SPITTypeID, bool p_PlayerIsRunning, bool p_Started, bool p_Ended, double p_Value){};
@@ -96,12 +93,12 @@ class SPIT_Client : I_SAD_Client {
static constexpr char VALUEFLAG_INCREASE = 0x01;
/**Decrease the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
static constexpr char VALUEFLAG_DECREASE = 0x02;
static constexpr int MAX_OVERTAKING_SPIT_MESSAGES = 10;
//----- SPIT_Client -----
public:
SPIT_Client(string name, string projName, Callbacks calls);
virtual ~SPIT_Client();
static int s_MAX_OVERTAKING_SPIT_MESSAGES;
private:
Callbacks mCallbacks;
@@ -120,7 +117,7 @@ class SPIT_Client : I_SAD_Client {
unsigned char m_MessageNumber_Send;
int m_MessageNumber_Received;
vector<SPIT_Message *> m_OvertakingSPIT_Messages;
vector<unique_ptr<SPIT_Message>> m_OvertakingSPIT_Messages;
// Server's info filled by parseConnectAnswer
string m_ServerID{};
@@ -220,7 +217,7 @@ class SPIT_Client : I_SAD_Client {
void resetMessageNumberReceived();
void parseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
void checkParseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
void addOvertakingSPIT_Message(SPIT_Message *p_SPIT_Message);
void addOvertakingSPIT_Message(unique_ptr<SPIT_Message> p_SPIT_Message);
void parseConnectAnswer(SPIT_Message::ConnectAnswer *p_ConnectAnswer);
void parseDisconnect(SPIT_Message::Disconnect *p_Disconnect);
void parseWatchdog(SPIT_Message::Watchdog *p_Watchdog);