1 6 7 package SOFA.Connector.EEG.CodeWriter; 8 9 import SOFA.SOFAnode.Made.TIR.CDLType; 10 import SOFA.SOFAnode.Made.TIR.ParamMode; 11 12 17 public class CDL2IDLMapping { 18 19 static protected SOFA.SOFAnode.Made.CodeGen.IDLMapping mapping; 20 21 static public String getTypeName(CDLType cdlType) throws CodeWriterException { 22 if (mapping==null) { 23 mapping=new SOFA.SOFAnode.Made.CodeGen.IDLMapping(); 24 } 25 String ret; 26 27 ret=mapping.getImplTypeName(cdlType); 28 29 if (ret==null) { 30 throw new CodeWriterException("Cannot map CDL type to Java."); 31 } 32 return ret; 33 } 34 35 static public String getTypeDecl(CDLType cdlType, int paramMode) throws CodeWriterException { 36 String ret; 37 if (paramMode==ParamMode.PARAM_IN) { 38 ret="in "; 39 } else if (paramMode==ParamMode.PARAM_OUT) { 40 ret="out "; 41 } else if (paramMode==ParamMode.PARAM_INOUT) { 42 ret="inout "; 43 } else { 44 throw new CodeWriterException("Invalid parameter mode."); 45 } 46 47 return ret + getTypeName(cdlType); 48 } 49 50 } 51 | Popular Tags |