Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Details of this changes:
[simgrid.git] / src / java / jxbt_utilities.h
1 /*
2  * $Id$
3  *
4  * Various JNI helper functions
5  *
6  * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved. 
7  *
8  * This program is free software; you can redistribute it and/or modify it 
9  * under the terms of the license (GNU LGPL) which comes with this package.
10  *
11  */
12
13 #ifndef JXBT_UTILITY_H
14 #define JXBT_UTILITY_H
15
16 #include <jni.h>
17 #include "jxbt_utilities.h"
18
19 /* *********** */
20 /* JNI GETTERS */
21 /* *********** */
22
23 /* Search a class and throw an exception if not found */
24 jclass jxbt_get_class(JNIEnv* env, const char*name);
25
26 /* Search a method in a class and throw an exception if not found
27    (it's ok to to pass a NULL class: it's a noop) */
28 jmethodID jxbt_get_jmethod(JNIEnv* env, jclass class, 
29                            const char *name,const char *signature);
30
31 /* Search a field in a class and throw an exception if not found
32    (it's ok to to pass a NULL class: it's a noop) */
33 jfieldID jxbt_get_jfield(JNIEnv* env, jclass class, 
34                          const char *name, const char *signature);
35
36
37 /* Search a method in a class and throw an exception if not found
38    (it's ok to to pass a NULL class: it's a noop) */
39 jmethodID jxbt_get_smethod(JNIEnv* env, const char *classname, 
40                           const char *name,const char *signature);
41
42 /* Search a field in a class and throw an exception if not found
43    (it's ok to to pass a NULL class: it's a noop) */
44 jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname, 
45                         const char *name, const char *signature);
46
47
48 /* ***************** */
49 /* EXCEPTION RAISING */
50 /* ***************** */
51
52
53 /** Thrown on internal error of this layer, or on problem with JNI */
54 void jxbt_throw_jni(JNIEnv* env, const char* msg);
55 /** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */
56 void jxbt_throw_notbound(JNIEnv* env,const char* kind,void *pointer);
57
58 /** Thrown on error in native MSG code */
59 void jxbt_throw_native(JNIEnv* env, char *msg);
60
61 /** Thrown if NULL gets used */
62 void jxbt_throw_null(JNIEnv* env,char *msg);
63
64 /** Thrown on illegal arguments */
65 void jxbt_throw_illegal(JNIEnv* env,char *msg);
66 /** Thrown when looking for an host from name does not lead to anything */
67 void jxbt_throw_host_not_found(JNIEnv* env, const char *invalid_name);
68 /** Thrown when looking for an host from name does not lead to anything */
69 void jxbt_throw_process_not_found(JNIEnv* env, const char *invalid_name);
70
71 #endif /* ! JXBT_UTILITY_H */