v2.0.0
Loading...
Searching...
No Matches
mna_param_tree.h
Go to the documentation of this file.
1//=============================================================================================================
30
31#ifndef MNA_PARAM_TREE_H
32#define MNA_PARAM_TREE_H
33
34//=============================================================================================================
35// INCLUDES
36//=============================================================================================================
37
38#include "mna_global.h"
39#include "mna_param_binding.h"
40
41//=============================================================================================================
42// QT INCLUDES
43//=============================================================================================================
44
45#include <QString>
46#include <QStringList>
47#include <QVariant>
48#include <QVariantMap>
49#include <QMap>
50#include <QList>
51#include <QJsonObject>
52
53//=============================================================================================================
54// DEFINE NAMESPACE MNALIB
55//=============================================================================================================
56
57namespace MNALIB
58{
59
60//=============================================================================================================
69{
70public:
72
73 //=========================================================================================================
74 // Static parameters
75 //=========================================================================================================
76
77 void setParam(const QString& path, const QVariant& value);
78 QVariant param(const QString& path) const;
79 bool hasParam(const QString& path) const;
80 QStringList allPaths() const;
81
82 //=========================================================================================================
83 // Dynamic bindings
84 //=========================================================================================================
85
86 void addBinding(const MnaParamBinding& binding);
87 void removeBinding(const QString& targetPath);
88 QList<MnaParamBinding> bindings() const;
89 bool hasBinding(const QString& targetPath) const;
90
91 //=========================================================================================================
92 // Evaluation
93 //=========================================================================================================
94
100 QStringList evaluate(const QMap<QString, QVariant>& results);
101
108 QVariant evaluateExpression(const QString& expr,
109 const QMap<QString, QVariant>& results) const;
110
111 //=========================================================================================================
112 // Serialization
113 //=========================================================================================================
114
115 QJsonObject toJson() const;
116 static MnaParamTree fromJson(const QJsonObject& obj);
117
118private:
119 QMap<QString, QVariant> m_params;
120 QMap<QString, MnaParamBinding> m_bindings;
121};
122
123} // namespace MNALIB
124
125#endif // MNA_PARAM_TREE_H
Export/import macros, build-info accessors, and MNALIB namespace anchor for the MNE Analysis Containe...
#define MNASHARED_EXPORT
Definition mna_global.h:47
Formula-driven binding that recomputes one MNA parameter from an expression whenever its triggers fir...
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)