KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > idl > LongLongType


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1997-2004 Gerald Brose.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20
21 package org.jacorb.idl;
22
23 /**
24  * Represents IDL long long and unsigned long long types
25  *
26  * @author Gerald Brose
27  * @version $Id: LongLongType.java,v 1.14 2004/05/06 12:39:58 nicolas Exp $
28  */

29
30 class LongLongType
31     extends IntType
32 {
33
34     public LongLongType( int num )
35     {
36         super( num );
37     }
38
39     public Object JavaDoc clone()
40     {
41         return new LongLongType( new_num() );
42     }
43
44     public TypeSpec typeSpec()
45     {
46         return this;
47     }
48
49     public String JavaDoc typeName()
50     {
51         return "long";
52     }
53
54     /**
55      * get this types's mapped Java name
56      */

57
58     public String JavaDoc getJavaTypeName()
59     {
60         return typeName();
61     }
62
63
64     /**
65      * get this symbol's IDL type name
66      */

67
68     public String JavaDoc getIDLTypeName()
69     {
70         if( unsigned )
71             return "ulonglong";
72         else
73             return "longlong";
74     }
75
76     public boolean basic()
77     {
78         return true;
79     }
80
81     public int getTCKind()
82     {
83         if( unsigned )
84             return 24; // tk_ulonglong
85
else
86             return 23; // tk_longlong
87
}
88
89     public String JavaDoc toString()
90     {
91         return typeName();
92     }
93
94     public String JavaDoc holderName()
95     {
96         return "org.omg.CORBA.LongHolder";
97     }
98
99
100     public String JavaDoc printReadExpression( String JavaDoc strname )
101     {
102         if( unsigned )
103             return strname + ".read_ulonglong()";
104         else
105             return strname + ".read_longlong()";
106     }
107
108     public String JavaDoc printReadStatement( String JavaDoc var_name, String JavaDoc strname )
109     {
110         if( unsigned )
111             return var_name + "=" + strname + ".read_ulonglong();";
112         else
113             return var_name + "=" + strname + ".read_longlong();";
114     }
115
116     public String JavaDoc printWriteStatement( String JavaDoc var_name, String JavaDoc strname )
117     {
118         if( unsigned )
119             return strname + ".write_ulonglong(" + var_name + ");";
120         else
121             return strname + ".write_longlong(" + var_name + ");";
122     }
123
124     public String JavaDoc printInsertExpression()
125     {
126         if( unsigned )
127             return "insert_ulonglong";
128         else
129             return "insert_longlong";
130     }
131
132     public String JavaDoc printExtractExpression()
133     {
134         if( unsigned )
135             return "extract_ulonglong";
136         else
137             return "extract_longlong";
138     }
139 }
140
141
142
143
Popular Tags