v2.0.0
Loading...
Searching...
No Matches
mna_param_tree.h
Go to the documentation of this file.
1//=============================================================================================================
34
35#ifndef MNA_PARAM_TREE_H
36#define MNA_PARAM_TREE_H
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
42#include "mna_global.h"
43#include "mna_param_binding.h"
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QString>
50#include <QStringList>
51#include <QVariant>
52#include <QVariantMap>
53#include <QMap>
54#include <QList>
55#include <QJsonObject>
56
57//=============================================================================================================
58// DEFINE NAMESPACE MNALIB
59//=============================================================================================================
60
61namespace MNALIB
62{
63
64//=============================================================================================================
73{
74public:
76
77 //=========================================================================================================
78 // Static parameters
79 //=========================================================================================================
80
81 void setParam(const QString& path, const QVariant& value);
82 QVariant param(const QString& path) const;
83 bool hasParam(const QString& path) const;
84 QStringList allPaths() const;
85
86 //=========================================================================================================
87 // Dynamic bindings
88 //=========================================================================================================
89
90 void addBinding(const MnaParamBinding& binding);
91 void removeBinding(const QString& targetPath);
92 QList<MnaParamBinding> bindings() const;
93 bool hasBinding(const QString& targetPath) const;
94
95 //=========================================================================================================
96 // Evaluation
97 //=========================================================================================================
98
104 QStringList evaluate(const QMap<QString, QVariant>& results);
105
112 QVariant evaluateExpression(const QString& expr,
113 const QMap<QString, QVariant>& results) const;
114
115 //=========================================================================================================
116 // Serialization
117 //=========================================================================================================
118
119 QJsonObject toJson() const;
120 static MnaParamTree fromJson(const QJsonObject& obj);
121
122private:
123 QMap<QString, QVariant> m_params;
124 QMap<QString, MnaParamBinding> m_bindings;
125};
126
127} // namespace MNALIB
128
129#endif // MNA_PARAM_TREE_H
mna library export/import macros.
#define MNASHARED_EXPORT
Definition mna_global.h:55
MnaParamBinding struct declaration — formula-driven parameter binding.
MNE Analysis Container Format (mna/mnx).
Dynamic parameter binding for the MNA parameter tree.
void removeBinding(const QString &targetPath)
QVariant evaluateExpression(const QString &expr, const QMap< QString, QVariant > &results) const
bool hasParam(const QString &path) const
QList< MnaParamBinding > bindings() const
QJsonObject toJson() const
void addBinding(const MnaParamBinding &binding)
QStringList evaluate(const QMap< QString, QVariant > &results)
QStringList allPaths() const
bool hasBinding(const QString &targetPath) const
QVariant param(const QString &path) const
void setParam(const QString &path, const QVariant &value)
static MnaParamTree fromJson(const QJsonObject &obj)