У меня есть файл интерфейса SWIG, который предоставляет некоторые функции C (через JNI) моему Java-приложению, и эти структуры C используются в качестве входных данных для функции C (через SWIG / JNI).SWIG генерирует структуру как класс Java, но я не уверен, как установить свойства структур, так как установщики принимают сгенерированный тип SWIG.Мне нужно установить свойства структур перед передачей его в качестве входных данных в функцию C из моего класса Java.example_location_id_t_ - это класс, который мне нужно передать, но установщики для Id
и Phy_idx
принимают следующие типы SWIG.Как мне заполнить SWIGTYPE_p_unsigned_char
и SWIGTYPE_p_uint32_t
, чтобы я мог установить свойства Id
и Phy_idx
класса SWIGTYPE_p_uint32_t
?
setId(SWIGTYPE_p_unsigned_char value)
и setPhy_idx(SWIGTYPE_p_uint32_t value)
package com.test.jni;
public class SWIGTYPE_p_unsigned_char {
private long swigCPtr;
protected SWIGTYPE_p_unsigned_char(long cPtr, boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_unsigned_char() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_unsigned_char obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
package com.test.jni;
public class SWIGTYPE_p_uint32_t {
private long swigCPtr;
protected SWIGTYPE_p_uint32_t(long cPtr, boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_uint32_t() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_uint32_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
package com.test.jni;
public class example_location_id_t_ {
private long swigCPtr;
protected boolean swigCMemOwn;
public example_location_id_t_ (long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
public static long getCPtr(example_location_id_t_ obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
ExampleJNI.delete_example_location_id_t_(swigCPtr);
}
swigCPtr = 0;
}
}
public void setId(SWIGTYPE_p_unsigned_char value) {
ExampleJNI.example_location_id_t__id_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
}
public SWIGTYPE_p_unsigned_char getId() {
long cPtr = ExampleJNI.example_location_id_t__id_get(swigCPtr, this);
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public void setPhy_idx(SWIGTYPE_p_uint32_t value) {
ExampleJNI.example_location_id_t__phy_idx_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
}
public SWIGTYPE_p_uint32_t getPhy_idx() {
return new SWIGTYPE_p_uint32_t(ExampleJNI.example_location_id_t__phy_idx_get(swigCPtr, this), true);
}
public example_location_id_t_() {
this(ExampleJNI.new_example_location_id_t_(), true);
}
}