Beatmup
wrapper.h File Reference
#include "objectpool.h"
#include "log.h"
#include <mutex>
#include <string>

Go to the source code of this file.

Macros

#define JNIMETHOD(R, N, C, O)   JNIEXPORT R JNICALL C##_##O
 
#define BEATMUP_ENTER
 
#define BEATMUP_CATCH(expr)   try expr catch (std::exception& ex) { $pool.rethrowToJava(jenv, ex); }
 
#define BEATMUP_OBJ(type, ptr, handle)    type* ptr = $pool.getObject<type>(jenv, handle)
 
#define BEATMUP_STRING(var)
 
#define BEATMUP_OBJ_OR_NULL(t, p, h)   BEATMUP_OBJ(t,p,h)
 
#define BEATMUP_REFERENCE(jobj, obj)   $pool.addJavaReference(jenv, jobj, obj)
 
#define BEATMUP_DELETE_REFERENCE(obj)   if (obj) $pool.removeJavaReference(jenv, obj)
 

Variables

BeatmupJavaObjectPool $pool
 

Macro Definition Documentation

◆ JNIMETHOD

#define JNIMETHOD (   R,
  N,
  C,
 
)    JNIEXPORT R JNICALL C##_##O

Definition at line 28 of file wrapper.h.

◆ BEATMUP_ENTER

#define BEATMUP_ENTER

Definition at line 35 of file wrapper.h.

◆ BEATMUP_CATCH

#define BEATMUP_CATCH (   expr)    try expr catch (std::exception& ex) { $pool.rethrowToJava(jenv, ex); }

Definition at line 39 of file wrapper.h.

◆ BEATMUP_OBJ

#define BEATMUP_OBJ (   type,
  ptr,
  handle 
)     type* ptr = $pool.getObject<type>(jenv, handle)

Definition at line 42 of file wrapper.h.

◆ BEATMUP_STRING

#define BEATMUP_STRING (   var)
Value:
const char* javaChar = jenv->GetStringUTFChars(var, 0); \
const std::string var##Str(javaChar); \
jenv->ReleaseStringUTFChars(var, javaChar)
JNIEnv * jenv
const char * javaChar

Definition at line 45 of file wrapper.h.

◆ BEATMUP_OBJ_OR_NULL

#define BEATMUP_OBJ_OR_NULL (   t,
  p,
  h 
)    BEATMUP_OBJ(t,p,h)

Definition at line 51 of file wrapper.h.

◆ BEATMUP_REFERENCE

#define BEATMUP_REFERENCE (   jobj,
  obj 
)    $pool.addJavaReference(jenv, jobj, obj)

Definition at line 54 of file wrapper.h.

◆ BEATMUP_DELETE_REFERENCE

#define BEATMUP_DELETE_REFERENCE (   obj)    if (obj) $pool.removeJavaReference(jenv, obj)

Definition at line 57 of file wrapper.h.

Variable Documentation

◆ $pool

BeatmupJavaObjectPool $pool
extern

Definition at line 54 of file wrapper_core.cpp.