Beatmup
|
Task calling method of a Java object. More...
#include <callback_task.h>
Public Member Functions | |
CallbackTask (JNIEnv *jenv) | |
~CallbackTask () | |
void | setCallbackObject (JNIEnv *jenv, jobject obj) |
Sets the object to be called. More... | |
Public Member Functions inherited from Beatmup::AbstractTask | |
virtual void | beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu) |
Instruction called before the task is executed. More... | |
virtual void | afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted) |
Instruction called after the task is executed. More... | |
virtual bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) |
Executes the task on GPU. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Static Public Attributes | |
static const char * | JAVA_CLASS_NAME = "Beatmup/Utils/Callback" |
callback object java class name More... | |
static const char * | JAVA_METHOD_NAME = "run" |
called method name More... | |
Private Member Functions | |
bool | process (TaskThread &thread) |
Executes the task on CPU within a given thread. More... | |
TaskDeviceRequirement | getUsedDevices () const |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
Private Attributes | |
JavaVM * | jvm |
jmethodID | callbackMethodId |
jobject | callbackObject |
Additional Inherited Members | |
Public Types inherited from Beatmup::AbstractTask | |
enum class | TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY } |
Specifies which device (CPU and/or GPU) is used to run the task. More... | |
Static Public Member Functions inherited from Beatmup::AbstractTask | |
static ThreadIndex | validThreadCount (int number) |
Valid thread count from a given integer value. More... | |
Task calling method of a Java object.
Definition at line 28 of file callback_task.h.
CallbackTask::CallbackTask | ( | JNIEnv * | jenv | ) |
Definition at line 27 of file callback_task.cpp.
CallbackTask::~CallbackTask | ( | ) |
Definition at line 34 of file callback_task.cpp.
|
privatevirtual |
Executes the task on CPU within a given thread.
Generally called by multiple threads.
thread | associated task execution context |
true
if the execution is finished correctly, false
otherwise Implements Beatmup::AbstractTask.
Definition at line 43 of file callback_task.cpp.
|
inlineprivatevirtual |
Communicates devices (CPU and/or GPU) the task is run on.
Reimplemented from Beatmup::AbstractTask.
Definition at line 36 of file callback_task.h.
|
inlineprivatevirtual |
Gives the upper limint on the number of threads the task may be performed by.
The actual number of threads running a specific task may be less or equal to the returned value, depending on the number of workers in ThreadPool running the task.
Reimplemented from Beatmup::AbstractTask.
Definition at line 40 of file callback_task.h.
void CallbackTask::setCallbackObject | ( | JNIEnv * | jenv, |
jobject | obj | ||
) |
Sets the object to be called.
The task calls a void method without parameters named JAVA_METHOD_NAME of a JAVA_CLASS_NAME class instance. The object is protected from accidental garbage collection by a global reference until the task instance is destroyed.
jenv | Java environment instance |
obj | The instance to be called |
Definition at line 51 of file callback_task.cpp.
|
private |
Definition at line 30 of file callback_task.h.
|
private |
Definition at line 31 of file callback_task.h.
|
private |
Definition at line 32 of file callback_task.h.
|
static |
callback object java class name
Definition at line 45 of file callback_task.h.
|
static |
called method name
Definition at line 46 of file callback_task.h.