36     std::multimap<const Beatmup::Object*, jobject> 
javaRefs;    
 
   50         std::lock_guard<std::mutex> lock(
access);
 
   52         jclass cls = newEnv->FindClass(
"Beatmup/Object");
 
   53         javaContext.handleFieldId = newEnv->GetFieldID(cls, 
"handle", 
"J");
 
   54         newEnv->DeleteLocalRef(cls);
 
   74         return static_cast<Object*
>( (
void*)
handle );
 
   86         LOG_I(
"Hitting object #%lld from Java", ptr);
 
   90         return static_cast<Object*
>( (
void*)
jenv->GetLongField(obj, 
javaContext.handleFieldId) );
 
  106         std::lock_guard<std::mutex> lock(
access);
 
  115         std::lock_guard<std::mutex> lock(
access);
 
  118             jenv->DeleteGlobalRef(ref->second);
 
  128         std::lock_guard<std::mutex> lock(
access);
 
  133             jenv->DeleteGlobalRef(ref->second);
 
  156     static void throwToJava(JNIEnv* 
jenv, 
const char* exceptionClass, 
const char* message) {
 
  157         jclass exClass = 
jenv->FindClass(exceptionClass);
 
  158         jmethodID constructor = 
jenv->GetMethodID(exClass, 
"<init>", 
"(Ljava/lang/String;)V");
 
  159         jobject exception = 
jenv->NewObject(exClass, constructor, 
jenv->NewStringUTF(message));
 
  160         jenv->Throw((jthrowable) exception);
 
  161         jenv->DeleteLocalRef(exClass);
 
Handles all Java binding-related static data.
 
void nullifyHandle(JNIEnv *jenv, jobject obj)
Sets a handle of a java object to null.
 
static void throwToJava(JNIEnv *jenv, const char *exceptionClass, const char *message)
Throws a specific exception.
 
static void throwToJava(JNIEnv *jenv, const char *message)
Throws a general exception.
 
void addJavaReference(JNIEnv *jenv, jobject jobj, const Beatmup::Object *bobj)
Creates new global reference on a Java object to avoid garbage collecting.
 
std::mutex access
structure access control
 
void removeAllJavaReferences(JNIEnv *jenv, const Beatmup::Object *bobj)
Removes all Java references to depending objects.
 
Object * getObject(JNIEnv *jenv, jobject obj)
Retrieves native object from its Java prototype.
 
static const jlong INVALID_HANDLE
 
struct BeatmupJavaObjectPool::@20 javaContext
 
static void rethrowToJava(JNIEnv *jenv, std::exception &ex)
Rethrows a core-caused exception.
 
bool queryJavaContext(JNIEnv *newEnv)
Java context check.
 
jobject getJavaReference(const Beatmup::Object *bobj) const
Returns a reference to the Java object which a given object depends on.
 
void removeJavaReference(JNIEnv *jenv, const Beatmup::Object *bobj)
Removes a Java reference.
 
std::multimap< const Beatmup::Object *, jobject > javaRefs
Java global references representing dependencies of internal objects on external Java objects.
 
Object * getObject(JNIEnv *jenv, jlong handle)
Retrieves native object by its handle.
 
Beatmup object base class
 
Set of utility functions for Java bindings.
 
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
 
JNIEnv jobject jlong handle