uofid.h

来自「遗传算法vc++语言版源程序,台湾大学编写。」· C头文件 代码 · 共 45 行

H
45
字号
#ifndef _UOFID_
#define _UOFID_
#include <ostream>

using namespace std;

//! Basic class
/*! All classes in UOF are inherited from this class. Each class from UOFId is assigned to a unique id for identification*/
class UOFId
{public:
	//! This function examine the input class is the same with this class
	/*!return 1 if class b is the same with this, return 0 else	  \param b the UOFId class for comparison	*/	int sameClass(const UOFId &b) const {return(classID() == b.classID());} 
	//! This function returns the name of this class
	/*!Classes inherited from this class should override this funciton to get correct name*/	virtual const char * className() const {return "base uofid class";}
	//! This function returns the ID of this class
	/*!Classes inherited from this class should override this funciton to get correct ID*/	virtual int classID() const {return 0;}
	//! This function output the LogHeader of this class to output stream
	/*!Classes inherited from this class should override this funciton to output the correct LogHeader.
	The LogHeader function should output the necessary information of this class such as current setting.
	*/
	virtual void LogHeader(ostream&){}
};
#define UOFIdentity(name,id) \     const char * className() const {return name;} \     int classID() const {return id;}#define UOFDeclareIdentity() \     const char * className() const; \     int classID() const#define UOFDefineIdentitySRC(clss,name,id) \const char * clss :: className() const {return name;} \int clss :: classID() const {return id;}

#endif


⌨️ 快捷键说明

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