📄 classdevice.h
字号:
#ifndef CLASSDEVICE_H
#define CLASSDEVICE_H
#include "Datastruct.h"
#include "Linklist.h"
//元件基类
class Device
{
protected:
int delaytime; //延时
LinkList input1;
LinkList input2;
LinkList output;
bool inputtag1; //输入一标记
bool inputtag2;
bool outputtag;
void Calculasttime(); //计算持续时间
void Delcommon(); //合并相邻的相同信号
void Delay();
public:
char name[255]; // 记录用户为器件起的名字
virtual bool LogicExpression(bool A, bool B);
bool GetResponse();
LinkList GetOutput();
void SetInput1(LinkList systeminput);
void SetInput2(LinkList systeninput);
void SetOutputTag();
void SetInputTag1();
void SetInputTag2();
bool Ifinput(); //判断是否两个输入都已经被赋值,是则返回true,否则返回false
bool Ifoutput(); //判断输出是否已经计算出,是则返回true,否则返回false
};
//与门
class DeviceAND:public Device
{
public:
DeviceAND();
bool LogicExpression(bool A, bool B);
};
//或门
class DeviceOR:public Device
{
public:
DeviceOR();
bool LogicExpression(bool A, bool B);
};
//非门
class DeviceNOT
{
private:
int delaytime;
LinkList input;
LinkList output;
bool inputtag;
bool outputtag;
void Delay();
public:
char name[255]; // 记录用户为器件起的名字
DeviceNOT();
LinkList GetOutput();
void Calculasttime();
void SetInput(LinkList systeminput);
void SetInputTag();
void SetOutputTag();
bool GetResponse();
bool Ifinput(); //判断是否输入已经被赋值,是则返回true,否则返回false
bool Ifoutput(); //判断输出是否已经计算出,是则返回true,否则返回false
};
//与非门
class DeviceNAND:public Device
{
public:
DeviceNAND();
bool LogicExpression(bool A, bool B);
};
//异或门
class DeviceXOR:public Device
{
public:
DeviceXOR();
bool LogicExpression(bool A, bool B);
};
//同或门
class DeviceNXOR:public Device
{
public:
DeviceNXOR();
bool LogicExpression(bool A, bool B);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -