Merge branch 'master-develop' of gitee.com:shenzhen-jiuyilian/ipc into master-develop

This commit is contained in:
Fancy code 2024-04-02 10:45:51 +08:00
commit e5a2d7cfd9
2 changed files with 51 additions and 38 deletions

View File

@ -45,10 +45,7 @@ public:
virtual void GoInState() = 0;
virtual void GoOutState() = 0;
virtual bool ExecuteStateMsg(VStateMachineData *msg) = 0;
std::string GetStateName()
{
return mStateName;
}
std::string GetStateName();
private:
std::string mStateName;
@ -58,41 +55,18 @@ class VStateMachineHandle
public:
VStateMachineHandle() = default;
virtual ~VStateMachineHandle() = default;
virtual bool InitialStateMachine()
{
return false;
}
virtual void StatePlus(State *state, State *upper)
{
}
virtual void SetCurrentState(State *firstState)
{
}
virtual void StartStateMachine()
{
}
virtual void SendMessage(int msgName)
{
}
virtual void StopHandlerThread()
{
}
virtual void SendMessage(int msgName, const std::shared_ptr<VStateMessage> &messageObj)
{
}
virtual bool InitialStateMachine();
virtual void StatePlus(State *state, State *upper);
virtual void SetCurrentState(State *firstState);
virtual void StartStateMachine();
virtual void SendMessage(int msgName);
virtual void StopHandlerThread();
virtual void SendMessage(int msgName, const std::shared_ptr<VStateMessage> &messageObj);
virtual void MessageExecutedLater(int msgName, const std::shared_ptr<VStateMessage> &messageObj,
int64_t delayTimeMs)
{
}
virtual void SwitchState(State *targetState)
{
}
virtual void StopTimer(int timerName)
{
}
virtual void DelayMessage(VStateMachineData *msg)
{
}
int64_t delayTimeMs);
virtual void SwitchState(State *targetState);
virtual void StopTimer(int timerName);
virtual void DelayMessage(VStateMachineData *msg);
};
class IStateMachine
{

View File

@ -15,6 +15,45 @@
#include "IStateMachine.h"
#include "ILog.h"
#include <thread>
std::string State::GetStateName()
{
return mStateName;
}
bool VStateMachineHandle::InitialStateMachine()
{
return false;
}
void VStateMachineHandle::StatePlus(State *state, State *upper)
{
}
void VStateMachineHandle::SetCurrentState(State *firstState)
{
}
void VStateMachineHandle::StartStateMachine()
{
}
void VStateMachineHandle::SendMessage(int msgName)
{
}
void VStateMachineHandle::StopHandlerThread()
{
}
void VStateMachineHandle::SendMessage(int msgName, const std::shared_ptr<VStateMessage> &messageObj)
{
}
void VStateMachineHandle::MessageExecutedLater(int msgName, const std::shared_ptr<VStateMessage> &messageObj,
int64_t delayTimeMs)
{
}
void VStateMachineHandle::SwitchState(State *targetState)
{
}
void VStateMachineHandle::StopTimer(int timerName)
{
}
void VStateMachineHandle::DelayMessage(VStateMachineData *msg)
{
}
std::shared_ptr<IStateMachine> &IStateMachine::GetInstance(std::shared_ptr<IStateMachine> *impl)
{
static std::shared_ptr<IStateMachine> instance = std::make_shared<IStateMachine>();