예제 #1
0
/// @return true if the DAG in the SL structure is the same that is loaded
static bool
VerifyDag ( const DLDag& dag, SaveLoadManager& m )
{
	unsigned int j, size;
	size = m.loadUInt();

	if ( size != dag.size() )
	{
		std::cout << "DAG verification fail: size " << size << ", expected " << dag.size() << "\n";
		return false;
	}

	for ( j = 2; j < size; ++j )
	{
		DagTag tag = static_cast<DagTag>(m.loadUInt());
		DLVertex* v = new DLVertex(tag);
		v->Load(m);
		if ( *v != dag[j] )
		{
			std::cout << "DAG verification fail: dag entry at " << j << " is ";
			v->Print(std::cout);
			std::cout << ", expected ";
			dag[j].Print(std::cout);
			std::cout << "\n";
			delete v;
			return false;
		}
		delete v;
	}

	return true;
}
예제 #2
0
void
LoadDLDag ( DLDag& dag, SaveLoadManager& m )
{
	unsigned int j, size;
	size = m.loadUInt();
	for ( j = 2; j < size; ++j )
	{
		DagTag tag = static_cast<DagTag>(m.loadUInt());
		DLVertex* v = new DLVertex(tag);
		v->Load(m);
		dag.directAdd(v);
	}

	// only reasoning now -- no cache
	dag.setFinalSize();
}