| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef KONCLUDE_CONTROL_INTERFACE_JNI_CJNIHANDLER_H |
| 22 |
#define KONCLUDE_CONTROL_INTERFACE_JNI_CJNIHANDLER_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#ifdef KONCLUDE_COMPILE_JNI_INTERFACE |
| 26 |
#include <jni.h> |
| 27 |
#endif |
| 28 |
|
| 29 |
|
| 30 |
// Namespace includes |
| 31 |
#include "JNISettings.h" |
| 32 |
#include "CJNIHandlingClassData.h" |
| 33 |
|
| 34 |
// Other includes |
| 35 |
|
| 36 |
|
| 37 |
// Logger includes |
| 38 |
#include "Logger/CLogger.h" |
| 39 |
|
| 40 |
|
| 41 |
namespace Konclude { |
| 42 |
|
| 43 |
namespace Control { |
| 44 |
|
| 45 |
namespace Interface { |
| 46 |
|
| 47 |
namespace JNI { |
| 48 |
|
| 49 |
/*! |
| 50 |
* |
| 51 |
* \class CJNIHandler |
| 52 |
* \author Andreas Steigmiller |
| 53 |
* \version 0.1 |
| 54 |
* \brief TODO |
| 55 |
* |
| 56 |
*/ |
| 57 |
class CJNIHandler { |
| 58 |
|
| 59 |
// public methods |
| 60 |
public: |
| 61 |
#ifdef KONCLUDE_COMPILE_JNI_INTERFACE |
| 62 |
//! Constructor |
| 63 |
CJNIHandler(JNIEnv* jenv); |
| 64 |
|
| 65 |
//! Destructor |
| 66 |
virtual ~CJNIHandler(); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
static bool setJNIInstanceManager(JNIEnv* jenv, jobject obj, CJNIInstanceManager* instanceManger); |
| 73 |
static CJNIInstanceManager* getJNIInstanceManager(JNIEnv* jenv, jobject obj); |
| 74 |
|
| 75 |
|
| 76 |
static jfieldID getJNIInstanceManagerBaseFieldID(JNIEnv* jenv); |
| 77 |
|
| 78 |
|
| 79 |
static void throwException(JNIEnv* jenv, const char* className, const char* reason); |
| 80 |
static void throwException(JNIEnv* jenv, const char* className); |
| 81 |
static void throwGeneralException(JNIEnv* jenv, const char* reason); |
| 82 |
static void throwKoncludeException(JNIEnv* jenv, const char* reason); |
| 83 |
static void throwKoncludeException(JNIEnv* jenv, const QString& reason); |
| 84 |
|
| 85 |
|
| 86 |
QString getString(JNIEnv* jenv, jstring string); |
| 87 |
|
| 88 |
|
| 89 |
CJNIHandlingClassData* getAxiomExpressionBuildingBridgeJNIData(); |
| 90 |
CJNIHandlingClassData* getQueryingBridgeJNIData(); |
| 91 |
CJNIHandlingClassData* getObjectSetCallbackListenerJNIData(); |
| 92 |
CJNIHandlingClassData* getSetOfObjectSetCallbackListenerJNIData(); |
| 93 |
|
| 94 |
|
| 95 |
CJNIHandler* setAxiomExpressionBuildingBridgeNativeData(JNIEnv* jenv, jobject obj, CJNIAxiomExpressionVisitingLoader* loader); |
| 96 |
CJNIAxiomExpressionVisitingLoader* getAxiomExpressionBuildingBridgeNativeData(JNIEnv* jenv, jobject obj); |
| 97 |
|
| 98 |
|
| 99 |
CJNIHandler* setQueryingBridgeNativeData(JNIEnv* jenv, jobject obj, CJNIQueryProcessor* processor); |
| 100 |
CJNIQueryProcessor* getQueryingBridgeNativeData(JNIEnv* jenv, jobject obj); |
| 101 |
|
| 102 |
|
| 103 |
// protected methods |
| 104 |
protected: |
| 105 |
|
| 106 |
// protected variables |
| 107 |
protected: |
| 108 |
|
| 109 |
static jfieldID mBaseBridgeFieldID; |
| 110 |
|
| 111 |
JNIEnv* mJenv; |
| 112 |
|
| 113 |
CJNIHandlingClassData mAxiomExpressionBuildingBridgeData; |
| 114 |
CJNIHandlingClassData mQueryingBridgeData; |
| 115 |
|
| 116 |
CJNIHandlingClassData mObjectSetCallbackListener; |
| 117 |
CJNIHandlingClassData mSetOfObjectSetCallbackListener; |
| 118 |
|
| 119 |
|
| 120 |
// private methods |
| 121 |
private: |
| 122 |
|
| 123 |
// private variables |
| 124 |
private: |
| 125 |
#endif |
| 126 |
|
| 127 |
}; |
| 128 |
|
| 129 |
}; // end namespace JNI |
| 130 |
|
| 131 |
}; // end namespace Interface |
| 132 |
|
| 133 |
}; // end namespace Control |
| 134 |
|
| 135 |
}; // end namespace Konclude |
| 136 |
|
| 137 |
#endif // KONCLUDE_CONTROL_INTERFACE_JNI_CJNIHANDLER_H |