Adjusting testing cases for current state of OCCT
[occt.git] / samples / java / drv / SampleHLRJni / SampleHLRJni_TShort_Array1OfShortReal_java.cxx
CommitLineData
7fd59977 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
34extern "C" {
35
36
37JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_TShort_1Array1OfShortReal_1Create_11 (JNIEnv *env, jobject theobj, jint Low, jint Up)
38{
39
40jcas_Locking alock(env);
41{
42try {
43TShort_Array1OfShortReal* theret = new TShort_Array1OfShortReal((Standard_Integer) Low,(Standard_Integer) Up);
44jcas_SetHandle(env,theobj,theret);
45
46}
47catch (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}
54alock.Release();
55
56}
57
58
59
60JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_TShort_1Array1OfShortReal_1Create_12 (JNIEnv *env, jobject theobj, jfloat Item, jint Low, jint Up)
61{
62
63jcas_Locking alock(env);
64{
65try {
66TShort_Array1OfShortReal* theret = new TShort_Array1OfShortReal((Standard_ShortReal) Item,(Standard_Integer) Low,(Standard_Integer) Up);
67jcas_SetHandle(env,theobj,theret);
68
69}
70catch (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}
77alock.Release();
78
79}
80
81
82
83JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Init (JNIEnv *env, jobject theobj, jfloat V)
84{
85
86jcas_Locking alock(env);
87{
88try {
89TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
90the_this->Init((Standard_ShortReal) V);
91
92}
93catch (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}
100alock.Release();
101
102}
103
104
105
106JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Destroy (JNIEnv *env, jobject theobj)
107{
108
109jcas_Locking alock(env);
110{
111try {
112TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
113the_this->Destroy();
114
115}
116catch (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}
123alock.Release();
124
125}
126
127
128
129JNIEXPORT jboolean JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_IsAllocated (JNIEnv *env, jobject theobj)
130{
131jboolean thejret;
132
133jcas_Locking alock(env);
134{
135try {
136TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
137 thejret = the_this->IsAllocated();
138
139}
140catch (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}
147alock.Release();
148return thejret;
149}
150
151
152
153JNIEXPORT jobject JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Assign (JNIEnv *env, jobject theobj, jobject Other)
154{
155jobject thejret;
156
157jcas_Locking alock(env);
158{
159try {
160TShort_Array1OfShortReal* the_Other = (TShort_Array1OfShortReal*) jcas_GetHandle(env,Other);
161if ( 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
171TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
172const TShort_Array1OfShortReal& theret = the_this->Assign(*the_Other);
173thejret = jcas_CreateObject(env,"CASCADESamplesJni/TShort_Array1OfShortReal",&theret,0);
174
175}
176catch (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}
183alock.Release();
184return thejret;
185}
186
187
188
189JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Length (JNIEnv *env, jobject theobj)
190{
191jint thejret;
192
193jcas_Locking alock(env);
194{
195try {
196TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
197 thejret = the_this->Length();
198
199}
200catch (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}
207alock.Release();
208return thejret;
209}
210
211
212
213JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Lower (JNIEnv *env, jobject theobj)
214{
215jint thejret;
216
217jcas_Locking alock(env);
218{
219try {
220TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
221 thejret = the_this->Lower();
222
223}
224catch (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}
231alock.Release();
232return thejret;
233}
234
235
236
237JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Upper (JNIEnv *env, jobject theobj)
238{
239jint thejret;
240
241jcas_Locking alock(env);
242{
243try {
244TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
245 thejret = the_this->Upper();
246
247}
248catch (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}
255alock.Release();
256return thejret;
257}
258
259
260
261JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_SetValue (JNIEnv *env, jobject theobj, jint Index, jfloat Value)
262{
263
264jcas_Locking alock(env);
265{
266try {
267TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
268the_this->SetValue((Standard_Integer) Index,(Standard_ShortReal) Value);
269
270}
271catch (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}
278alock.Release();
279
280}
281
282
283
284JNIEXPORT jfloat JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Value (JNIEnv *env, jobject theobj, jint Index)
285{
286jfloat thejret;
287
288jcas_Locking alock(env);
289{
290try {
291TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
292 thejret = the_this->Value((Standard_Integer) Index);
293
294}
295catch (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}
302alock.Release();
303return thejret;
304}
305
306
307
308JNIEXPORT jfloat JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_ChangeValue (JNIEnv *env, jobject theobj, jint Index)
309{
310jfloat thejret;
311
312jcas_Locking alock(env);
313{
314try {
315TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
316 thejret = the_this->ChangeValue((Standard_Integer) Index);
317
318}
319catch (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}
326alock.Release();
327return thejret;
328}
329
330
331
332JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_FinalizeValue(JNIEnv *, jclass, jlong theid)
333{
334if (theid) {
335 TShort_Array1OfShortReal* theobj = (TShort_Array1OfShortReal*) theid;
336 delete theobj;
337}
338}
339
340
341}