2 // Copyright (C) 1991 - 2000 by
3 // Matra Datavision SA. All rights reserved.
5 // Copyright (C) 2001 - 2004 by
6 // Open CASCADE SA. All rights reserved.
8 // This file is part of the Open CASCADE Technology software.
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.
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
21 #include <SampleHLRJni_TShort_Array1OfShortReal.h>
22 #include <TShort_Array1OfShortReal.hxx>
25 #include <Standard_ErrorHandler.hxx>
26 #include <Standard_Failure.hxx>
27 #include <Standard_SStream.hxx>
29 #include <Standard_Integer.hxx>
30 #include <Standard_ShortReal.hxx>
31 #include <Standard_Boolean.hxx>
37 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_TShort_1Array1OfShortReal_1Create_11 (JNIEnv *env, jobject theobj, jint Low, jint Up)
40 jcas_Locking alock(env);
43 TShort_Array1OfShortReal* theret = new TShort_Array1OfShortReal((Standard_Integer) Low,(Standard_Integer) Up);
44 jcas_SetHandle(env,theobj,theret);
47 catch (Standard_Failure) {
49 Err << Standard_Failure::Caught();
51 jcas_ThrowException(env,Err.str().c_str());
60 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_TShort_1Array1OfShortReal_1Create_12 (JNIEnv *env, jobject theobj, jfloat Item, jint Low, jint Up)
63 jcas_Locking alock(env);
66 TShort_Array1OfShortReal* theret = new TShort_Array1OfShortReal((Standard_ShortReal) Item,(Standard_Integer) Low,(Standard_Integer) Up);
67 jcas_SetHandle(env,theobj,theret);
70 catch (Standard_Failure) {
72 Err << Standard_Failure::Caught();
74 jcas_ThrowException(env,Err.str().c_str());
83 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Init (JNIEnv *env, jobject theobj, jfloat V)
86 jcas_Locking alock(env);
89 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
90 the_this->Init((Standard_ShortReal) V);
93 catch (Standard_Failure) {
95 Err << Standard_Failure::Caught();
97 jcas_ThrowException(env,Err.str().c_str());
106 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Destroy (JNIEnv *env, jobject theobj)
109 jcas_Locking alock(env);
112 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
116 catch (Standard_Failure) {
117 Standard_SStream Err;
118 Err << Standard_Failure::Caught();
120 jcas_ThrowException(env,Err.str().c_str());
129 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_IsAllocated (JNIEnv *env, jobject theobj)
133 jcas_Locking alock(env);
136 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
137 thejret = the_this->IsAllocated();
140 catch (Standard_Failure) {
141 Standard_SStream Err;
142 Err << Standard_Failure::Caught();
144 jcas_ThrowException(env,Err.str().c_str());
153 JNIEXPORT jobject JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Assign (JNIEnv *env, jobject theobj, jobject Other)
157 jcas_Locking alock(env);
160 TShort_Array1OfShortReal* the_Other = (TShort_Array1OfShortReal*) jcas_GetHandle(env,Other);
161 if ( the_Other == NULL ) {
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");
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);
176 catch (Standard_Failure) {
177 Standard_SStream Err;
178 Err << Standard_Failure::Caught();
180 jcas_ThrowException(env,Err.str().c_str());
189 JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Length (JNIEnv *env, jobject theobj)
193 jcas_Locking alock(env);
196 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
197 thejret = the_this->Length();
200 catch (Standard_Failure) {
201 Standard_SStream Err;
202 Err << Standard_Failure::Caught();
204 jcas_ThrowException(env,Err.str().c_str());
213 JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Lower (JNIEnv *env, jobject theobj)
217 jcas_Locking alock(env);
220 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
221 thejret = the_this->Lower();
224 catch (Standard_Failure) {
225 Standard_SStream Err;
226 Err << Standard_Failure::Caught();
228 jcas_ThrowException(env,Err.str().c_str());
237 JNIEXPORT jint JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Upper (JNIEnv *env, jobject theobj)
241 jcas_Locking alock(env);
244 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
245 thejret = the_this->Upper();
248 catch (Standard_Failure) {
249 Standard_SStream Err;
250 Err << Standard_Failure::Caught();
252 jcas_ThrowException(env,Err.str().c_str());
261 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_SetValue (JNIEnv *env, jobject theobj, jint Index, jfloat Value)
264 jcas_Locking alock(env);
267 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
268 the_this->SetValue((Standard_Integer) Index,(Standard_ShortReal) Value);
271 catch (Standard_Failure) {
272 Standard_SStream Err;
273 Err << Standard_Failure::Caught();
275 jcas_ThrowException(env,Err.str().c_str());
284 JNIEXPORT jfloat JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_Value (JNIEnv *env, jobject theobj, jint Index)
288 jcas_Locking alock(env);
291 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
292 thejret = the_this->Value((Standard_Integer) Index);
295 catch (Standard_Failure) {
296 Standard_SStream Err;
297 Err << Standard_Failure::Caught();
299 jcas_ThrowException(env,Err.str().c_str());
308 JNIEXPORT jfloat JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_ChangeValue (JNIEnv *env, jobject theobj, jint Index)
312 jcas_Locking alock(env);
315 TShort_Array1OfShortReal* the_this = (TShort_Array1OfShortReal*) jcas_GetHandle(env,theobj);
316 thejret = the_this->ChangeValue((Standard_Integer) Index);
319 catch (Standard_Failure) {
320 Standard_SStream Err;
321 Err << Standard_Failure::Caught();
323 jcas_ThrowException(env,Err.str().c_str());
332 JNIEXPORT void JNICALL Java_SampleHLRJni_TShort_1Array1OfShortReal_FinalizeValue(JNIEnv *, jclass, jlong theid)
335 TShort_Array1OfShortReal* theobj = (TShort_Array1OfShortReal*) theid;