Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / java / drv / SampleHLRJni / SampleHLRJni_TShort_Array1OfShortReal_java.cxx
1 //
2 //                     Copyright (C) 1991 - 2000 by  
3 //                      Matra Datavision SA.  All rights reserved.
4 //  
5 //                     Copyright (C) 2001 - 2004 by
6 //                     Open CASCADE SA.  All rights reserved.
7 // 
8 // This file is part of the Open CASCADE Technology software.
9 //
10 // This software may be distributed and/or modified under the terms and
11 // conditions of the Open CASCADE Public License as defined by Open CASCADE SA
12 // and appearing in the file LICENSE included in the packaging of this file.
13 //  
14 // This software is distributed on an "AS IS" basis, without warranty of any
15 // kind, and Open CASCADE SA hereby disclaims all such warranties,
16 // including without limitation, any warranties of merchantability, fitness
17 // for a particular purpose or non-infringement. Please see the License for
18 // the specific terms and conditions governing rights and limitations under the
19 // License.
20
21 #include <SampleHLRJni_TShort_Array1OfShortReal.h>
22 #include <TShort_Array1OfShortReal.hxx>
23 #include <jcas.hxx>
24 #include <stdlib.h>
25 #include <Standard_ErrorHandler.hxx>
26 #include <Standard_Failure.hxx>
27 #include <Standard_SStream.hxx>
28
29 #include <Standard_Integer.hxx>
30 #include <Standard_ShortReal.hxx>
31 #include <Standard_Boolean.hxx>
32
33
34 extern "C" {
35
36
37 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_TShort_1Array1OfShortReal_1Create_11 (JNIEnv *env, jobject theobj, jint Low, jint Up)
38 {
39
40 jcas_Locking alock(env);
41 {
42 try {
43 TShort_Array1OfShortReal* theret = new TShort_Array1OfShortReal((Standard_Integer) Low,(Standard_Integer) Up);
44 jcas_SetHandle(env,theobj,theret);
45
46 }
47 catch (Standard_Failure) {
48   Standard_SStream Err;
49   Err <<   Standard_Failure::Caught(); 
50   Err << (char) 0;
51   jcas_ThrowException(env,Err.str().c_str());
52 }
53 }
54 alock.Release();
55
56 }
57
58
59
60 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_TShort_1Array1OfShortReal_1Create_12 (JNIEnv *env, jobject theobj, jfloat Item, jint Low, jint Up)
61 {
62
63 jcas_Locking alock(env);
64 {
65 try {
66 TShort_Array1OfShortReal* theret = new TShort_Array1OfShortReal((Standard_ShortReal) Item,(Standard_Integer) Low,(Standard_Integer) Up);
67 jcas_SetHandle(env,theobj,theret);
68
69 }
70 catch (Standard_Failure) {
71   Standard_SStream Err;
72   Err <<   Standard_Failure::Caught(); 
73   Err << (char) 0;
74   jcas_ThrowException(env,Err.str().c_str());
75 }
76 }
77 alock.Release();
78
79 }
80
81
82
83 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Init (JNIEnv *env, jobject theobj, jfloat V)
84 {
85
86 jcas_Locking alock(env);
87 {
88 try {
89 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
90 the_this->Init((Standard_ShortReal) V);
91
92 }
93 catch (Standard_Failure) {
94   Standard_SStream Err;
95   Err <<   Standard_Failure::Caught(); 
96   Err << (char) 0;
97   jcas_ThrowException(env,Err.str().c_str());
98 }
99 }
100 alock.Release();
101
102 }
103
104
105
106 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Destroy (JNIEnv *env, jobject theobj)
107 {
108
109 jcas_Locking alock(env);
110 {
111 try {
112 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
113 the_this->Destroy();
114
115 }
116 catch (Standard_Failure) {
117   Standard_SStream Err;
118   Err <<   Standard_Failure::Caught(); 
119   Err << (char) 0;
120   jcas_ThrowException(env,Err.str().c_str());
121 }
122 }
123 alock.Release();
124
125 }
126
127
128
129 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_IsAllocated (JNIEnv *env, jobject theobj)
130 {
131 jboolean thejret;
132
133 jcas_Locking alock(env);
134 {
135 try {
136 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
137  thejret = the_this->IsAllocated();
138
139 }
140 catch (Standard_Failure) {
141   Standard_SStream Err;
142   Err <<   Standard_Failure::Caught(); 
143   Err << (char) 0;
144   jcas_ThrowException(env,Err.str().c_str());
145 }
146 }
147 alock.Release();
148 return thejret;
149 }
150
151
152
153 JNIEXPORT jobject JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Assign (JNIEnv *env, jobject theobj, jobject Other)
154 {
155 jobject thejret;
156
157 jcas_Locking alock(env);
158 {
159 try {
160 TShort_Array1OfShortReal* the_Other = (TShort_Array1OfShortReal*) jcas_GetHandle(env,Other);
161 if ( the_Other == NULL ) {
162
163  // The following assumes availability of the default constructor (what may not
164  // always be the case). Therefore explicit exception is thrown if the null
165  // object has been passed.
166  // the_Other = new TShort_Array1OfShortReal ();
167  // jcas_SetHandle ( env, Other, the_Other );
168  jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
169
170 }  // end if
171 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
172 const TShort_Array1OfShortReal& theret = the_this->Assign(*the_Other);
173 thejret = jcas_CreateObject(env,"CASCADESamplesJni/TShort_Array1OfShortReal",&theret,0);
174
175 }
176 catch (Standard_Failure) {
177   Standard_SStream Err;
178   Err <<   Standard_Failure::Caught(); 
179   Err << (char) 0;
180   jcas_ThrowException(env,Err.str().c_str());
181 }
182 }
183 alock.Release();
184 return thejret;
185 }
186
187
188
189 JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Length (JNIEnv *env, jobject theobj)
190 {
191 jint thejret;
192
193 jcas_Locking alock(env);
194 {
195 try {
196 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
197  thejret = the_this->Length();
198
199 }
200 catch (Standard_Failure) {
201   Standard_SStream Err;
202   Err <<   Standard_Failure::Caught(); 
203   Err << (char) 0;
204   jcas_ThrowException(env,Err.str().c_str());
205 }
206 }
207 alock.Release();
208 return thejret;
209 }
210
211
212
213 JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Lower (JNIEnv *env, jobject theobj)
214 {
215 jint thejret;
216
217 jcas_Locking alock(env);
218 {
219 try {
220 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
221  thejret = the_this->Lower();
222
223 }
224 catch (Standard_Failure) {
225   Standard_SStream Err;
226   Err <<   Standard_Failure::Caught(); 
227   Err << (char) 0;
228   jcas_ThrowException(env,Err.str().c_str());
229 }
230 }
231 alock.Release();
232 return thejret;
233 }
234
235
236
237 JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Upper (JNIEnv *env, jobject theobj)
238 {
239 jint thejret;
240
241 jcas_Locking alock(env);
242 {
243 try {
244 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
245  thejret = the_this->Upper();
246
247 }
248 catch (Standard_Failure) {
249   Standard_SStream Err;
250   Err <<   Standard_Failure::Caught(); 
251   Err << (char) 0;
252   jcas_ThrowException(env,Err.str().c_str());
253 }
254 }
255 alock.Release();
256 return thejret;
257 }
258
259
260
261 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_SetValue (JNIEnv *env, jobject theobj, jint Index, jfloat Value)
262 {
263
264 jcas_Locking alock(env);
265 {
266 try {
267 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
268 the_this->SetValue((Standard_Integer) Index,(Standard_ShortReal) Value);
269
270 }
271 catch (Standard_Failure) {
272   Standard_SStream Err;
273   Err <<   Standard_Failure::Caught(); 
274   Err << (char) 0;
275   jcas_ThrowException(env,Err.str().c_str());
276 }
277 }
278 alock.Release();
279
280 }
281
282
283
284 JNIEXPORT jfloat JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Value (JNIEnv *env, jobject theobj, jint Index)
285 {
286 jfloat thejret;
287
288 jcas_Locking alock(env);
289 {
290 try {
291 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
292  thejret = the_this->Value((Standard_Integer) Index);
293
294 }
295 catch (Standard_Failure) {
296   Standard_SStream Err;
297   Err <<   Standard_Failure::Caught(); 
298   Err << (char) 0;
299   jcas_ThrowException(env,Err.str().c_str());
300 }
301 }
302 alock.Release();
303 return thejret;
304 }
305
306
307
308 JNIEXPORT jfloat JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_ChangeValue (JNIEnv *env, jobject theobj, jint Index)
309 {
310 jfloat thejret;
311
312 jcas_Locking alock(env);
313 {
314 try {
315 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
316  thejret = the_this->ChangeValue((Standard_Integer) Index);
317
318 }
319 catch (Standard_Failure) {
320   Standard_SStream Err;
321   Err <<   Standard_Failure::Caught(); 
322   Err << (char) 0;
323   jcas_ThrowException(env,Err.str().c_str());
324 }
325 }
326 alock.Release();
327 return thejret;
328 }
329
330
331
332 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_FinalizeValue(JNIEnv *, jclass, jlong theid)
333 {
334 if (theid) {
335   TShort_Array1OfShortReal* theobj = (TShort_Array1OfShortReal*) theid;
336   delete theobj;
337 }
338 }
339
340
341 }