Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new line at the end of the file, to avoid a gcc warning (turned into error by...
[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 /* Like the jxbt_get_class() but get a static method */
32 jmethodID jxbt_get_static_jmethod(JNIEnv* env, jclass cls, 
33                            const char *name,const char *signature);
34
35 /* Search a field in a class and throw an exception if not found
36    (it's ok to to pass a NULL class: it's a noop) */
37 jfieldID jxbt_get_jfield(JNIEnv* env, jclass class, 
38                          const char *name, const char *signature);
39
40
41 /* Search a method in a class and throw an exception if not found
42    (it's ok to to pass a NULL class: it's a noop) */
43 jmethodID jxbt_get_smethod(JNIEnv* env, const char *classname, 
44                           const char *name,const char *signature);
45
46 /* Like the jxbt_get_smethod() but get a static method */
47 jmethodID jxbt_get_static_smethod(JNIEnv* env, const char *classname, 
48                           const char *name,const char *signature);
49
50 /* Search a field in a class and throw an exception if not found
51    (it's ok to to pass a NULL class: it's a noop) */
52 jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname, 
53                         const char *name, const char *signature);
54
55
56 /* ***************** */
57 /* EXCEPTION RAISING */
58 /* ***************** */
59
60
61 /** Thrown on internal error of this layer, or on problem with JNI */
62 void jxbt_throw_jni(JNIEnv* env, const char* msg);
63 /** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */
64 void jxbt_throw_notbound(JNIEnv* env,const char* kind,void *pointer);
65
66 /** Thrown on error in native MSG code */
67 void jxbt_throw_native(JNIEnv* env, char *msg);
68
69 /** Thrown if NULL gets used */
70 void jxbt_throw_null(JNIEnv* env,char *msg);
71
72 /** Thrown on illegal arguments */
73 void jxbt_throw_illegal(JNIEnv* env,char *msg);
74 /** Thrown when looking for an host from name does not lead to anything */
75 void jxbt_throw_host_not_found(JNIEnv* env, const char *invalid_name);
76 /** Thrown when looking for an host from name does not lead to anything */
77 void jxbt_throw_process_not_found(JNIEnv* env, const char *invalid_name);
78
79 #endif /* ! JXBT_UTILITY_H */