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 CDL2IDL2JavaMapping { 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 ret="org.omg.CORBA"+ret.substring("cz.cuni.sofa.lib".length()); 35 } 36 37 if (ret==null) { 38 throw new CodeWriterException("Cannot map CDL->IDL type to Java."); 39 } 40 return ret; 41 } 42 43 static public String getAbsoluteName(AbsoluteName an) throws CodeWriterException { 44 try { 45 int i, size=an.size(); 46 String ret=an.elementAt(0); 47 for (i=1;i<size;i++) { 48 ret+="."+an.elementAt(i); 49 } 50 return ret; 51 } catch (java.rmi.RemoteException e) { 52 throw new CodeWriterException("Can't access TIR.",e); 53 } 54 } 55 } 56 | Popular Tags |