1 6 7 package SOFA.Connector.EEG.CodeWriter; 8 9 import SOFA.SOFAnode.Made.TIR.AbsoluteName; 10 import SOFA.SOFAnode.Made.TIR.CDLType; 11 import SOFA.SOFAnode.Made.TIR.ParamMode; 12 13 18 public class CDL2JavaMapping { 19 20 static protected SOFA.SOFAnode.Made.CodeGen.JavaMapping mapping; 21 22 static public String getTypeName(CDLType cdlType, int paramMode) throws CodeWriterException { 23 if (mapping==null) { 24 mapping=new SOFA.SOFAnode.Made.CodeGen.JavaMapping(); 25 } 26 String ret; 27 28 if (paramMode==ParamMode.PARAM_IN) { 29 ret=mapping.getImplTypeName(cdlType); 30 } else { 31 ret=mapping.getImplTypeHolderName(cdlType); 32 } 33 34 if (ret==null) { 35 throw new CodeWriterException("Cannot map CDL type to Java."); 36 } 37 return ret; 38 } 39 40 static public String getAbsoluteName(AbsoluteName an) throws CodeWriterException { 41 try { 42 int i, size=an.size(); 43 String ret=an.elementAt(0); 44 for (i=1;i<size;i++) { 45 ret+="."+an.elementAt(i); 46 } 47 return ret; 48 } catch (java.rmi.RemoteException e) { 49 throw new CodeWriterException("Can't access TIR.",e); 50 } 51 } 52 } 53 | Popular Tags |