GAMS  1.4.0
Acquire_VM.h
Go to the documentation of this file.
1 
2 #ifndef _GAMS_JAVA_ACQUIRE_VM_H_
3 #define _GAMS_JAVA_ACQUIRE_VM_H_
4 
5 #include "gams_jni.h"
6 
14 namespace gams
15 {
16  namespace utility
17  {
18  namespace java
19  {
24  class Acquire_VM
25  {
26  public:
28  {
29  needs_detach = !gams_jni_is_attached();
30  env = gams_jni_get_env();
31  }
32 
34  {
35  if(needs_detach)
36  jni_detach();
37  }
38 
39  JNIEnv * env;
41  };
42  }
43  }
44 }
45 
46 #endif // not defined _GAMS_JAVA_ACQUIRE_VM_H_
This class encapsulates attaching and detaching to a VM.
Definition: Acquire_VM.h:25
Contains all GAMS-related tools, classes and code.