KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > Connector > EEG > EEM > Actions > IDLIfaceCN


1 /*
2  * IDLIfaceCN.java
3  *
4  * Created on 13. duben 2002, 21:08
5  */

6
7 package SOFA.Connector.EEG.EEM.Actions;
8
9 import SOFA.Connector.EEG.CodeWriter.CDL2IDLMapping;
10 import SOFA.Connector.EEG.CodeWriter.IDLWriterDirectorException;
11 import SOFA.SOFAnode.Made.TIR.ExceptionDef;
12 import SOFA.SOFAnode.Made.TIR.OperationDef;
13 import SOFA.SOFAnode.Made.TIR.ParamDescr;
14
15 /**
16  *
17  * @author ghort
18  * @version
19  */

20 public class IDLIfaceCN {
21     public static String JavaDoc getOperationDef(OperationDef mt) throws IDLWriterDirectorException {
22         try {
23             StringBuffer JavaDoc ret=new StringBuffer JavaDoc(CDL2IDLMapping.getTypeName(mt.result())+" "+mt.get_identification().name()+"(");
24             
25             int j;
26             ParamDescr[] params=mt.params();
27             for (j=0;j<params.length;j++) {
28                 if (j>0) {
29                     ret.append(", ");
30                 }
31                 ret.append(CDL2IDLMapping.getTypeDecl(params[j].type(),params[j].mode().value())+" "+params[j].name());
32             }
33             if (j>0) {
34                 ret.append(", ");
35             }
36             ret.append("in string thr_id");
37             ret.append(")");
38             
39             ExceptionDef[] exceptions=mt.exceptions();
40             for (j=0;j<exceptions.length;j++) {
41                 if (j==0) {
42                     ret.append(" raises ");
43                 } else {
44                     ret.append(", ");
45                 }
46                 ret.append(exceptions[j].get_identification().absolute_name());
47             }
48             return ret.toString();
49         } catch (Exception JavaDoc e) {
50             throw new IDLWriterDirectorException("Cannot create method declaration.",e);
51         }
52     }
53 }
54
Popular Tags