📄 process.cpp
字号:
// Process.cpp: implementation of the CProcess class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Process.h"
#include "Device.h"
extern CPtrArray DeviceList;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CProcess::CProcess(CString pname){
ProcessName=pname;
CurrentDevice=NULL;
ProcessStatus=NotStated;
StepStatus=NotStated;
}
CProcess::~CProcess(){
CUseDevice *ud=NULL;
while (ToUseDevice.GetSize()>0){
ud=(CUseDevice*)ToUseDevice.GetAt(0);
ToUseDevice.RemoveAt(0);
delete ud;
ud=NULL;
}
}
void CProcess::Run(){
if (Finished!=GetProcessStatus()){
CurrentDevice->UseDevice();
if(CurrentDevice->Done()){
SetStepStatus(Finished);
}
}
}
void CProcess::WaitNextDevice(){
int ToUseDeviceCount=0;
ToUseDeviceCount=ToUseDevice.GetSize(); //取得需要使用设备的次数
if(ToUseDeviceCount>0){
CurrentDevice=(CUseDevice*)ToUseDevice.GetAt(0); //取得下一次需要使用的设备作为进程的当前设备
ToUseDevice.RemoveAt(0);
int DeviceCount=0;
DeviceCount=DeviceList.GetSize(); //取得可使用的设备个数
if(DeviceCount){
CDevice *dev;
for(int i=0;i<DeviceCount;i++){ //查找进程需要的设备
dev=(CDevice*)DeviceList.GetAt(i);
if (dev->GetDeviceType()==CurrentDevice->GetDeviceType()){ //找到进程需要的设备,加入设备的等待队列
dev->Wait(this);
break;
}
}
SetStepStatus(Waiting);//设置进程状态为等待
}
}else{
SetProcessStatus(Finished);
}
}
BOOL CProcess::AddStep(CUseDevice step){
CUseDevice* UseDev=NULL;
UseDev=new CUseDevice(step);
ToUseDevice.Add(UseDev);
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -