/** * Copyright (c) 2016 committers of YAKINDU and others. * 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: * committers of YAKINDU - initial API and implementation */ package org.yakindu.sct.generator.cpp; import static org.yakindu.sct.generator.cpp.features.CPPFeatureConstants.FEATURE_INCLUDES; import static org.yakindu.sct.generator.cpp.features.CPPFeatureConstants.PARAMETER_INCLUDES_USE_RELATIVE_PATHS; import org.yakindu.base.types.inferrer.ITypeSystemInferrer; import org.yakindu.sct.generator.c.DefaultGenArtifactConfigurations; import org.yakindu.sct.generator.c.IGenArtifactConfigurations; import org.yakindu.sct.generator.c.SimpleGenArtifactConfigurations; import org.yakindu.sct.generator.c.types.CTypeSystemAccess; import org.yakindu.sct.generator.core.IGeneratorModule; import org.yakindu.sct.generator.core.IExecutionFlowGenerator; import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess; import org.yakindu.sct.model.sexec.naming.INamingService; import org.yakindu.sct.model.sgen.FeatureParameterValue; import org.yakindu.sct.model.sgen.GeneratorEntry; import org.yakindu.sct.model.stext.inferrer.STextTypeInferrer; import com.google.inject.Binder; /** * * @author andreas muelder - Initial contribution and API * */ public class CppCodeGeneratorModule implements IGeneratorModule { @Override public void configure(GeneratorEntry entry, Binder binder) { binder.bind(GeneratorEntry.class).toInstance(entry); binder.bind(IExecutionFlowGenerator.class).to(CppGenerator.class); binder.bind(ICodegenTypeSystemAccess.class).to(CTypeSystemAccess.class); binder.bind(INamingService.class).to(CppNamingService.class); binder.bind(ITypeSystemInferrer.class).to(STextTypeInferrer.class); bindIGenArtifactConfigurations(entry, binder); } protected void bindIGenArtifactConfigurations(GeneratorEntry entry, Binder binder) { FeatureParameterValue useRelativePathParam = entry.getFeatureParameterValue(FEATURE_INCLUDES, PARAMETER_INCLUDES_USE_RELATIVE_PATHS); boolean useRelativePath = useRelativePathParam != null ? useRelativePathParam.getBooleanValue() : true; if (useRelativePath) { binder.bind(IGenArtifactConfigurations.class).to(DefaultGenArtifactConfigurations.class); } else { binder.bind(IGenArtifactConfigurations.class).to(SimpleGenArtifactConfigurations.class); } } }