simevent.h

来自「模拟P2P各种网络环境的,适合新手们的学习,不错的源码.」· C头文件 代码 · 共 88 行

H
88
字号
#ifndef __SIMEVENT_H__
#define __SIMEVENT_H__
#include "SimEventHandler.h"
class SimEvent{

protected:

//event type
int mType; 

//event timeStamp
double mTimeStamp;

//my handlerList
SimEventHandler* mHandler;

//mayor parameter
void* mParam;

//add parametr
void* mAddParam;

//***my event ID;
int mEventID;

static int NEXTEVENT;

public:
	
SimEvent(int type, double timeStamp, SimEventHandler* Handler,  void* param);
~SimEvent(void){}


int getType(void){
	return mType;
}

void setType( int type){
	mType = type;
}

double getTimeStamp(void){
	return mTimeStamp;
}

void setTimeStamp(double timeStamp){
	mTimeStamp = timeStamp;
}

void* getParam(void){
	return mParam;
}

void setParam(void* param){
	mParam = param;
}

void* getAddParam(void){
	return mAddParam;
}

void setAddParam(void* addparam){
	mAddParam = addparam;
}

void dispatch(void){
	mHandler->handler(this);
}
/*
void dispatch(void){
	return;
}
*/
void SetEventID(void){
	mEventID = NEXTEVENT++;
}

int getEventID(void){
	return mEventID;
}
//bool operator <( SimEvent& event );
//void printEvent(char* flag, char* buf, int* buflen);

};

#endif

⌨️ 快捷键说明

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