v6502cpp/TransNetwork.cpp

28 lines
691 B
C++
Raw Permalink Normal View History

/*
* File: TransNetwork.cpp
* Author: cmosher
*
* Created on December 11, 2013, 10:44 AM
*/
#include "TransNetwork.h"
2013-12-15 19:00:43 +00:00
#include "TransCache.h"
#include "SegmentCache.h"
#include "StateCalculator.h"
#include "trans.h"
#include <iostream>
#include <set>
#include <string>
2013-12-12 13:37:45 +00:00
#include <memory>
2013-12-15 19:00:43 +00:00
TransNetwork::TransNetwork(std::istream& in, SegmentCache& segs, TransCache& transes) : segs(segs), transes(transes) {
std::string c1, gate, c2;
2013-12-12 13:37:45 +00:00
in >> c1 >> gate >> c2;
while (in.good()) {
2013-12-15 19:00:43 +00:00
this->transes.add(this->segs.getOrAdd(c1), this->segs.getOrAdd(gate), this->segs.getOrAdd(c2));
2013-12-12 13:37:45 +00:00
in >> c1 >> gate >> c2;
}
2013-12-12 22:05:33 +00:00
StateCalculator::recalc(this->segs.all());
}