MADARA  3.4.1
madara::threads::JavaThread Class Reference

A facade for a user-defined Java thread class. More...

#include <JavaThread.h>

Inheritance diagram for madara::threads::JavaThread:
madara::threads::BaseThread

Public Member Functions

 ~JavaThread ()
 Destructor. More...
 
bool check_compliance (jobject obj)
 Checks a Java object for compliance with ai.madara.threads.BaseThread. More...
 
virtual void cleanup (void)
 Calls the Java cleanup method. More...
 
virtual void init (knowledge::KnowledgeBase &context)
 Initializes Java thread with MADARA context. More...
 
void operator= (const JavaThread &rhs)
 Assignment operator. More...
 
virtual void run (void)
 Executes the Java thread's logic. More...
 

Static Public Member Functions

static JavaThreadcreate (jobject obj)
 Creates a JavaThread. More...
 

Protected Member Functions

 JavaThread ()
 Constructor. More...
 
virtual void init_control_vars (knowledge::KnowledgeBase &control)
 Initializes the Java thread implementation's control plane variables. More...
 

Protected Attributes

jclass class_
 the class of the Java object obj_ More...
 
jmethodID cleanup_method_
 handle to the cleanup method More...
 
jmethodID init_method_
 handle to the init method More...
 
std::string name
 The unique name of your thread. More...
 
jobject obj_
 the Java thread implementation of ai.madara.threads.BaseThread More...
 
madara::knowledge::containers::Integer paused
 thread safe paused flag that may be set by the Threader More...
 
jmethodID run_method_
 handle to the run method More...
 
madara::knowledge::containers::Integer terminated
 thread safe terminated flag that may be set by the Threader base More...
 

Detailed Description

A facade for a user-defined Java thread class.

Definition at line 27 of file JavaThread.h.

Constructor & Destructor Documentation

◆ ~JavaThread()

madara::threads::JavaThread::~JavaThread ( )

Destructor.

Definition at line 17 of file JavaThread.cpp.

◆ JavaThread()

madara::threads::JavaThread::JavaThread ( )
protected

Constructor.

Definition at line 12 of file JavaThread.cpp.

Member Function Documentation

◆ check_compliance()

bool madara::threads::JavaThread::check_compliance ( jobject  obj)

Checks a Java object for compliance with ai.madara.threads.BaseThread.

Fills in class members if compliant.

Parameters
obja user-defined ai.madara.threads.BaseThread object

Definition at line 133 of file JavaThread.cpp.

◆ cleanup()

void madara::threads::JavaThread::cleanup ( void  )
virtual

Calls the Java cleanup method.

Reimplemented from madara::threads::BaseThread.

Definition at line 75 of file JavaThread.cpp.

◆ create()

threads::JavaThread * madara::threads::JavaThread::create ( jobject  obj)
static

Creates a JavaThread.

The obj is checked for compliance before returning a JavaThread.

Parameters
obja user-defined ai.madara.threads.BaseThread object

Definition at line 120 of file JavaThread.cpp.

◆ init()

void madara::threads::JavaThread::init ( knowledge::KnowledgeBase context)
virtual

Initializes Java thread with MADARA context.

Parameters
contextcontext for querying current program state

Reimplemented from madara::threads::BaseThread.

Definition at line 88 of file JavaThread.cpp.

◆ init_control_vars()

void madara::threads::JavaThread::init_control_vars ( knowledge::KnowledgeBase control)
protectedvirtual

Initializes the Java thread implementation's control plane variables.

Parameters
controlthe control plane between Threader and threads

Reimplemented from madara::threads::BaseThread.

Definition at line 237 of file JavaThread.cpp.

◆ operator=()

void madara::threads::JavaThread::operator= ( const JavaThread rhs)

Assignment operator.

Definition at line 33 of file JavaThread.cpp.

◆ run()

void madara::threads::JavaThread::run ( void  )
virtual

Executes the Java thread's logic.

Implements madara::threads::BaseThread.

Definition at line 62 of file JavaThread.cpp.

Member Data Documentation

◆ class_

jclass madara::threads::JavaThread::class_
protected

the class of the Java object obj_

Definition at line 86 of file JavaThread.h.

◆ cleanup_method_

jmethodID madara::threads::JavaThread::cleanup_method_
protected

handle to the cleanup method

Definition at line 95 of file JavaThread.h.

◆ init_method_

jmethodID madara::threads::JavaThread::init_method_
protected

handle to the init method

Definition at line 92 of file JavaThread.h.

◆ name

std::string madara::threads::BaseThread::name
protectedinherited

The unique name of your thread.

Definition at line 90 of file BaseThread.h.

◆ obj_

jobject madara::threads::JavaThread::obj_
protected

the Java thread implementation of ai.madara.threads.BaseThread

Definition at line 83 of file JavaThread.h.

◆ paused

madara::knowledge::containers::Integer madara::threads::BaseThread::paused
protectedinherited

thread safe paused flag that may be set by the Threader

Definition at line 101 of file BaseThread.h.

◆ run_method_

jmethodID madara::threads::JavaThread::run_method_
protected

handle to the run method

Definition at line 89 of file JavaThread.h.

◆ terminated

madara::knowledge::containers::Integer madara::threads::BaseThread::terminated
protectedinherited

thread safe terminated flag that may be set by the Threader base

Definition at line 96 of file BaseThread.h.


The documentation for this class was generated from the following files: