コード例 #1
0
//----------------------------------------------------------------------------------------
// RemovePendingCommandForUIDRef
//----------------------------------------------------------------------------------------
void
AZPAMAssetMonitor::RemovePendingCommandForUIDRef(
	const UIDRef &				inAssetRef)
{
	//LogFunctionEnterExit;
	if( fPendingCommands.size() > 0 )
	{
		K2Vector<ICommand *>::iterator iter = fPendingCommands.begin();
		K2Vector<ICommand *>::iterator endIter = fPendingCommands.end();
		while( iter != endIter )
		{
			ICommand * currVal = *iter;
			const UIDRef & cmdTarget = currVal->GetTarget();
			if( cmdTarget == inAssetRef )
			{
				fPendingCommands.erase( iter );	//Don't increament the iter.
				currVal->Release();
				endIter = fPendingCommands.end();
			}
			else
			{
				++iter;
			}
		}
	}
}
コード例 #2
0
//----------------------------------------------------------------------------------------
// GetHandleChangesCommand
//----------------------------------------------------------------------------------------
ICommand *
AZPAMAssetMonitor::GetHandleChangesCommand()
{
	//LogFunctionEnterExit;
	ICommand * toReturn = nil;
	if( fPendingCommands.size() > 0 )
	{
		K2Vector<ICommand *>::iterator iter = fPendingCommands.begin();
		K2Vector<ICommand *>::iterator endIter = fPendingCommands.end();
		while( iter != endIter )
		{
			ICommand * currVal = *iter;
			if( currVal->GetCommandState() == ICommand::kNotDone )
			{	
				//Keep the command in pending list
				//otherwise we get a crash if release else leak if not released.
				toReturn = currVal;
				break;
			}
			else
			{
				fPendingCommands.erase( iter );	//Don't increament the iter.
				currVal->Release();
				endIter = fPendingCommands.end();
			}
		}
	}
	return toReturn;
}