| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2013-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | // this file contains implementation of saving and restoring of an internal state of FaCT++ JNI interface |
| 21 | |
| 22 | #include "uk_ac_manchester_cs_factplusplus_FaCTPlusPlus.h" |
| 23 | #include "Kernel.h" |
| 24 | #include "tJNICache.h" |
| 25 | |
| 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | /* |
| 31 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 32 | * Method: checkSaveLoadContext |
| 33 | * Signature: (Ljava/lang/String;)Z |
| 34 | */ |
| 35 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_checkSaveLoadContext |
| 36 | (JNIEnv * env, jobject obj, jstring str) |
| 37 | { |
| 38 | TRACE_JNI("checkSaveLoadContext"); |
| 39 | TRACE_STR(env,str); |
| 40 | JString* pContext = str ? new JString(env,str) : nullptr; |
| 41 | const char* context = pContext ? (*pContext)() : ""; |
| 42 | bool ret = getK(env,obj)->checkSaveLoadContext(context); |
| 43 | delete pContext; |
| 44 | return ret; |
| 45 | } |
| 46 | |
| 47 | /* |
| 48 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 49 | * Method: setSaveLoadContext |
| 50 | * Signature: (Ljava/lang/String;)Z |
| 51 | */ |
| 52 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_setSaveLoadContext |
| 53 | (JNIEnv * env, jobject obj, jstring str) |
| 54 | { |
| 55 | TRACE_JNI("setSaveLoadContext"); |
| 56 | TRACE_STR(env,str); |
| 57 | JString* pContext = str ? new JString(env,str) : nullptr; |
| 58 | const char* context = pContext ? (*pContext)() : ""; |
| 59 | bool ret = getK(env,obj)->setSaveLoadContext(context); |
| 60 | delete pContext; |
| 61 | return ret; |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 66 | * Method: clearSaveLoadContext |
| 67 | * Signature: (Ljava/lang/String;)Z |
| 68 | */ |
| 69 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_clearSaveLoadContext |
| 70 | (JNIEnv * env, jobject obj, jstring str) |
| 71 | { |
| 72 | TRACE_JNI("clearSaveLoadContext"); |
| 73 | TRACE_STR(env,str); |
| 74 | JString* pContext = str ? new JString(env,str) : nullptr; |
| 75 | const char* context = pContext ? (*pContext)() : ""; |
| 76 | bool ret = getK(env,obj)->clearSaveLoadContext(context); |
| 77 | delete pContext; |
| 78 | return ret; |
| 79 | } |
| 80 | |
| 81 | #ifdef __cplusplus |
| 82 | } |
| 83 | #endif |