// ntc.cc

#include <iostream>
#include <fstream>

using namespace std;

#include "model.h"
#include "compare.h"
#include "ntc.h"

bool NOISY = false;

int main(int argc, char * argv[]) {

	int ofs = 1;

	if (argc > 1 && string(argv[1]) == "-d") {
		NOISY = true;
		ofs ++;
	}
	if (argc != 2+ofs) {
		cerr << "Usage: " << argv[0] << " [ -d ] file1 file2" << endl;
		return 1;
	}

	model m1, m2;

	ifstream i;

	i.open(argv[ofs]);
	m1.read(i);
	i.close();

	if (NOISY) {
		cout << "First model read:" << endl;
		m1.write(cout);
	}

	i.open(argv[ofs+1]);
	m2.read(i);
	i.close();

	if (NOISY) {
		cout << "Second model read:" << endl;
		m2.write(cout);
	}

	if (NOISY) {
		cout << "Comparing models:" << endl;
	}
	if (compare(m1, m2)) {
		if (NOISY) {
			cout << "They match" << endl;
		}
		return 0;
	} else {
		if (NOISY) {
			cout << "They don't match" << endl;
		}
		return 1;
	}

	return 0;

}

