예제 #1
0
파일: plugop.cpp 프로젝트: vata/xarino
void PlugInOp::Do(OpDescriptor* pOpDesc)
{
	if (pOpDesc == NULL)
	{
		ERROR3IF(pOpDesc == NULL,"PlugInOp::Do null OpDescriptor");
		return;
	}
	//ERROR3("PlugInOp - do");

	// Search the plug-ins list for the specified plug-in and invoke it
	PlugInManager* pManager = GetApplication()->GetPlugInManager();
	if (pManager == NULL)
		return;

	PlugInItem * pPlugIn = pManager->GetFirstPlugIn();
	String_32 OpToken;
	while (pPlugIn)
	{
		OpToken = pPlugIn->GetUniqueID();
		OpToken += pPlugIn->GetPlugInName();
		if (pOpDesc->Token == OpToken)
			pPlugIn->About();

		pPlugIn = pManager->GetNextPlugIn(pPlugIn);
	}

	// and finish
	End();
}
예제 #2
0
/**
 * Constructs a new ScriptedFitnessFunction.
 *
 * @pram name the name of the new FitnessFunction.
 */
ScriptedFitnessFunction::ScriptedFitnessFunction(const QString &name)
	: ScriptingContext(name), ControllerFitnessFunction(name), 
		mScriptFileNameArg(0), mSimEnvironmentChangedEvent(0)
{
	PlugInManager *pm = Core::getInstance()->getPlugInManager();

	mScriptFileNameArg = pm->getCommandLineArgument("fitnessScriptFile");
	if(mScriptFileNameArg == 0) {
		mScriptFileNameArg = new CommandLineArgument("fitnessScriptFile", "fsf", 
				"<fitnessName> <fileName>",
				"Loads a fitness function script from file <fileName> and attaches it "
				"to the ScriptedFitnessFunction with name <fitnessName>.",
				2, 0, true, true);
	}

	//script code is initialized with a simple but valid fitness script, just counting the steps.
	mScriptCode->setValueFromString(QString("") 
					+ "function reset() {/**/};/**//**/function calc()"
					+ " {/**/  return fitness + 1;/**/};");
	
	mScriptCode->setErrorValue(mErrorState);
	
	mResetScriptContext = new BoolValue(false);

	addParameter("Code", mScriptCode);
	addParameter("FileName", mScriptFileName);
	addParameter("ResetScriptingContext", mResetScriptContext);
}
예제 #3
0
void PlugInUndoOp::Do(OpDescriptor* pOpDesc)
{
	if (pOpDesc == NULL)
	{
		ERROR3IF(pOpDesc == NULL,"PlugInUndoOp::Do null OpDescriptor");
		return;
	}
	//ERROR3("PlugInUndoOp - do");

	// Store away a copy of the OpDescriptor for later use
	m_pOpDesc = pOpDesc;

	// Search the plug-ins list for the specified plug-in and invoke it
	PlugInManager* pManager = GetApplication()->GetPlugInManager();
	if (pManager == NULL)
		return;

	PlugInItem * pPlugIn = pManager->GetFirstPlugIn();
	String_32 OpToken;
	while (pPlugIn)
	{
		OpToken = pPlugIn->GetUniqueID();
		OpToken += pPlugIn->GetPlugInName();
		if (pOpDesc->Token == OpToken)
		{
			// Do Something
			break;
		}

		pPlugIn = pManager->GetNextPlugIn(pPlugIn);
	}

	// If we reached here then everything has happened ok and we can just end the
	// operation and exit 
	End();

	return;
}