📄 device.cpp
字号:
// Device.cpp: implementation of the CDevice class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Device.h"
extern int TimePassed;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDevice::CDevice(CString DeviceName)
: DeviceType(DeviceName)
{
DeviceStatus=idlesse;
CurrentProcess=NULL;
DeviceStepInfo=NULL;
}
void CDevice::Run(){//运行这个设备
// if(NULL!=DeviceStepInfo)
// cout<<TimePassed<<" "<<DeviceStepInfo->GetLeftTime()<<" "<<DeviceStepInfo->GetProcessName()<<" "<<DeviceStepInfo->GetDeviceType()<<endl;
if(busy==GetStatus()){
CurrentProcess->Run();
if (CurrentProcess->StepFinished())
{
// cout<<"TimePassed:"<<TimePassed<<endl;
DeviceStepInfo->SetEndTime(TimePassed); //记录使用设备结束。
UseHistory.Add(DeviceStepInfo); //记录历史信息
DeviceStepInfo=NULL;
SetStatus(idlesse);
CurrentProcess->WaitNextDevice();
}
}
}
void CDevice::CheckIdlesse(){
if (idlesse==GetStatus()){
int QueueCount=0;
QueueCount=Queue.GetSize();
if(QueueCount>0){
CurrentProcess=(CProcess*)Queue.GetAt(0);
Queue.RemoveAt(0);
if (NULL!=DeviceStepInfo){
if (DeviceStepInfo->GetStartTime()==DeviceStepInfo->GetEndTime())
UseHistory.Add(DeviceStepInfo);
DeviceStepInfo->SetEndTime(TimePassed);
}
DeviceStepInfo=CurrentProcess->GetCurrentDevice();
DeviceStepInfo->SetStartTime(TimePassed);
SetStatus(busy);
}else{
if (NULL==DeviceStepInfo){
DeviceStepInfo=new CUseDevice("null",GetDeviceType());
DeviceStepInfo->SetStartTime(TimePassed);
DeviceStepInfo->SetEndTime(TimePassed);
DeviceStepInfo->SetRequestTimeLength(0);
}else{
if (DeviceStepInfo->GetStartTime()==DeviceStepInfo->GetEndTime())
UseHistory.Add(DeviceStepInfo);
DeviceStepInfo->SetEndTime(TimePassed);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -