diff --git a/src/andGate.cpp b/src/andGate.cpp index f344b60..27deace 100644 --- a/src/andGate.cpp +++ b/src/andGate.cpp @@ -3,11 +3,16 @@ using namespace std; andGate::andGate(priority_queue *eQueue, int d, wire* wire1, wire* wire2, - wire* wire3) : e(eQueue), delay(d), in1(wire1), in2(wire2), out(wire3) {} - + wire* wire3) { + e = eQueue; + delay = d; + in1 = wire1; + in2 = wire2; + out = wire3; +} int andGate::evaluate(int evTime) { - int val1 = in1->getValue(); - int val2 = in2->getValue(); + int val1 = in1->getValue(evTime); + int val2 = in2->getValue(evTime); if(val1 != -1 && val2 != -1) { return val1 && val2; } diff --git a/src/andGate.h b/src/andGate.h index 009bc11..9b1234f 100644 --- a/src/andGate.h +++ b/src/andGate.h @@ -1,5 +1,8 @@ #ifndef AND #define AND +#include "gate.h" +#include "event.h" +#include "wire.h" class andGate : public gate { public: diff --git a/src/event.cpp b/src/event.cpp index bff04e1..805aab7 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -1,7 +1,11 @@ #include "event.h" -event::event(int num, int value, int setTime, int wire, wire *output) : evNum(num), evValue(value), - evTime(setTime), out(output) {} +event::event(int num, int value, int setTime, wire * output){ + evNum = num; + evValue = value; + evTime = setTime; + out = output; +} bool event::operator<(const event &e1) { if(evTime == e1.evTime) { diff --git a/src/event.h b/src/event.h index 2a6833c..a8df798 100644 --- a/src/event.h +++ b/src/event.h @@ -1,9 +1,9 @@ #ifndef EVENT #define EVENT + using namespace std; #include "wire.h" - class event { public: event(int num, int value, int setTime, wire * output); diff --git a/src/norGate.h b/src/norGate.h index 8b17022..a904cab 100644 --- a/src/norGate.h +++ b/src/norGate.h @@ -1,5 +1,8 @@ #ifndef NOR #define NOR +#include "gate.h" +#include "event.h" +#include "wire.h" class norGate : public gate { norGate(priority_queue *eQueue, int d, wire* wire1, wire* wire2, diff --git a/src/notGate.cpp b/src/notGate.cpp index b7225d2..8634950 100644 --- a/src/notGate.cpp +++ b/src/notGate.cpp @@ -2,8 +2,13 @@ using namespace std; -notGate::notGate(priority_queue *eQueue, int d, wire* wire1, wire* wire2) - : e(eQueue), delay(gateDelay), in1(wire1), out(wire2) {} +notGate::notGate(priority_queue *eQueue, int d, wire* wire1, wire* wire2) { + e = eQueue; + delay = d; + in1 = wire1; + out = wire2; + +} void notGate::evaluate(int evTime) { int val = in1->getValue(); diff --git a/src/orGate.h b/src/orGate.h index e31744a..89a881f 100644 --- a/src/orGate.h +++ b/src/orGate.h @@ -1,7 +1,10 @@ #ifndef OR #define OR +#include "gate.h" +#include "event.h" +#include "wire.h" -class xnorGate : public gate { +class orGate : public gate { orGate(priority_queue *eQueue, int d, wire* wire1, wire* wire2, wire* wire3); void evaluate(int evTime); diff --git a/src/xnorGate.h b/src/xnorGate.h index ec0e344..47d67da 100644 --- a/src/xnorGate.h +++ b/src/xnorGate.h @@ -1,5 +1,8 @@ #ifndef XNOR #define XNOR +#include "gate.h" +#include "event.h" +#include "wire.h" class xnorGate : public gate { xnorGate(priority_queue *eQueue, int d, wire* wire1, wire* wire2, diff --git a/src/xorGate.cpp b/src/xorGate.cpp index 0243f7e..0d356b2 100644 --- a/src/xorGate.cpp +++ b/src/xorGate.cpp @@ -3,8 +3,13 @@ using namespace std; xorGate::xorGate(priority_queue *eQueue, int d, wire* wire1, - wire* wire2, wire* wire3) : e(eQueue), delay(d), in1(wire1), in2(wire2), - out(wire3); + wire* wire2, wire* wire3) { + e = eQueue; + delay = d; + in1 = wire1; + in2 = wire2; + out = wire3; +} void xorGate::evaluate(int evTime) { //TODO diff --git a/src/xorGate.h b/src/xorGate.h index 2bb0c6f..2ec40c9 100644 --- a/src/xorGate.h +++ b/src/xorGate.h @@ -1,5 +1,8 @@ #ifndef XOR #define XOR +#include "gate.h" +#include "event.h" +#include "wire.h" class xorGate : public gate { xorGate(priority_queue *eQueue, int d, wire* wire1, wire* wire2,