| /******************************************************************************* |
| * Copyright (c) 2018 Robert Bosch GmbH. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| *******************************************************************************/ |
| |
| package templates |
| |
| import SampleModel.Model |
| import SampleModel.SampleModelFactory |
| import org.eclipse.app4mc.amalthea.model.AmaltheaFactory |
| import org.eclipse.app4mc.amalthea.model.HWModel |
| import org.eclipse.app4mc.amalthea.model.Memory |
| import org.eclipse.app4mc.transformation.extensions.ICustomObjectsStore |
| import org.eclipse.app4mc.transformation.extensions.base.templates.AbstractTransformer |
| import org.eclipse.app4mc.transformation.extensions.base.templates.ISubTransformer |
| import org.osgi.service.component.annotations.Component |
| import org.osgi.service.component.annotations.Reference |
| import org.osgi.service.component.annotations.ServiceScope |
| |
| @Component(scope=ServiceScope.PROTOTYPE, service =HWTransformer) |
| public class HWTransformer extends AbstractTransformer implements ISubTransformer{ |
| |
| @Reference |
| ICustomObjectsStore customObjsStore |
| |
| def OSTransformer getOS() { |
| return customObjsStore.getInstance(OSTransformer) |
| } |
| |
| /*- Factory initialization */ |
| val outputModelFactory = SampleModelFactory.eINSTANCE |
| |
| val amaltheaFactory = AmaltheaFactory.eINSTANCE |
| |
| public def transfromHWModel(HWModel amaltheaModel, Model simulationModel) { |
| // for(amaltheaEcu:amaltheaModel?.system?.ecus){ |
| // |
| // for(amaltheaMicroController: amaltheaEcu?.microcontrollers){ |
| // |
| // for(memory: amaltheaMicroController?.memories){ |
| // |
| // val simulationModelMemory = createMemory(memory); |
| // |
| // simulationModel.memories.add(simulationModelMemory) |
| // |
| // } |
| // |
| // } |
| // } |
| } |
| |
| public def create outputModelFactory.createMemory createMemory(Memory amltMemory) { |
| name = amltMemory.name |
| } |
| |
| } |