?? 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 + -