396 lines
20 KiB
C++
396 lines
20 KiB
C++
#pragma once
|
||
|
||
#include "jni.h"
|
||
#include <QVector>
|
||
|
||
//变量名与java中sig对应
|
||
#define SIG_STRING "Ljava/lang/String;"
|
||
#define SIG_LIST "Ljava/util/List;"
|
||
#define SIG_DOUBLE "D"
|
||
#define SIG_INT "I"
|
||
#define SIG_LONG "J"
|
||
#define SIG_SHORT "S"
|
||
#define SIG_BOOL "Z"
|
||
#define SIG_LONG_ARRAY "[[J"
|
||
|
||
enum BindType { BIND_NONE, BIND_STRING, BIND_CHAR, BIND_DOUBLE, BIND_INT };
|
||
|
||
typedef struct _Read_Result_
|
||
{
|
||
/* Infomations */
|
||
jstring msg_type;
|
||
jstring msg_id;
|
||
jstring data_type;
|
||
|
||
/* Header Black */
|
||
jstring designator; // designator
|
||
jstring site_code; // site code
|
||
jstring detector_code; // detector code
|
||
jstring system_type; // system type: P for particulate; B for gas with 3-D β - γ coincidence detection; and
|
||
// G for all other gas systems (high-resolu-tion γ-spectrometry or 2-D β-γ coinci-dence detection)
|
||
jstring sample_geometry; // sample geometry
|
||
jstring spectrum_quantity; // spectrum qualifier: preliminary ( PREL )or full ( FULL)
|
||
jstring sample_ref_id; // sample reference identification
|
||
jstring measurement_id; // measurement identification
|
||
jstring detector_bk_measurement_id; // detector background measurement identification
|
||
jstring gas_bk_measurement_id; // gas background measurement identification (memory effect)
|
||
jstring transmit_date; // transmit date (yyyy / mm / dd)
|
||
jstring transmit_time; // transmit time (hh : mm : ss . s)
|
||
|
||
/* Comment Block */
|
||
jstring comment;
|
||
|
||
/* Sample Block */
|
||
jdouble dimension_1;
|
||
jdouble dimension_2;
|
||
|
||
/* Acquisition Block */
|
||
jstring acquisition_start_date; // acquisition start date (yyyy / mm / dd)
|
||
jstring acquisition_start_time; // acquisition start time (hh : mm : ss . s)
|
||
jdouble acquisition_real_time; // acquisition real time (s)
|
||
jdouble acquisition_live_time; // acquisition live time (s)
|
||
|
||
/* Collection Block */
|
||
jstring collection_start_date; // collection start date (yyyy / mm / dd)
|
||
jstring collection_start_time; // collection start time (hh : mm : ss . s)
|
||
jstring collection_stop_date; // collection stop date (yyyy / mm / dd)
|
||
jstring collection_stop_time; // collection stop time (hh : mm : ss . s)
|
||
jdouble air_volume; // total air volume sampled (standard cubic meters [scm])
|
||
|
||
/* Processing Block */
|
||
jdouble sample_volume_of_Xe; // sample volume of Xe (cm 3 )
|
||
jdouble uncertainty_1; // uncertainty (cm 3 )
|
||
jdouble Xe_collection_yield; // Xe collection yield (Xe gas in sample/total Xe gas sampled)
|
||
jdouble uncertainty_2; // uncertainty (Xe gas in sample/total Xe gas sampled)
|
||
jstring archive_bottle_id; // archive bottle identification
|
||
|
||
/* Calibration Block */
|
||
jstring date_calibration; // date of last calibration (yyyy / mm / dd)
|
||
jstring time_calibration; // time of last calibration (hh : mm : ss)
|
||
|
||
/* g_Energy Block */
|
||
jobjectArray g_energy; // γ -energy (keV)
|
||
jobjectArray g_centroid_channel; // centroid channel
|
||
jobjectArray g_uncertainty; // uncertainty (channels)
|
||
jint g_record_count;
|
||
|
||
/* b_Energy Block */
|
||
jobjectArray b_electron_energy; // electron energy (keV)
|
||
jobjectArray b_decay_mode; // decay mode descriptor: B for β-particle, C for conversion electron (CE)
|
||
jobjectArray b_channel; // maximum channel of β-particle distribution or centroid channel of CE (channels)
|
||
jobjectArray b_uncertainty; // uncertainty (channels)
|
||
jint b_record_count;
|
||
|
||
/* g_Resolution Block */
|
||
jobjectArray g_r_energy; // γ -energy (keV)
|
||
jobjectArray g_r_FWHM; // FWHM (keV)
|
||
jobjectArray g_r_uncertainty; // uncertainty (keV)
|
||
jint g_r_record_count;
|
||
|
||
/* b_Resolution Block */
|
||
jobjectArray b_r_electron_energy; // electron energy (keV)
|
||
jobjectArray b_r_FWHM; // FWHM (keV)
|
||
jobjectArray b_r_uncertainty; // uncertainty (keV)
|
||
jint b_r_record_count;
|
||
|
||
/* g_Efficiency Block */
|
||
jobjectArray g_e_nuclide; // device name
|
||
jobjectArray g_e_energy; // γ -energy (keV)
|
||
jobjectArray g_e_efficiency; // efficiency (counts in peak/photon emitted)
|
||
jobjectArray g_e_uncertainty; // uncertainty (counts in peak/photon emitted)
|
||
jint g_e_record_count;
|
||
|
||
/* ROI_Limits Block */
|
||
jobjectArray ROI_number; // ROI number
|
||
jobjectArray POI_B_x1; // 2-D ROI β-range start, x 1 (keV)
|
||
jobjectArray POI_B_x2; // 2-D ROI β-range stop, x 2 (keV)
|
||
jobjectArray POI_G_y1; // 2-D ROI γ-range start, y 1 (keV)
|
||
jobjectArray POI_G_y2; // 2-D ROI γ-range stop, y 2 (keV)
|
||
jint roi_record_count;
|
||
|
||
/* b-gEfficiency Block */
|
||
jobjectArray bg_nuclide_name; // nuclide name
|
||
jobjectArray bg_ROI_number; // ROI number
|
||
jobjectArray bg_efficiency; // β-γ coincidence efficiency (counts in ROI/β-γ pair emitted)
|
||
jobjectArray bg_uncertainty; // uncertainty (counts in ROI/β-γ pair emitted)
|
||
jint bg_record_count;
|
||
|
||
/* Ratios Block */
|
||
jobjectArray ratio_id; // ratio identifier
|
||
jobjectArray ROI_num_highter_G_energy_ROI; // ROI number for the higher γ -energy ROI
|
||
jobjectArray ROI_num_lower_G_energy_ROI; // ROI number for the lower γ -energy ROI
|
||
jobjectArray count_ratio; // Q_DECLARE_METATYPE(RMSSOHData::HeaderBlock)count ratio(counts in higher γ -energy ROI/counts in lower γ -energy ROI)
|
||
jobjectArray count_ratio_uncertainty; // count ratio uncertainty (percent)
|
||
jint ratio_record_count;
|
||
|
||
/* g_Spectrum Block */
|
||
jlong num_g_channel; // number of γ channels
|
||
jlong g_energy_span; // γ-energy span (keV)
|
||
jlong g_begin_channel; // begin of channels
|
||
jobjectArray g_counts; // count at channel
|
||
|
||
/* b_Spectrum Block */
|
||
jlong num_b_channel; // number of β -channels
|
||
jlong b_energy_span; // β -energy span (keV)
|
||
jlong b_begin_channel; // begin of channels
|
||
jobjectArray b_counts; // counts at channels
|
||
|
||
/* Histogram Block */
|
||
jlong b_channels; // β-channels
|
||
jlong g_channels; // γ-channels
|
||
jlong b_h_energy_span; // β-energy span
|
||
jlong g_h_energy_span; // γ-energy span
|
||
jobjectArray h_counts; // counts at channels
|
||
|
||
/* Certificate Block */
|
||
jdouble total_source_activity = 0; // total source activity (Bq)
|
||
jstring assay_date; // assay date (yyyy / mm / dd)
|
||
jstring assay_time; // assay time (hh : mm : ss)
|
||
jstring units_activity; // units of activity: “B,” “b” for Bq or “[blank]”; if nothing, then “B” is assigned
|
||
jobjectArray nuclide_name; // nuclide name
|
||
jobjectArray half_life_time; // half-life in seconds, hours, days, or years
|
||
jobjectArray time_unit; // time unit(Y, D, H, S)
|
||
jobjectArray activity_nuclide_time_assay; // activity of nuclide at time of assay
|
||
jobjectArray uncertainty; // uncertainty (%)
|
||
jobjectArray cer_g_energy; // γ-energy (keV)
|
||
jobjectArray g_intensity; // γ-intensity (percent)
|
||
jobjectArray electron_decay_mode; // electron decay mode descriptor: B for β particle or C for conversion electron (CE), 0 for none (that is, γ-only source)
|
||
jobjectArray maximum_energy; // maximum β-particle energy or CE energy (keV)
|
||
jobjectArray intensity_b_particle; // intensity of β-particle (percent)
|
||
jint record_count = 0;
|
||
|
||
/* Totaleff Block */
|
||
jobjectArray t_g_energy; // γ-energy (keV)
|
||
jobjectArray total_efficiency; // total efficiency (counts/photon emitted)
|
||
jobjectArray t_uncertainty; // uncertainty (counts/photon emitted)
|
||
jint t_record_count;
|
||
|
||
/*gps block*/
|
||
jdouble lon;
|
||
jdouble lat;
|
||
}ReadResult;
|
||
|
||
typedef struct _Generate_Result_
|
||
{
|
||
//BgGasGenerate BgGas;
|
||
jobjectArray g_ROI_B_Boundary_start;
|
||
jobjectArray g_ROI_B_Boundary_stop;
|
||
jobjectArray g_ROI_G_Boundary_start;
|
||
jobjectArray g_ROI_G_Boundary_stop;
|
||
jobjectArray g_roi_cts; //气体本底谱感兴趣区计数
|
||
jobjectArray g_deduct_d_cts; //气体本底谱扣除探测器本底谱数据
|
||
jint g_b_fitting_type;
|
||
jint g_g_fitting_type;
|
||
jobjectArray g_b_fitting_e_c;
|
||
jobjectArray g_g_fitting_e_c;
|
||
jobjectArray g_b_fitting_c_e;
|
||
jobjectArray g_g_fitting_c_e;
|
||
|
||
//BgSampleGenerate BgSample;
|
||
//BgBoundary s_boungdary;
|
||
jobjectArray s_ROI_B_Boundary_start;
|
||
jobjectArray s_ROI_B_Boundary_stop;
|
||
jobjectArray s_ROI_G_Boundary_start;
|
||
jobjectArray s_ROI_G_Boundary_stop;
|
||
jobjectArray s_roi_cts; //样品普感兴趣区计数
|
||
jobjectArray s_deduct_d_cts; //样品谱扣除探测器本底谱数据
|
||
jint s_b_fitting_type;
|
||
jint s_g_fitting_type;
|
||
jobjectArray s_b_fitting_e_c;
|
||
jobjectArray s_g_fitting_e_c;
|
||
jobjectArray s_b_fitting_c_e;
|
||
jobjectArray s_g_fitting_c_e;
|
||
jstring s_collection_time; //采集时间
|
||
|
||
//BgOtherGenerate BgOther;
|
||
jobjectArray ROI_net_coutns; //感兴趣区净计数
|
||
jobjectArray ROI_net_err;
|
||
jobjectArray ROI_con_uncer; //感兴趣区浓度和不确定度 [n..0]浓度 [n..1]不确定度
|
||
jobjectArray ROI_con_counts_factor; //感兴趣区浓度计数系数 [n..0]系数
|
||
//enum XeType{both,_131m,_133m,none};
|
||
jstring XeType;
|
||
jdouble LC_Xe135; //LC XE135
|
||
jdouble LC_Xe131m; //LC XE131m
|
||
jdouble LC_Xe133m; //LC XE133m
|
||
jdouble LC_Xe133; //LC XE133
|
||
jobjectArray LC;
|
||
jobjectArray LC_CTS;
|
||
jdouble MDC_Xe135; //MDC XE135
|
||
jdouble MDC_Xe131m; //MDC XE131m
|
||
jdouble MDC_Xe133m; //MDC XE133m
|
||
jdouble MDC_Xe133; //MDC XE133
|
||
jobjectArray MDC;
|
||
jobjectArray MDC_CTS;
|
||
jdouble Xe135_con; //135不浓度
|
||
jdouble Xe135_uncer; //135不确定度
|
||
jdouble Xe131m_con;
|
||
jdouble Xe131m_uncer;
|
||
jdouble Xe133m_con;
|
||
jdouble Xe133m_uncer;
|
||
jdouble Xe133_con;
|
||
jdouble Xe133_uncer;
|
||
jobjectArray ROI_B_Boundary_start;
|
||
jobjectArray ROI_B_Boundary_stop;
|
||
jobjectArray ROI_G_Boundary_start;
|
||
jobjectArray ROI_G_Boundary_stop;
|
||
jobjectArray d_roi_cts; //探测器本底谱感兴趣区计数
|
||
// 拟合后值
|
||
jint b_fitting_type;
|
||
jint g_fitting_type;
|
||
jobjectArray b_fitting_e_c;
|
||
jobjectArray g_fitting_e_c;
|
||
jobjectArray b_fitting_c_e;
|
||
jobjectArray g_fitting_c_e;
|
||
//BgDetbgrGenerate BgDetbgr;
|
||
jobjectArray d_ROI_B_Boundary_start;
|
||
jobjectArray d_ROI_B_Boundary_stop;
|
||
jobjectArray d_ROI_G_Boundary_start;
|
||
jobjectArray d_ROI_G_Boundary_stop;
|
||
jobjectArray d_d_roi_cts; //探测器本底谱感兴趣区计数
|
||
jint d_b_fitting_type;
|
||
jint d_g_fitting_type;
|
||
jobjectArray d_b_fitting_e_c;
|
||
jobjectArray d_g_fitting_e_c;
|
||
jobjectArray d_b_fitting_c_e;
|
||
jobjectArray d_g_fitting_c_e;
|
||
}GenerateResult;
|
||
|
||
typedef struct _SOHFile_Result_
|
||
{
|
||
/* Header block */
|
||
jstring station_code; // station code
|
||
jstring detector_code; // detector code or NA if 1) there is more than one detector or 2) data are from the sam-pling site of a split station
|
||
jstring start_date; // SOH data sampling period start date (yyyy/mm/dd)
|
||
jstring start_time; // SOH data sampling period start time (hh:mm:ss)
|
||
jstring designator; // designator
|
||
jstring end_date; // SOH data sampling period end date (yyyy/mm/dd)
|
||
jstring end_time; // SOH data sampling period end time (hh:mm:ss)
|
||
jstring transmit_date; // transmit date (yyyy/mm/dd)
|
||
jstring transmit_time; // transmit time (hh:mm:ss)
|
||
|
||
/* Air Sampler Flow block */
|
||
jobjectArray average_flow_rate; // average flow rate (standard cubic metersper hour (scm/h))
|
||
jobjectArray flow_rate_standard_deviation; // flow rate standard deviation (scm/h)
|
||
jobjectArray af_start_date; // SOH data sampling interval start date (yyyy/mm/dd)
|
||
jobjectArray af_start_time; // SOH data sampling interval start time (hh:mm:ss)
|
||
jobjectArray af_interval_duration; // SOH data sampling interval duration (s)
|
||
jint af_record_count;
|
||
|
||
/* Air Sampler Env block */
|
||
jobjectArray temperature; // average air temperature after filter (°C)
|
||
jobjectArray pressure; // average static air pressure after filter (hPa)
|
||
jobjectArray ae_date; // date (yyyy/mm/dd)
|
||
jobjectArray ae_time; // time (hh:mm:ss)
|
||
jobjectArray ae_interval_duration; // SOH data sampling interval duration (s)
|
||
jint ae_record_count;
|
||
|
||
/* Det Env block */
|
||
jobjectArray room_temperature; // average room temperature (°C)
|
||
jobjectArray detector_shield_status; // detector shield status (OPEN or CLOSED)
|
||
jobjectArray humidity; // average room humidity (in percent relative humidity)
|
||
jobjectArray d_voltage; // detector high voltage (V)
|
||
jobjectArray crystal_temperature; // average crystal temperature (°C)
|
||
jobjectArray electric_cooler_status; // electric cooler status (ON or OFF)
|
||
jobjectArray fill_fraction; // liquid nitrogen fill-fraction
|
||
jobjectArray leakage; // detector leakage current (nanoamperes [nA])
|
||
jobjectArray d_date; // date (yyyy/mm/dd)
|
||
jobjectArray d_time; // time (hh:mm:ss)
|
||
jobjectArray d_interval_duration; // SOH data sampling interval duration (s)
|
||
jint d_record_count;
|
||
|
||
/* NIMBIN block */
|
||
jobjectArray flag; // +/-
|
||
jobjectArray n_voltage; // average NIMBIN voltage (V)
|
||
jobjectArray n_date; // date (yyyy/mm/dd)
|
||
jobjectArray n_time; // time (hh:mm:ss)
|
||
jobjectArray n_interval_duration; // SOH data sampling interval duration (s)
|
||
jint n_record_count;
|
||
|
||
/* Power Supply block */
|
||
jobjectArray MAIN; // MAIN (for MAIN power supply)
|
||
jobjectArray main_power_status; // status of main power supply (ON/OFF)
|
||
jobjectArray AUX; // AUX (for AUXiliary power supply)
|
||
jobjectArray aux_power_status; // status of auxiliary power supply (ON/OFF)
|
||
jobjectArray UPS; // UPS (for Uninterrupted Power Supply)
|
||
jobjectArray ups_status; // status of uninterruptedly power supply (ON/ OFF)
|
||
jobjectArray p_date; // date (yyyy/mm/dd)
|
||
jobjectArray p_time; // time (hh:mm:ss)
|
||
jobjectArray p_interval_duration; // SOH data sampling interval duration (s)
|
||
jint p_record_count;
|
||
|
||
/* Equip Status block */
|
||
jobjectArray C_value; // status of sampling system (ON/OFF) or the SRID of the sample being collected
|
||
jobjectArray P_value; // status of sample preparation, processing, or decay (ON/OFF) or the SRID of the sample being processed or decayed
|
||
jobjectArray A_value; // status of detector system (ON/OFF) or the SRID of the sample being counted
|
||
jobjectArray e_date; // date (yyyy/mm/dd)
|
||
jobjectArray e_time; // time (hh:mm:ss)
|
||
jobjectArray e_interval_duration; // SOH data sampling interval duration (s)
|
||
jint e_record_count;
|
||
|
||
/* Tamper Env block */
|
||
jobjectArray tamper_sensor_name; // tamper sensor name
|
||
jobjectArray tamper_sensor_status; // tamper sensor status (OPEN or CLOSED)
|
||
jobjectArray t_date; // date (yyyy/mm/dd)
|
||
jobjectArray t_time; // time (hh:mm:ss)
|
||
jobjectArray t_interval_duration; // SOH data sampling interval duration (s)
|
||
jint t_record_count;
|
||
|
||
/* Process Sensors block */
|
||
jobjectArray sensor_type; // sensor type (TEMP, PRESSURE,PROCESSFLOW, VOLTAGE, COUN-TRATES, DEWPOINT, CO2VOLUME)
|
||
jobjectArray sensor_name; // tamper sensor status (OPEN or CLOSED)
|
||
jobjectArray sensor_reading; // sensor reading (TEMP in °C, PRESSURE in Pa, PROCESSFLOW in m3/h, VOLT-AGE in V, COUNTRATE in counts/s, DEWPOINT in °C, CO2VOLUME in cm3)
|
||
jobjectArray ps_date; // date (yyyy/mm/dd)
|
||
jobjectArray ps_time; // time (hh:mm:ss)
|
||
jobjectArray ps_duration; // SOH duration (s)
|
||
jint ps_record_count;
|
||
|
||
/* Chromatogram block */
|
||
jstring srid; // the SRID of the sample being counted
|
||
jobjectArray interval_number; // interval number (starts at 1)
|
||
jobjectArray interval_start_channel; // interval start channel
|
||
jobjectArray c_duration; // duration between chromatogram readings (in seconds [s])
|
||
jint interval_record_count;
|
||
jlong total_number; // total number of chromatogram readings
|
||
jobjectArray detector_response; // detector response
|
||
}SOHFileResult;
|
||
|
||
class CplusToJava
|
||
{
|
||
public:
|
||
static jobjectArray GetjobjectArray(JNIEnv* env, jclass jcls, jobject jstruct, std::string var);
|
||
//将QVector<double>转换为jobjectArray
|
||
static jobjectArray QVectorD2jobjectArray(QVector<double> vec, JNIEnv* env);
|
||
//将QVector<QString>转换为jobjectArray
|
||
static jobjectArray QVectorQS2jobjectArray(QVector<QString> vec, JNIEnv* env);
|
||
//将QVector<long>转换为jobjectArray
|
||
static jobjectArray QVectorL2jobjectArray(QVector<long> vec, JNIEnv* env);
|
||
//将QVector<long>转换为jobjectArray
|
||
static jobjectArray QVectorLL2jobjectArray(QVector<long long> vec, JNIEnv* env);
|
||
//将QVector<int>转换为jobjectArray
|
||
static jobjectArray QVectorI2jobjectArray(QVector<int> vec, JNIEnv* env);
|
||
//将QVector<short>转换为jobjectArray
|
||
static jobjectArray QVectorS2jobjectArray(QVector<short> vec, JNIEnv* env);
|
||
//生成jobject
|
||
static jobject Createjobject(JNIEnv* env, jint esize, jobjectArray array);
|
||
//生成2djobject
|
||
static jobject Create2Djobject(JNIEnv* env, jint esize, jobjectArray array, jint row, jint col);
|
||
//jobject转换为jobjectArray
|
||
static jobjectArray jobject2jobjectArray(JNIEnv* env, jobject array);
|
||
//将jobjectArray转换为QVector<double>
|
||
static QVector<double> jobjectArray2QVectorD(JNIEnv* env, jobjectArray listValue);
|
||
//将jstring转换为QString
|
||
static QString jstring2QString(JNIEnv* env, jstring jstr);
|
||
|
||
//结构体获取
|
||
static QString getStructString(JNIEnv* env, jclass jcls, jobject jstruct, const char* name);
|
||
|
||
//-999判断
|
||
static double DoubleLimit(const double& _data);
|
||
static double DoubleLimit(const QString& _data);
|
||
static QVector<QString> DoubleLimit(QVector<QString>& data);
|
||
static QVector<QString> DoubleLimit(QVector<double> _data);
|
||
|
||
static QString GetSqlBy(const QVector<QString>& _data, bool bSFlag);
|
||
};
|
||
|