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//=============================================================================================================
71{
72public:
74
75 //=========================================================================================================
76 // Static parameters
77 //=========================================================================================================
78
79 void setParam(const QString& path, const QVariant& value);
80 QVariant param(const QString& path) const;
81 bool hasParam(const QString& path) const;
82 QStringList allPaths() const;
83
84 //=========================================================================================================
85 // Dynamic bindings
86 //=========================================================================================================
87
88 void addBinding(const MnaParamBinding& binding);
89 void removeBinding(const QString& targetPath);
90 QList<MnaParamBinding> bindings() const;
91 bool hasBinding(const QString& targetPath) const;
92
93 //=========================================================================================================
94 // Evaluation
95 //=========================================================================================================
96
102 QStringList evaluate(const QMap<QString, QVariant>& results);
103
110 QVariant evaluateExpression(const QString& expr,
111 const QMap<QString, QVariant>& results) const;
112
113 //=========================================================================================================
114 // Serialization
115 //=========================================================================================================
116
117 QJsonObject toJson() const;
118 static MnaParamTree fromJson(const QJsonObject& obj);
119
120private:
121 QMap<QString, QVariant> m_params;
122 QMap<QString, MnaParamBinding> m_bindings;
123};
124
125} // namespace MNALIB
126
127#endif // MNA_PARAM_TREE_H
Formula-driven binding that recomputes one MNA parameter from an expression whenever its triggers fir...
Export/import macros, build-info accessors, and MNALIB namespace anchor for the MNE Analysis Containe...
#define MNASHARED_EXPORT
Definition mna_global.h:47
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)