mupp 1.1.0
Loading...
Searching...
No Matches
PVarHandler.h
Go to the documentation of this file.
1/***************************************************************************
2
3 PVarHandler.h
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8***************************************************************************/
9
10/***************************************************************************
11 * Copyright (C) 2007-2026 by Andreas Suter *
12 * andreas.suter@psi.ch *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
28 ***************************************************************************/
29
30#ifndef _PVARHANDLER_H_
31#define _PVARHANDLER_H_
32
33#include <string>
34#include <vector>
35
36#include <QString>
37
38#include "Pmupp.h"
39#include "PAst.hpp"
40#include "PProgram.hpp"
41
42//-----------------------------------------------------------------------------
70 public:
77
94 PVarHandler(PmuppCollection *coll, std::string parse_str, std::string var_name="",
95 const std::vector<PmuppCollection*> &allColl = std::vector<PmuppCollection*>());
96
101 bool isValid() { return fIsValid; }
102
107 QString getCollName() { return fColl->GetName(); }
108
113 QString getVarName() { return QString(fVarName.c_str()); }
114
119 std::vector<double> getValues();
120
125 std::vector<double> getErrors();
126
127 private:
129 std::vector<PmuppCollection*> fAllColl;
130 std::string fParseStr;
131 std::string fVarName;
133
134 bool fIsValid;
136
146
165 void evaluatePython();
166
172 std::string getVarName(int idx);
173
179 std::vector<double> getData(int idx);
180
188 std::vector<double> getDataErr(int idx);
189};
190
191#endif //_PVARHANDLER_H_
Core data structures and handler classes for mupp parameter management.
PmuppCollection * fColl
pointer to collection containing run data needed for parsing and evaluation
std::vector< double > getErrors()
Gets the computed errors for the variable.
QString getVarName()
Gets the variable name.
std::vector< PmuppCollection * > fAllColl
all loaded collections (handler-index order); Python path only, exposed as coll[]/collErr[]
PVarHandler()
Default constructor.
void evaluatePython()
Evaluates the variable using an embedded Python3 interpreter (TPython).
bool isValid()
Checks if the parsing and evaluation were successful.
std::vector< double > getData(int idx)
Gets the data values for a specific parameter across all runs.
std::string fParseStr
the variable input string to be parsed
void injectPredefVariables()
Injects predefined variables from the collection into the AST.
bool fIsValid
flag indicating whether parsing and evaluation succeeded
mupp::prog::PVarHandler fVar
variable handler storing the computed values and errors
std::vector< double > getValues()
Gets the computed values for the variable.
mupp::ast::statement_list fAst
Abstract Syntax Tree generated from parsing.
std::string fVarName
name of the variable to extract from evaluation results
QString getCollName()
Gets the collection name.
std::vector< double > getDataErr(int idx)
Gets the error values for a specific parameter across all runs.
Represents a collection of related experimental runs.
Definition Pmupp.h:234
The PVarHandler class manages variable data during evaluation.
Definition PProgram.hpp:65
std::list< statement > statement_list
Type alias for a list of statements forming a program.
Definition PAst.hpp:268