Please, help us to better serve our user community by answering the following short survey: https://www.hdfgroup.org/website-survey/
HDF  4.3.0
API Reference
 
Loading...
Searching...
No Matches
h4jni.h File Reference
#include <string.h>
#include <jni.h>

Macros

#define ENVPTR   (*env)
 
#define ENVONLY   env
 
#define UNUSED(o)   (void)o
 
#define CHECK_JNI_EXCEPTION(envptr, clearException)
 
#define CALL_CONSTRUCTOR(envptr, classname, classsig, args, ret_obj)
 
#define PIN_BYTE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define PIN_BYTE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define UNPIN_BYTE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode)
 
#define PIN_SHORT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define PIN_SHORT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define UNPIN_SHORT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode)
 
#define PIN_INT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define PIN_INT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define UNPIN_INT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode)
 
#define PIN_LONG_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define PIN_LONG_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define UNPIN_LONG_ARRAY(envptr, pinnedArray, bufToRelease, freeMode)
 
#define PIN_FLOAT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define PIN_FLOAT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define UNPIN_FLOAT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode)
 
#define PIN_DOUBLE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define PIN_DOUBLE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define UNPIN_DOUBLE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode)
 
#define PIN_BOOL_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define PIN_BOOL_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg)
 
#define UNPIN_BOOL_ARRAY(envptr, pinnedArray, bufToRelease, freeMode)
 
#define UNPIN_ARRAY_CRITICAL(envptr, pinnedArray, bufToRelease, freeMode)
 
#define PIN_JAVA_STRING(envptr, stringToPin, outString, isCopy, failErrMsg)
 
#define UNPIN_JAVA_STRING(envptr, pinnedString, stringToRelease)
 
#define H4_JNI_FATAL_ERROR(env, message)
 
#define H4_NULL_ARGUMENT_ERROR(env, message)
 
#define H4_BAD_ARGUMENT_ERROR(env, message)
 
#define H4_OUT_OF_MEMORY_ERROR(env, message)
 
#define H4_ASSERTION_ERROR(env, message)
 
#define H4_UNIMPLEMENTED(env, message)
 
#define H4_LIBRARY_ERROR(env)
 
#define H4_RAISE_EXCEPTION(env, message)
 

Functions

jboolean h4JNIFatalError (JNIEnv *, const char *)
 
jboolean h4nullArgument (JNIEnv *, const char *)
 
jboolean h4badArgument (JNIEnv *, const char *)
 
jboolean h4outOfMemory (JNIEnv *, const char *)
 
jboolean h4assertion (JNIEnv *env, const char *)
 
jboolean h4NotImplemented (JNIEnv *, const char *)
 
jboolean h4libraryError (JNIEnv *env)
 
jboolean h4raiseException (JNIEnv *, const char *)
 

Macro Definition Documentation

◆ CALL_CONSTRUCTOR

#define CALL_CONSTRUCTOR ( envptr,
classname,
classsig,
args,
ret_obj )
Value:
do { \
jmethodID constructor; \
jclass cls; \
\
if (NULL == (cls = (*envptr)->FindClass(envptr, (classname)))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, "JNI error: GetObjectClass"); \
} \
if (NULL == (constructor = (*envptr)->GetMethodID(envptr, cls, "<init>", (classsig)))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, "JNI error: GetMethodID failed"); \
} \
if (NULL == (ret_obj = (*envptr)->NewObjectA(envptr, cls, constructor, (args)))) { \
printf("FATAL ERROR: %s: Creation failed\n", classname); \
CHECK_JNI_EXCEPTION(envptr, JNI_FALSE); \
} \
} while (0)

◆ CHECK_JNI_EXCEPTION

#define CHECK_JNI_EXCEPTION ( envptr,
clearException )
Value:
do { \
if (JNI_TRUE == (*envptr)->ExceptionCheck(envptr)) { \
if (JNI_TRUE == clearException) \
(*envptr)->ExceptionClear(envptr); \
else \
goto done; \
} \
} while (0)

◆ ENVONLY

#define ENVONLY   env

◆ ENVPTR

#define ENVPTR   (*env)

◆ H4_ASSERTION_ERROR

#define H4_ASSERTION_ERROR ( env,
message )
Value:
do { \
h4assertion(env, message); \
goto done; \
} while (0)

◆ H4_BAD_ARGUMENT_ERROR

#define H4_BAD_ARGUMENT_ERROR ( env,
message )
Value:
do { \
h4badArgument(env, message); \
goto done; \
} while (0)

◆ H4_JNI_FATAL_ERROR

#define H4_JNI_FATAL_ERROR ( env,
message )
Value:
do { \
h4JNIFatalError(env, message); \
goto done; \
} while (0)

◆ H4_LIBRARY_ERROR

#define H4_LIBRARY_ERROR ( env)
Value:
do { \
h4libraryError(env); \
goto done; \
} while (0)

◆ H4_NULL_ARGUMENT_ERROR

#define H4_NULL_ARGUMENT_ERROR ( env,
message )
Value:
do { \
h4nullArgument(env, message); \
goto done; \
} while (0)

◆ H4_OUT_OF_MEMORY_ERROR

#define H4_OUT_OF_MEMORY_ERROR ( env,
message )
Value:
do { \
h4outOfMemory(env, message); \
goto done; \
} while (0)

◆ H4_RAISE_EXCEPTION

#define H4_RAISE_EXCEPTION ( env,
message )
Value:
do { \
h4raiseException(env, message); \
goto done; \
} while (0)

