fix several data member/member function confuzzlings

This commit is contained in:
Joel Beckmeyer 2017-04-24 21:15:16 -04:00
parent 75f7f3abd9
commit b326f08971

View File

@ -129,7 +129,7 @@ void Simulation::simulate() {
int index = 0; int index = 0;
do{ do{
tmpGate = output->getGate(index++); tmpGate = output->getGate(index++);
e.push(tmpGate->evaluate(tmpEvent.evTime)); e.push(tmpGate->evaluate(tmpEvent.getTime()));
}while(tmpGate != nullptr); }while(tmpGate != nullptr);
} }
} }
@ -141,20 +141,20 @@ void Simulation::print()
int tmpTime = 0; int tmpTime = 0;
// iterate through wires, finding wire with last event time // iterate through wires, finding wire with last event time
for(auto i = wires.begin(); i != wires.end(); ++i) { for(auto i = wires.begin(); i != wires.end(); ++i) {
if(i->getLast() > lastTime) { if((**i).getLast() > lastTime) {
lastTime = i->getLast(); lastTime = (**i).getLast();
} }
} }
// now iterate through wires, printing each of them // now iterate through wires, printing each of them
for(auto i = wires.begin(); i != wires.end(); ++i) { for(auto i = wires.begin(); i != wires.end(); ++i) {
i->setLast(lastTime); (**i).setLast(lastTime);
cout << *i; cout << *i;
} }
int t = 0; int t = 0;
cout << setw(10) << "TIME"; cout << setw(10) << "TIME";
cout.setw(5); cout << setw(5);
while(t <= 60 && t <= lastTime) { while(t <= 60 && t <= lastTime) {
cout << t; cout << t;
t += 5; t += 5;