Commit 6cf39ada authored by Anton Hattendorf's avatar Anton Hattendorf
Browse files

added transformation provider

refs 920
parent e66ca93b
......@@ -17,4 +17,16 @@
uri="http://www.fortiss.org/af3/multicore">
</package>
</extension>
<extension point="org.fortiss.tooling.kernel.transformationProvider">
<transformationProvider transformationProvider="org.fortiss.af3.multicore.generator.transform.NiosIICoreTransformation">
<source>
<objectClass objectClass="org.fortiss.af3.multicore.model.NiosIICore">
</objectClass>
</source>
<target>
<objectClass objectClass="org.fortiss.af3.multicore.generator.executable.NiosIICoreExecutable">
</objectClass>
</target>
</transformationProvider>
</extension>
</plugin>
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.multicore.generator.executable;
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall;
import java.util.List;
import org.conqat.lib.commons.collections.Pair;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.expression.model.terms.IExpressionTerm;
import org.fortiss.af3.generator.common.model.c.CSourcePackage;
import org.fortiss.af3.platform.language.executable.ExecutionUnitExecutableBase;
import org.fortiss.af3.platform.language.executable.IInitializableExecutable;
import org.fortiss.af3.platform.language.executable.ITerminatableExecutable;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.PlatformConnectorUnit;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
/**
* {@link IInitializableExecutable} and {@link ITerminatableExecutable} for the
* generic platform ECU.
*
* @author hoelzl
* @author wandinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8E408D8D0D8DF90F542C8F146A67E02E
*/
public class NiosIICoreExecutable extends
ExecutionUnitExecutableBase<ExecutionUnit, CSourcePackage> {
/** Constructor. */
public NiosIICoreExecutable(ExecutionUnit modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
public IExpressionTerm getInitialization() {
return funcCall("init_generic_ecu");
}
/** {@inheritDoc} */
@Override
public IExpressionTerm getTermination() {
return funcCall("term_generic_ecu");
}
/** {@inheritDoc} */
@Override
protected CSourcePackage createExecutionUnitSourcePackage(String name,
List<Pair<ExecutionUnit, Component>> deployedComponents,
List<Pair<PlatformConnectorUnit, Port>> deployedPorts, ITransformationContext context) {
return null;
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.multicore.generator.transform;
import org.fortiss.af3.multicore.generator.executable.NiosIICoreExecutable;
import org.fortiss.af3.multicore.model.NiosIICore;
import org.fortiss.af3.platform.generic.generator.executable.GenericExecutionUnitExecutable;
import org.fortiss.af3.platform.model.generic.GenericExecutionUnit;
import org.fortiss.tooling.kernel.extension.ITransformationProvider;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
/**
* Transformation from {@link GenericExecutionUnit} to {@link GenericExecutionUnitExecutable}.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: DF6B51BCE299396FB7C2A43D7F39220E
*/
public final class NiosIICoreTransformation implements ITransformationProvider {
/** {@inheritDoc} */
@Override
public Class<?> getTargetClass() {
return NiosIICoreExecutable.class;
}
/** {@inheritDoc} */
@Override
public boolean
canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) {
return NiosIICore.class.isAssignableFrom(sourceClass);
}
/** {@inheritDoc} */
@Override
public boolean canTransform(Object source, ITransformationContext context) {
return source instanceof NiosIICore;
}
/** {@inheritDoc} */
@Override
public Object transform(Object source, ITransformationContext context) {
return new NiosIICoreExecutable((NiosIICore)source);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment