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_Aspect_TypeMap.h>
22 #include <Aspect_TypeMap.hxx>
25 #include <Standard_ErrorHandler.hxx>
26 #include <Standard_Failure.hxx>
27 #include <Standard_SStream.hxx>
29 #include <Aspect_TypeMapEntry.hxx>
30 #include <Standard_Integer.hxx>
31 #include <Aspect_LineStyle.hxx>
37 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1TypeMap_Aspect_1TypeMap_1Create_10 (JNIEnv *env, jobject theobj)
40 jcas_Locking alock(env);
43 Handle(Aspect_TypeMap)* theret = new Handle(Aspect_TypeMap);
44 *theret = new Aspect_TypeMap();
45 jcas_SetHandle(env,theobj,theret);
48 catch (Standard_Failure) {
50 Err << Standard_Failure::Caught();
52 jcas_ThrowException(env,Err.str().c_str());
61 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1TypeMap_Aspect_1TypeMap_1AddEntry_11 (JNIEnv *env, jobject theobj, jobject AnEntry)
64 jcas_Locking alock(env);
67 Aspect_TypeMapEntry* the_AnEntry = (Aspect_TypeMapEntry*) jcas_GetHandle(env,AnEntry);
68 if ( the_AnEntry == NULL ) {
70 // The following assumes availability of the default constructor (what may not
71 // always be the case). Therefore explicit exception is thrown if the null
72 // object has been passed.
73 // the_AnEntry = new Aspect_TypeMapEntry ();
74 // jcas_SetHandle ( env, AnEntry, the_AnEntry );
75 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
78 Handle(Aspect_TypeMap) the_this = *((Handle(Aspect_TypeMap)*) jcas_GetHandle(env,theobj));
79 the_this->AddEntry(*the_AnEntry);
82 catch (Standard_Failure) {
84 Err << Standard_Failure::Caught();
86 jcas_ThrowException(env,Err.str().c_str());
95 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1TypeMap_Aspect_1TypeMap_1AddEntry_12 (JNIEnv *env, jobject theobj, jobject aStyle)
99 jcas_Locking alock(env);
102 Aspect_LineStyle* the_aStyle = (Aspect_LineStyle*) jcas_GetHandle(env,aStyle);
103 if ( the_aStyle == NULL ) {
105 // The following assumes availability of the default constructor (what may not
106 // always be the case). Therefore explicit exception is thrown if the null
107 // object has been passed.
108 // the_aStyle = new Aspect_LineStyle ();
109 // jcas_SetHandle ( env, aStyle, the_aStyle );
110 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
113 Handle(Aspect_TypeMap) the_this = *((Handle(Aspect_TypeMap)*) jcas_GetHandle(env,theobj));
114 thejret = the_this->AddEntry(*the_aStyle);
117 catch (Standard_Failure) {
118 Standard_SStream Err;
119 Err << Standard_Failure::Caught();
121 jcas_ThrowException(env,Err.str().c_str());
130 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1TypeMap_Size (JNIEnv *env, jobject theobj)
134 jcas_Locking alock(env);
137 Handle(Aspect_TypeMap) the_this = *((Handle(Aspect_TypeMap)*) jcas_GetHandle(env,theobj));
138 thejret = the_this->Size();
141 catch (Standard_Failure) {
142 Standard_SStream Err;
143 Err << Standard_Failure::Caught();
145 jcas_ThrowException(env,Err.str().c_str());
154 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1TypeMap_Index (JNIEnv *env, jobject theobj, jint aTypemapIndex)
158 jcas_Locking alock(env);
161 Handle(Aspect_TypeMap) the_this = *((Handle(Aspect_TypeMap)*) jcas_GetHandle(env,theobj));
162 thejret = the_this->Index((Standard_Integer) aTypemapIndex);
165 catch (Standard_Failure) {
166 Standard_SStream Err;
167 Err << Standard_Failure::Caught();
169 jcas_ThrowException(env,Err.str().c_str());
178 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1TypeMap_Dump (JNIEnv *env, jobject theobj)
181 jcas_Locking alock(env);
184 Handle(Aspect_TypeMap) the_this = *((Handle(Aspect_TypeMap)*) jcas_GetHandle(env,theobj));
188 catch (Standard_Failure) {
189 Standard_SStream Err;
190 Err << Standard_Failure::Caught();
192 jcas_ThrowException(env,Err.str().c_str());
201 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1TypeMap_Entry (JNIEnv *env, jobject theobj, jint AnIndex)
205 jcas_Locking alock(env);
208 Handle(Aspect_TypeMap) the_this = *((Handle(Aspect_TypeMap)*) jcas_GetHandle(env,theobj));
209 Aspect_TypeMapEntry* theret = new Aspect_TypeMapEntry(the_this->Entry((Standard_Integer) AnIndex));
210 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_TypeMapEntry",theret);
213 catch (Standard_Failure) {
214 Standard_SStream Err;
215 Err << Standard_Failure::Caught();
217 jcas_ThrowException(env,Err.str().c_str());