1 /*===========================================================================
2 *
3 * PUBLIC DOMAIN NOTICE
4 * National Center for Biotechnology Information
5 *
6 * This software/database is a "United States Government Work" under the
7 * terms of the United States Copyright Act. It was written as part of
8 * the author's official duties as a United States Government employee and
9 * thus cannot be copyrighted. This software/database is freely available
10 * to the public for use. The National Library of Medicine and the U.S.
11 * Government have not placed any restriction on its use or reproduction.
12 *
13 * Although all reasonable efforts have been taken to ensure the accuracy
14 * and reliability of the software and data, the NLM and the U.S.
15 * Government do not and cannot warrant the performance or results that
16 * may be obtained by using this software or data. The NLM and the U.S.
17 * Government disclaim all warranties, express or implied, including
18 * warranties of performance, merchantability or fitness for any particular
19 * purpose.
20 *
21 * Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================
24 *
25 */
26
27 #include "jni_PileupItf.h"
28 #include "jni_ErrorMsg.hpp"
29 #include "jni_String.hpp"
30
31 #include <ngs/itf/PileupItf.hpp>
32 #include <ngs/itf/PileupEventItf.hpp>
33 #include <ngs/itf/StringItf.hpp>
34
35 using namespace ngs;
36
37 static
Cast(PileupEventItf * obj)38 jlong Cast ( PileupEventItf * obj )
39 {
40 return ( jlong ) ( size_t ) obj;
41 }
42
43 static
Event(size_t jself)44 PileupEventItf * Event ( size_t jself )
45 {
46 if ( jself == 0 )
47 throw ErrorMsg ( "NULL self parameter" );
48
49 return ( PileupEventItf* ) jself;
50 }
51
52 #define Self( jself ) Event ( jself )
53
54 /*
55 * Class: ngs_itf_PileupEventItf
56 * Method: GetMappingQuality
57 * Signature: (J)I
58 */
Java_ngs_itf_PileupItf_GetMappingQuality(JNIEnv * jenv,jobject jthis,jlong jself)59 JNIEXPORT jint JNICALL Java_ngs_itf_PileupItf_GetMappingQuality
60 ( JNIEnv * jenv, jobject jthis, jlong jself )
61 {
62 try
63 {
64 return ( jint ) Self ( jself ) -> getMappingQuality ();
65 }
66 catch ( ErrorMsg & x )
67 {
68 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
69 }
70 catch ( std :: exception & x )
71 {
72 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
73 }
74 catch ( ... )
75 {
76 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
77 }
78
79 return 0;
80 }
81
82 /*
83 * Class: ngs_itf_PileupEventItf
84 * Method: GetAlignmentId
85 * Signature: (J)Ljava/lang/String;
86 */
Java_ngs_itf_PileupItf_GetAlignmentId(JNIEnv * jenv,jobject jthis,jlong jself)87 JNIEXPORT jstring JNICALL Java_ngs_itf_PileupItf_GetAlignmentId
88 ( JNIEnv * jenv, jobject jthis, jlong jself )
89 {
90 try
91 {
92 StringItf * new_ref = Self ( jself ) -> getAlignmentId ();
93 return StringItfConvertToJString ( new_ref, jenv );
94 }
95 catch ( ErrorMsg & x )
96 {
97 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
98 }
99 catch ( std :: exception & x )
100 {
101 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
102 }
103 catch ( ... )
104 {
105 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
106 }
107
108 return 0;
109 }
110
111 /*
112 * Class: ngs_itf_PileupEventItf
113 * Method: GetAlignmentPosition
114 * Signature: (J)J
115 */
Java_ngs_itf_PileupItf_GetAlignmentPosition(JNIEnv * jenv,jobject jthis,jlong jself)116 JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetAlignmentPosition
117 ( JNIEnv * jenv, jobject jthis, jlong jself )
118 {
119 try
120 {
121 return ( jlong ) Self ( jself ) -> getAlignmentPosition ();
122 }
123 catch ( ErrorMsg & x )
124 {
125 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
126 }
127 catch ( std :: exception & x )
128 {
129 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
130 }
131 catch ( ... )
132 {
133 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
134 }
135
136 return 0;
137 }
138
139 /*
140 * Class: ngs_itf_PileupEventItf
141 * Method: GetFirstAlignmentPosition
142 * Signature: (J)J
143 */
Java_ngs_itf_PileupItf_GetFirstAlignmentPosition(JNIEnv * jenv,jobject jthis,jlong jself)144 JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetFirstAlignmentPosition
145 ( JNIEnv * jenv, jobject jthis, jlong jself )
146 {
147 try
148 {
149 return ( jlong ) Self ( jself ) -> getFirstAlignmentPosition ();
150 }
151 catch ( ErrorMsg & x )
152 {
153 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
154 }
155 catch ( std :: exception & x )
156 {
157 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
158 }
159 catch ( ... )
160 {
161 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
162 }
163
164 return 0;
165 }
166
167 /*
168 * Class: ngs_itf_PileupEventItf
169 * Method: GetLastAlignmentPosition
170 * Signature: (J)J
171 */
Java_ngs_itf_PileupItf_GetLastAlignmentPosition(JNIEnv * jenv,jobject jthis,jlong jself)172 JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetLastAlignmentPosition
173 ( JNIEnv * jenv, jobject jthis, jlong jself )
174 {
175 try
176 {
177 return ( jlong ) Self ( jself ) -> getLastAlignmentPosition ();
178 }
179 catch ( ErrorMsg & x )
180 {
181 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
182 }
183 catch ( std :: exception & x )
184 {
185 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
186 }
187 catch ( ... )
188 {
189 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
190 }
191
192 return 0;
193 }
194
195 /*
196 * Class: ngs_itf_PileupEventItf
197 * Method: GetEventType
198 * Signature: (J)I
199 */
Java_ngs_itf_PileupItf_GetEventType(JNIEnv * jenv,jobject jthis,jlong jself)200 JNIEXPORT jint JNICALL Java_ngs_itf_PileupItf_GetEventType
201 ( JNIEnv * jenv, jobject jthis, jlong jself )
202 {
203 try
204 {
205 return ( jint ) Self ( jself ) -> getEventType ();
206 }
207 catch ( ErrorMsg & x )
208 {
209 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
210 }
211 catch ( std :: exception & x )
212 {
213 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
214 }
215 catch ( ... )
216 {
217 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
218 }
219
220 return 0;
221 }
222
223 /*
224 * Class: ngs_itf_PileupEventItf
225 * Method: GetAlignmentBase
226 * Signature: (J)C
227 */
Java_ngs_itf_PileupItf_GetAlignmentBase(JNIEnv * jenv,jobject jthis,jlong jself)228 JNIEXPORT jchar JNICALL Java_ngs_itf_PileupItf_GetAlignmentBase
229 ( JNIEnv * jenv, jobject jthis, jlong jself )
230 {
231 try
232 {
233 return ( jchar ) Self ( jself ) -> getAlignmentBase ();
234 }
235 catch ( ErrorMsg & x )
236 {
237 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
238 }
239 catch ( std :: exception & x )
240 {
241 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
242 }
243 catch ( ... )
244 {
245 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
246 }
247
248 return 0;
249 }
250
251 /*
252 * Class: ngs_itf_PileupEventItf
253 * Method: GetAlignmentQuality
254 * Signature: (J)C
255 */
Java_ngs_itf_PileupItf_GetAlignmentQuality(JNIEnv * jenv,jobject jthis,jlong jself)256 JNIEXPORT jchar JNICALL Java_ngs_itf_PileupItf_GetAlignmentQuality
257 ( JNIEnv * jenv, jobject jthis, jlong jself )
258 {
259 try
260 {
261 return ( jchar ) Self ( jself ) -> getAlignmentQuality ();
262 }
263 catch ( ErrorMsg & x )
264 {
265 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
266 }
267 catch ( std :: exception & x )
268 {
269 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
270 }
271 catch ( ... )
272 {
273 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
274 }
275
276 return 0;
277 }
278
279 /*
280 * Class: ngs_itf_PileupEventItf
281 * Method: GetInsertionBases
282 * Signature: (J)Ljava/lang/String;
283 */
Java_ngs_itf_PileupItf_GetInsertionBases(JNIEnv * jenv,jobject jthis,jlong jself)284 JNIEXPORT jstring JNICALL Java_ngs_itf_PileupItf_GetInsertionBases
285 ( JNIEnv * jenv, jobject jthis, jlong jself )
286 {
287 try
288 {
289 StringItf * new_ref = Self ( jself ) -> getInsertionBases ();
290 return StringItfConvertToJString ( new_ref, jenv );
291 }
292 catch ( ErrorMsg & x )
293 {
294 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
295 }
296 catch ( std :: exception & x )
297 {
298 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
299 }
300 catch ( ... )
301 {
302 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
303 }
304
305 return 0;
306 }
307
308 /*
309 * Class: ngs_itf_PileupEventItf
310 * Method: GetInsertionQualities
311 * Signature: (J)Ljava/lang/String;
312 */
Java_ngs_itf_PileupItf_GetInsertionQualities(JNIEnv * jenv,jobject jthis,jlong jself)313 JNIEXPORT jstring JNICALL Java_ngs_itf_PileupItf_GetInsertionQualities
314 ( JNIEnv * jenv, jobject jthis, jlong jself )
315 {
316 try
317 {
318 StringItf * new_ref = Self ( jself ) -> getInsertionQualities ();
319 return StringItfConvertToJString ( new_ref, jenv );
320 }
321 catch ( ErrorMsg & x )
322 {
323 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
324 }
325 catch ( std :: exception & x )
326 {
327 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
328 }
329 catch ( ... )
330 {
331 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
332 }
333
334 return 0;
335 }
336
337 /*
338 * Class: ngs_itf_PileupEventItf
339 * Method: GetEventRepeatCount
340 * Signature: (J)I
341 */
Java_ngs_itf_PileupItf_GetEventRepeatCount(JNIEnv * jenv,jobject jthis,jlong jself)342 JNIEXPORT jint JNICALL Java_ngs_itf_PileupItf_GetEventRepeatCount
343 ( JNIEnv * jenv, jobject jthis, jlong jself )
344 {
345 try
346 {
347 return ( jint ) Self ( jself ) -> getEventRepeatCount ();
348 }
349 catch ( ErrorMsg & x )
350 {
351 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
352 }
353 catch ( std :: exception & x )
354 {
355 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
356 }
357 catch ( ... )
358 {
359 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
360 }
361
362 return 0;
363 }
364
365 /*
366 * Class: ngs_itf_PileupEventItf
367 * Method: GetEventIndelType
368 * Signature: (J)I
369 */
Java_ngs_itf_PileupItf_GetEventIndelType(JNIEnv * jenv,jobject jthis,jlong jself)370 JNIEXPORT jint JNICALL Java_ngs_itf_PileupItf_GetEventIndelType
371 ( JNIEnv * jenv, jobject jthis, jlong jself )
372 {
373 try
374 {
375 return ( jint ) Self ( jself ) -> getEventIndelType ();
376 }
377 catch ( ErrorMsg & x )
378 {
379 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
380 }
381 catch ( std :: exception & x )
382 {
383 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
384 }
385 catch ( ... )
386 {
387 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
388 }
389
390 return 0;
391 }
392
393 /*
394 * Class: ngs_itf_PileupItf
395 * Method: NextPileupEvent
396 * Signature: (J)Z
397 */
Java_ngs_itf_PileupItf_NextPileupEvent(JNIEnv * jenv,jobject jthis,jlong jself)398 JNIEXPORT jboolean JNICALL Java_ngs_itf_PileupItf_NextPileupEvent
399 ( JNIEnv * jenv, jobject jthis, jlong jself )
400 {
401 try
402 {
403 return ( jboolean ) Self ( jself ) -> nextPileupEvent ();
404 }
405 catch ( ErrorMsg & x )
406 {
407 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
408 }
409 catch ( std :: exception & x )
410 {
411 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
412 }
413 catch ( ... )
414 {
415 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
416 }
417
418 return false;
419 }
420
421
422 /*
423 * Class: ngs_itf_PileupEventIteratorItf
424 * Method: ResetPileupEvent
425 * Signature: (J)V
426 */
Java_ngs_itf_PileupEventIteratorItf_ResetPileupEvent(JNIEnv * jenv,jobject jthis,jlong jself)427 JNIEXPORT void JNICALL Java_ngs_itf_PileupEventIteratorItf_ResetPileupEvent
428 ( JNIEnv * jenv, jobject jthis, jlong jself )
429 {
430 try
431 {
432 Self ( jself ) -> resetPileupEvent ();
433 }
434 catch ( ErrorMsg & x )
435 {
436 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
437 }
438 catch ( std :: exception & x )
439 {
440 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
441 }
442 catch ( ... )
443 {
444 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
445 }
446 }
447
448 #undef Self
449
450 static
Pile(size_t jself)451 PileupItf * Pile ( size_t jself )
452 {
453 if ( jself == 0 )
454 throw ErrorMsg ( "NULL self parameter" );
455
456 return ( PileupItf* ) jself;
457 }
458
459 #define Self( jself ) Pile ( jself )
460
461 /*
462 * Class: ngs_itf_PileupItf
463 * Method: GetReferenceSpec
464 * Signature: (J)Ljava/lang/String;
465 */
Java_ngs_itf_PileupItf_GetReferenceSpec(JNIEnv * jenv,jobject jthis,jlong jself)466 JNIEXPORT jstring JNICALL Java_ngs_itf_PileupItf_GetReferenceSpec
467 ( JNIEnv * jenv, jobject jthis, jlong jself )
468 {
469 try
470 {
471 StringItf * new_ref = Self ( jself ) -> getReferenceSpec ();
472 return StringItfConvertToJString ( new_ref, jenv );
473 }
474 catch ( ErrorMsg & x )
475 {
476 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
477 }
478 catch ( std :: exception & x )
479 {
480 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
481 }
482 catch ( ... )
483 {
484 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
485 }
486
487 return 0;
488 }
489
490 /*
491 * Class: ngs_itf_PileupItf
492 * Method: GetReferencePosition
493 * Signature: (J)J
494 */
Java_ngs_itf_PileupItf_GetReferencePosition(JNIEnv * jenv,jobject jthis,jlong jself)495 JNIEXPORT jlong JNICALL Java_ngs_itf_PileupItf_GetReferencePosition
496 ( JNIEnv * jenv, jobject jthis, jlong jself )
497 {
498 try
499 {
500 return ( jlong ) Self ( jself ) -> getReferencePosition ();
501 }
502 catch ( ErrorMsg & x )
503 {
504 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
505 }
506 catch ( std :: exception & x )
507 {
508 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
509 }
510 catch ( ... )
511 {
512 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
513 }
514
515 return 0;
516 }
517
518 /*
519 * Class: ngs_itf_PileupItf
520 * Method: GetReferenceBase
521 * Signature: (J)C
522 */
Java_ngs_itf_PileupItf_GetReferenceBase(JNIEnv * jenv,jobject jthis,jlong jself)523 JNIEXPORT jchar JNICALL Java_ngs_itf_PileupItf_GetReferenceBase
524 ( JNIEnv * jenv, jobject jthis, jlong jself )
525 {
526 try
527 {
528 return ( jchar ) Self ( jself ) -> getReferenceBase ();
529 }
530 catch ( ErrorMsg & x )
531 {
532 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
533 }
534 catch ( std :: exception & x )
535 {
536 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
537 }
538 catch ( ... )
539 {
540 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
541 }
542
543 return 0;
544 }
545
546 /*
547 * Class: ngs_itf_PileupItf
548 * Method: GetPileupDepth
549 * Signature: (J)I
550 */
Java_ngs_itf_PileupItf_GetPileupDepth(JNIEnv * jenv,jobject jthis,jlong jself)551 JNIEXPORT jint JNICALL Java_ngs_itf_PileupItf_GetPileupDepth
552 ( JNIEnv * jenv, jobject jthis, jlong jself )
553 {
554 try
555 {
556 return ( jint ) Self ( jself ) -> getPileupDepth ();
557 }
558 catch ( ErrorMsg & x )
559 {
560 ErrorMsgThrow ( jenv, xt_error_msg, x . what () );
561 }
562 catch ( std :: exception & x )
563 {
564 ErrorMsgThrow ( jenv, xt_runtime, x . what () );
565 }
566 catch ( ... )
567 {
568 JNI_INTERNAL_ERROR ( jenv, "%s", __func__ );
569 }
570
571 return 0;
572 }
573
574 #undef Self
575
576