Esempio n. 1
0
void
CMLink::RunNextCommand()
{
	if (!itsForegroundQ->IsEmpty() && OKToSendMultipleCommands())
		{
		const JSize count = itsForegroundQ->GetElementCount();
		for (JIndex i=1; i<=count; i++)
			{
			CMCommand* command = itsForegroundQ->NthElement(i);
			if (command->GetState() != CMCommand::kExecuting)
				{
				SendMedicCommand(command);
				}
			}
		}
	else if (!itsForegroundQ->IsEmpty())
		{
		CMCommand* command = itsForegroundQ->FirstElement();
		if (command->GetState() != CMCommand::kExecuting && OKToSendCommands(kJFalse))
			{
			SendMedicCommand(command);
			}
		}
	else if (!itsBackgroundQ->IsEmpty() && OKToSendCommands(kJTrue))
		{
		CMCommand* command = itsBackgroundQ->FirstElement();
		if (command->GetState() != CMCommand::kExecuting)
			{
			SendMedicCommand(command);
			}
		}
}