コード例 #1
0
void MASTER::Proceed(ELEMENT* starting_element)
{
	// listy u¿ywane podczas obliczeñ
	OUTPUT_LIST list1;
	OUTPUT_LIST list2;
	OUTPUT_LIST* current_list = &list1;
	OUTPUT_LIST* next_list = &list2;

	// utworzenie listy startowej
	InitProcessing(starting_element, elements_set, current_list);

	// g³ówna pêtla
	unsigned i;
	for (i = 0; i < elements_set.RetAmount() * 2; i++)
	{
		bool state_changed = false;

		// właściwe działanie elementów 
		// (dla NANDÓW jest to albo odczytanie stanów wejściowych i propagacja 
		// albo ustalenie stanu i wysłanie sygnału do nowych elementów (czyli dodanie ich do next_list)
		// dla pozostałych elementów jest to po prostu ustalenie stanu
		for (unsigned j = 0; j < current_list->retAmount(); j++)
		{
			state_changed |= (*current_list)[j]->element->Proceed(next_list);

			char u = (*current_list)[j]->element->RetId()+'0';
			//MessageBox(hwnd, &u, "debug", MB_OK);
		}

		// zamiana wskaźników
		SwitchLists(current_list, next_list);

		if (starting_element && !state_changed)
			break;
	}


	//if (i && i == elements_set.RetAmount() * 2 && !unstable_system_notification)
	//{
	//	MessageBox(hwnd, "Podany układ jest niestabilny.", "NAND2", MB_OK);
	//	unstable_system_notification = true;
	//}
	Paint();
	return;
}
コード例 #2
0
ContoursProcessor::ContoursProcessor( char* lname ): VideoProcessor( lname )
{
	GuiOptions= new ContoursOptions();
	WorkingOptions= new ContoursOptions();
	InitProcessing();
}