You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
2.9 KiB
C++
124 lines
2.9 KiB
C++
#ifndef NMDATASENSITIVE_H
|
|
#define NMDATASENSITIVE_H
|
|
|
|
#include <QObject>
|
|
#include <QList>
|
|
#include <QVector>
|
|
#include <QString>
|
|
|
|
#include "nmData_global.h"
|
|
#include "nmDataBase.h"
|
|
#include "nmDataAttribute.h"
|
|
#include <rapidjson/document.h>
|
|
|
|
class NM_DATA_EXPORT nmDataSensitive : public nmDataBase
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
// 顶部 Calculation type
|
|
enum CalculationType
|
|
{
|
|
CALC_DETERMINISTIC = 0,
|
|
CALC_DETERMINISTIC_MULTIVARIATE = 1
|
|
};
|
|
|
|
struct NM_DATA_EXPORT VariableSampling
|
|
{
|
|
// 变量所属分组
|
|
QString m_varGroup;
|
|
// 变量名称
|
|
QString m_varName;
|
|
// 是否勾选
|
|
bool m_enabled;
|
|
// Mode 枚举
|
|
enum Mode
|
|
{
|
|
MODE_AUTOMATIC = 0,
|
|
MODE_MANUAL = 1
|
|
};
|
|
// Mode 存储字段
|
|
Mode m_mode;
|
|
// Log? 勾选
|
|
bool m_log;
|
|
// Number
|
|
int m_number;
|
|
// 数据参数
|
|
nmDataAttribute m_modelValue; // Model value
|
|
nmDataAttribute m_minValue; // Minimum
|
|
nmDataAttribute m_maxValue; // Maximum
|
|
// 表格中的数值列表
|
|
QVector<double> m_values;
|
|
VariableSampling();
|
|
|
|
// JSON 序列化 / 反序列化
|
|
rapidjson::Value ToJsonValue(rapidjson::Document::AllocatorType& allocator) const;
|
|
void FromJsonValue(const rapidjson::Value& jsonValue);
|
|
|
|
// varGroup
|
|
QString getVarGroup() const;
|
|
void setVarGroup(const QString& group);
|
|
// varName
|
|
QString getVarName() const;
|
|
void setVarName(const QString& name);
|
|
// enabled
|
|
bool getEnabled() const;
|
|
void setEnabled(bool e);
|
|
// mode
|
|
Mode getMode() const;
|
|
void setMode(Mode m);
|
|
// log
|
|
bool getLog() const;
|
|
void setLog(bool l);
|
|
// number
|
|
int getNumber() const;
|
|
void setNumber(int n);
|
|
// modelValue
|
|
nmDataAttribute& getModelValue();
|
|
void setModelValue(const nmDataAttribute& attr);
|
|
|
|
// minValue
|
|
nmDataAttribute& getMinValue();
|
|
void setMinValue(const nmDataAttribute& attr);
|
|
|
|
// maxValue
|
|
nmDataAttribute& getMaxValue();
|
|
void setMaxValue(const nmDataAttribute& attr);
|
|
|
|
// values
|
|
QVector<double>& getValues();
|
|
void setValues(const QVector<double>& vals);
|
|
};
|
|
|
|
public:
|
|
nmDataSensitive();
|
|
~nmDataSensitive();
|
|
nmDataSensitive(const nmDataSensitive& other);
|
|
nmDataSensitive& operator=(const nmDataSensitive& other);
|
|
|
|
// === 实现 nmDataBase 的抽象方法 ===
|
|
virtual rapidjson::Value ToJsonValue(rapidjson::Document::AllocatorType& allocator) const override;
|
|
virtual void FromJsonValue(const rapidjson::Value& jsonValue) override;
|
|
|
|
// === Calculation type ===
|
|
CalculationType getCalculationType() const;
|
|
void setCalculationType(CalculationType type);
|
|
|
|
// === 总模型数 ===
|
|
int getTotalModelCount() const;
|
|
void setTotalModelCount(int count);
|
|
|
|
// === 变量列表 ===
|
|
QList<VariableSampling>& getVariables();
|
|
void setVariables(const QList<VariableSampling>& vars);
|
|
|
|
int getVariableCount() const;
|
|
VariableSampling& getVariable(int index);
|
|
|
|
private:
|
|
CalculationType m_calcType;
|
|
int m_totalModelCount;
|
|
QList<VariableSampling> m_variables;
|
|
};
|
|
|
|
#endif // NMDATASENSITIVE_H
|