◆ H4_UNIMPLEMENTED

#define H4_UNIMPLEMENTED ( env,
message )
Value:
do { \
h4NotImplemented(env, message); \
goto done; \
} while (0)

◆ PIN_BOOL_ARRAY

#define PIN_BOOL_ARRAY ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (*envptr)->GetBooleanArrayElements(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_BOOL_ARRAY_CRITICAL

#define PIN_BOOL_ARRAY_CRITICAL ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == \
(outBuf = (jboolean *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_BYTE_ARRAY

#define PIN_BYTE_ARRAY ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (*envptr)->GetByteArrayElements(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_BYTE_ARRAY_CRITICAL

#define PIN_BYTE_ARRAY_CRITICAL ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (jbyte *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_DOUBLE_ARRAY

#define PIN_DOUBLE_ARRAY ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (*envptr)->GetDoubleArrayElements(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_DOUBLE_ARRAY_CRITICAL

#define PIN_DOUBLE_ARRAY_CRITICAL ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == \
(outBuf = (jdouble *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_FLOAT_ARRAY

#define PIN_FLOAT_ARRAY ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (*envptr)->GetFloatArrayElements(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_FLOAT_ARRAY_CRITICAL

#define PIN_FLOAT_ARRAY_CRITICAL ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (jfloat *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_INT_ARRAY

#define PIN_INT_ARRAY ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (*envptr)->GetIntArrayElements(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_INT_ARRAY_CRITICAL

#define PIN_INT_ARRAY_CRITICAL ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (jint *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_JAVA_STRING

#define PIN_JAVA_STRING ( envptr,
stringToPin,
outString,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outString = (*envptr)->GetStringUTFChars(envptr, stringToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_LONG_ARRAY

#define PIN_LONG_ARRAY ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (*envptr)->GetLongArrayElements(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_LONG_ARRAY_CRITICAL

#define PIN_LONG_ARRAY_CRITICAL ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (jlong *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_SHORT_ARRAY

#define PIN_SHORT_ARRAY ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (*envptr)->GetShortArrayElements(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ PIN_SHORT_ARRAY_CRITICAL

#define PIN_SHORT_ARRAY_CRITICAL ( envptr,
arrayToPin,
outBuf,
isCopy,
failErrMsg )
Value:
do { \
if (NULL == (outBuf = (jshort *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
H4_JNI_FATAL_ERROR(envptr, failErrMsg); \
} \
} while (0)

◆ UNPIN_ARRAY_CRITICAL

#define UNPIN_ARRAY_CRITICAL ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleasePrimitiveArrayCritical(envptr, pinnedArray, bufToRelease, freeMode); \
} while (0)

◆ UNPIN_BOOL_ARRAY

#define UNPIN_BOOL_ARRAY ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleaseBooleanArrayElements(envptr, pinnedArray, (jboolean *)bufToRelease, freeMode); \
} while (0)

◆ UNPIN_BYTE_ARRAY

#define UNPIN_BYTE_ARRAY ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleaseByteArrayElements(envptr, pinnedArray, (jbyte *)bufToRelease, freeMode); \
} while (0)

◆ UNPIN_DOUBLE_ARRAY

#define UNPIN_DOUBLE_ARRAY ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleaseDoubleArrayElements(envptr, pinnedArray, (jdouble *)bufToRelease, freeMode); \
} while (0)

◆ UNPIN_FLOAT_ARRAY

#define UNPIN_FLOAT_ARRAY ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleaseFloatArrayElements(envptr, pinnedArray, (jfloat *)bufToRelease, freeMode); \
} while (0)

◆ UNPIN_INT_ARRAY

#define UNPIN_INT_ARRAY ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleaseIntArrayElements(envptr, pinnedArray, (jint *)bufToRelease, freeMode); \
} while (0)

◆ UNPIN_JAVA_STRING

#define UNPIN_JAVA_STRING ( envptr,
pinnedString,
stringToRelease )
Value:
do { \
(*envptr)->ReleaseStringUTFChars(envptr, pinnedString, stringToRelease); \
} while (0)

◆ UNPIN_LONG_ARRAY

#define UNPIN_LONG_ARRAY ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleaseLongArrayElements(envptr, pinnedArray, (jlong *)bufToRelease, freeMode); \
} while (0)

◆ UNPIN_SHORT_ARRAY

#define UNPIN_SHORT_ARRAY ( envptr,
pinnedArray,
bufToRelease,
freeMode )
Value:
do { \
(*envptr)->ReleaseShortArrayElements(envptr, pinnedArray, (jshort *)bufToRelease, freeMode); \
} while (0)

◆ UNUSED

#define UNUSED ( o)    (void)o

Function Documentation

◆ h4assertion()

jboolean h4assertion ( JNIEnv * env,
const char *  )
extern

◆ h4badArgument()

jboolean h4badArgument ( JNIEnv * ,
const char *  )
extern

◆ h4JNIFatalError()

jboolean h4JNIFatalError ( JNIEnv * ,
const char *  )
extern

◆ h4libraryError()

jboolean h4libraryError ( JNIEnv * env)
extern

◆ h4NotImplemented()

jboolean h4NotImplemented ( JNIEnv * ,
const char *  )
extern

◆ h4nullArgument()

jboolean h4nullArgument ( JNIEnv * ,
const char *  )
extern

◆ h4outOfMemory()

jboolean h4outOfMemory ( JNIEnv * ,
const char *  )
extern

◆ h4raiseException()

jboolean h4raiseException ( JNIEnv * ,
const char *  )
extern