KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > Connector > EEG > CodeWriter > CDL2IDLMapping


1 /*
2  * CDL2IDLMapping.java
3  *
4  * Created on 7. duben 2002, 10:23
5  */

6
7 package SOFA.Connector.EEG.CodeWriter;
8
9 import SOFA.SOFAnode.Made.TIR.CDLType;
10 import SOFA.SOFAnode.Made.TIR.ParamMode;
11
12 /**
13  *
14  * @author ghort
15  * @version
16  */

17 public class CDL2IDLMapping {
18
19     static protected SOFA.SOFAnode.Made.CodeGen.IDLMapping mapping;
20     
21     static public String JavaDoc getTypeName(CDLType cdlType) throws CodeWriterException {
22         if (mapping==null) {
23             mapping=new SOFA.SOFAnode.Made.CodeGen.IDLMapping();
24         }
25         String JavaDoc 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 JavaDoc getTypeDecl(CDLType cdlType, int paramMode) throws CodeWriterException {
36         String JavaDoc 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