X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/72e3f21f7aaa97e1aed018cd49b8e26ae000f487..3913bb7b7d28a6c8f383b7973f72a4fc7a1f4f01:/src/java/jxbt_utilities.h diff --git a/src/java/jxbt_utilities.h b/src/java/jxbt_utilities.h new file mode 100644 index 0000000000..97e5eb4a13 --- /dev/null +++ b/src/java/jxbt_utilities.h @@ -0,0 +1,71 @@ +/* + * $Id$ + * + * Various JNI helper functions + * + * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. + * + */ + +#ifndef JXBT_UTILITY_H +#define JXBT_UTILITY_H + +#include +#include "jxbt_utilities.h" + +/* *********** */ +/* JNI GETTERS */ +/* *********** */ + +/* Search a class and throw an exception if not found */ +jclass jxbt_get_class(JNIEnv* env, const char*name); + +/* Search a method in a class and throw an exception if not found + (it's ok to to pass a NULL class: it's a noop) */ +jmethodID jxbt_get_jmethod(JNIEnv* env, jclass class, + const char *name,const char *signature); + +/* Search a field in a class and throw an exception if not found + (it's ok to to pass a NULL class: it's a noop) */ +jfieldID jxbt_get_jfield(JNIEnv* env, jclass class, + const char *name, const char *signature); + + +/* Search a method in a class and throw an exception if not found + (it's ok to to pass a NULL class: it's a noop) */ +jmethodID jxbt_get_smethod(JNIEnv* env, const char *classname, + const char *name,const char *signature); + +/* Search a field in a class and throw an exception if not found + (it's ok to to pass a NULL class: it's a noop) */ +jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname, + const char *name, const char *signature); + + +/* ***************** */ +/* EXCEPTION RAISING */ +/* ***************** */ + + +/** Thrown on internal error of this layer, or on problem with JNI */ +void jxbt_throw_jni(JNIEnv* env, const char* msg); +/** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */ +void jxbt_throw_notbound(JNIEnv* env,const char* kind,void *pointer); + +/** Thrown on error in native MSG code */ +void jxbt_throw_native(JNIEnv* env, char *msg); + +/** Thrown if NULL gets used */ +void jxbt_throw_null(JNIEnv* env,char *msg); + +/** Thrown on illegal arguments */ +void jxbt_throw_illegal(JNIEnv* env,char *msg); +/** Thrown when looking for an host from name does not lead to anything */ +void jxbt_throw_host_not_found(JNIEnv* env, const char *invalid_name); +/** Thrown when looking for an host from name does not lead to anything */ +void jxbt_throw_process_not_found(JNIEnv* env, const char *invalid_name); + +#endif /* ! JXBT_UTILITY_H */