timeblock.h

来自「这个也是我们的毕业设计课题」· C头文件 代码 · 共 52 行

H
52
字号
//TimeBlock.h
//class TimeBlock defination
//used for simulating the TimeBlock
//refer to CPU.H , RelationShip between CPU and 
//TimeBlock

//design target:
//can provide different time cycle
//can be easily adjusted
//use MultiMedia Timer implementing this function
//NOTE: the timer function is 
//Declared in mmsystem.h
//and you also be required import Library:  winmm.lib
#include <mmsystem.h>
//function declare:
void timeKillEvent(UINT	uTimerID);
void CALLBACK TimePro( 
	UINT uID,      
	UINT uMsg,     
	DWORD dwUser,  
	DWORD dw1,     
	DWORD dw2  
	);
MMRESULT timeSetEvent(  
	UINT uDelay,                
	UINT uResolution,           
	LPTIMECALLBACK lpTimeProc,  
	DWORD dwUser,               
	UINT fuEvent  
	);
//declare the classes that will be used in the class
//TimeBlock
class TimeBlock
{
private:
	UINT m_uTimeID;//the timerID
	CPU* _cpu;//the CPU that the TimeBlock Attach to
	UINT m_uInterval;//the Interval of the time cycle
public:
	//construction/destruction
	TimeBlock();
	TimeBlock(CPU* lpCPU, UINT uInterval);
	~TimeBlock();
	//attribute
	void SetInterval(UINT& uInterval);
	void GetInterval(UINT& uInterval);
	void AttachToCPU(CPU* lpCPU);
	//operation
	void Start();
	void Stop();
	void End();
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?