From 972e05d80f68f4a79bd538cd6fd1ef13f6cac2c7 Mon Sep 17 00:00:00 2001
From: 3A <524019351@qq.com>
Date: Tue, 22 Dec 2020 09:27:08 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E4=B8=80=E4=BA=9B=E5=87=BD=E6=95=B0?=
=?UTF-8?q?=E7=94=B1=E5=9C=A8=E5=87=BD=E6=95=B0=E9=87=8C=E8=BE=93=E5=87=BA?=
=?UTF-8?q?=E6=94=B9=E6=88=90=E8=BF=94=E5=9B=9Estring?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
LogicalCircuit.pro | 2 +-
LogicalCircuit.pro.user | 91 +++++++++++++++++++++++++----------------
node.h | 35 ++++++++++------
script.cpp | 6 +--
script.h | 5 +++
5 files changed, 86 insertions(+), 53 deletions(-)
diff --git a/LogicalCircuit.pro b/LogicalCircuit.pro
index e71b44f..440f72d 100644
--- a/LogicalCircuit.pro
+++ b/LogicalCircuit.pro
@@ -1,7 +1,7 @@
TEMPLATE = app
CONFIG += console c++17
CONFIG -= app_bundle
-CONFIG += qt
+CONFIG -= qt
SOURCES += main.cpp \
node.cpp \
diff --git a/LogicalCircuit.pro.user b/LogicalCircuit.pro.user
index 2d29b5c..bf69f01 100644
--- a/LogicalCircuit.pro.user
+++ b/LogicalCircuit.pro.user
@@ -1,10 +1,10 @@
-
+
EnvironmentId
- {5cdfc2d9-746f-4959-a869-d810886911bf}
+ {75a8c3ac-80c1-4dc0-9a16-c134243a813d}
ProjectExplorer.Project.ActiveTarget
@@ -54,19 +54,24 @@
ProjectExplorer.Project.PluginSettings
-
+
+
+ -fno-delayed-template-parsing
+
+ true
+
ProjectExplorer.Project.Target.0
- Desktop Qt 5.8.0 MinGW 32bit
- Desktop Qt 5.8.0 MinGW 32bit
- qt.58.win32_mingw53_kit
+ Desktop Qt 5.13.2 MinGW 32-bit
+ Desktop Qt 5.13.2 MinGW 32-bit
+ qt.qt5.5132.win32_mingw73_kit
0
0
0
- D:/gitreg/build-LogicalCircuit-Desktop_Qt_5_8_0_MinGW_32bit-Debug
+ D:/QTproject/build-LogicalCircuit-Desktop_Qt_5_13_2_MinGW_32_bit-Debug
true
@@ -84,13 +89,14 @@
Make
Qt4ProjectManager.MakeStep
-
+
false
+ false
2
- 构建
+ Build
ProjectExplorer.BuildSteps.Build
@@ -100,13 +106,14 @@
Make
Qt4ProjectManager.MakeStep
-
+
true
clean
+ false
1
- 清理
+ Clean
ProjectExplorer.BuildSteps.Clean
@@ -114,13 +121,13 @@
false
Debug
-
+ Debug
Qt4ProjectManager.Qt4BuildConfiguration
2
true
- D:/gitreg/build-LogicalCircuit-Desktop_Qt_5_8_0_MinGW_32bit-Release
+ D:/QTproject/build-LogicalCircuit-Desktop_Qt_5_13_2_MinGW_32_bit-Release
true
@@ -131,20 +138,21 @@
false
false
- false
+ true
true
Make
Qt4ProjectManager.MakeStep
-
+
false
+ false
2
- 构建
+ Build
ProjectExplorer.BuildSteps.Build
@@ -154,13 +162,14 @@
Make
Qt4ProjectManager.MakeStep
-
+
true
clean
+ false
1
- 清理
+ Clean
ProjectExplorer.BuildSteps.Clean
@@ -168,13 +177,13 @@
false
Release
-
+ Release
Qt4ProjectManager.Qt4BuildConfiguration
0
true
- D:/gitreg/build-LogicalCircuit-Desktop_Qt_5_8_0_MinGW_32bit-Profile
+ D:/QTproject/build-LogicalCircuit-Desktop_Qt_5_13_2_MinGW_32_bit-Profile
true
@@ -185,20 +194,21 @@
false
true
- false
+ true
true
Make
Qt4ProjectManager.MakeStep
-
+
false
+ false
2
- 构建
+ Build
ProjectExplorer.BuildSteps.Build
@@ -208,13 +218,14 @@
Make
Qt4ProjectManager.MakeStep
-
+
true
clean
+ false
1
- 清理
+ Clean
ProjectExplorer.BuildSteps.Clean
@@ -222,7 +233,7 @@
false
Profile
-
+ Profile
Qt4ProjectManager.Qt4BuildConfiguration
0
true
@@ -236,13 +247,22 @@
ProjectExplorer.BuildSteps.Deploy
1
- 在本地部署
+ Deploy Configuration
ProjectExplorer.DefaultDeployConfiguration
1
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+ -F
+ true
+ 4096
false
false
1000
@@ -257,6 +277,7 @@
0.01
10
true
+ kcachegrind
1
25
@@ -286,19 +307,17 @@
LogicalCircuit
- Qt4ProjectManager.Qt4RunConfiguration:D:/gitreg/LogicalCircuit/LogicalCircuit.pro
- true
-
- LogicalCircuit.pro
- false
-
- D:/gitreg/build-LogicalCircuit-Desktop_Qt_5_8_0_MinGW_32bit-Debug
+ Qt4ProjectManager.Qt4RunConfiguration:D:/QTproject/sg-logical-circuit/LogicalCircuit.pro
+
3768
false
true
+ true
false
false
true
+
+ D:/QTproject/build-LogicalCircuit-Desktop_Qt_5_13_2_MinGW_32_bit-Debug
1
@@ -309,10 +328,10 @@
ProjectExplorer.Project.Updater.FileVersion
- 18
+ 22
Version
- 18
+ 22
diff --git a/node.h b/node.h
index 2227736..0c6876f 100644
--- a/node.h
+++ b/node.h
@@ -150,14 +150,16 @@ class nodeManager
void addInputLine(line* n) { allInput.push_back(n); }
void addOutputLine(line* n) { allOutput.push_back(n); }
- void gateNum()
+ string gateNum()
{
- cout<<"Gate:"< num;
for(node* i : allNode)
num[i->g->getName()]+=1;
for(auto i : num)
- cout<getName()<<"]"<get()<<" ";
+ result+="["+i->getName()+"]"+to_string(i->get())+" ";
if(outputSta)
{
- cout<<" || ";
+ result+=" || ";
for(uint i=0;ig);
- cout<<"["<getQ()<<" ";
+ result+="["+to_string(i)+"]"+to_string(t->getQ())<+" ";
}
}
- cout<<" -> ";
+ result+=" -> ";
for(uint i=0;iget()<<" ";
+ result+="["+to_string(i)+"]"+to_string(allOutput[i]->get())+" ";
- cout<result;
for(node* i : allNode)
@@ -237,10 +244,12 @@ class nodeManager
}
for(auto i : result)
{
- cout<<"["<trueTable(0,true);
else if(sen=="gateNum")
- manager->gateNum();
+ cout<gateNum();
else if(sen=="run")
- manager->run();
+ cout<run();
else if(sen=="stru")
manager->stru();
else if(sen=="clear")
@@ -149,7 +149,7 @@ void script::commandExp(string sen)
else if(sen=="middleVar")
manager->middleVar();
else if(sen=="multiplexing")
- manager->multiplexing();
+ cout<multiplexing();
else if(sen=="resetTri")
manager->resetTri();
else
diff --git a/script.h b/script.h
index 5de8cd1..eed5bb9 100644
--- a/script.h
+++ b/script.h
@@ -13,6 +13,11 @@ class script
public:
map lineMap; //没有所有权
script() { this->manager=new nodeManager; }
+ ~script()
+ {
+ delete this->manager;
+ lineMap.clear();
+ }
void clear();
void eval(string sen);