2 * ParametersPlugin_PyInterp.h
4 * Created on: Apr 2, 2015
8 #ifndef PARAMETERSPLUGIN_PYINTERP_H_
9 #define PARAMETERSPLUGIN_PYINTERP_H_
11 #include <PyInterp_Interp.h>
12 #include <ParametersPlugin.h>
19 * \class ParametersPlugin_PyInterp
21 * \brief Helper class for using Python interpreter.
23 class PARAMETERSPLUGIN_EXPORT ParametersPlugin_PyInterp : public PyInterp_Interp
26 ParametersPlugin_PyInterp();
27 virtual ~ParametersPlugin_PyInterp();
29 /// Returns a list of positions for theName in theExpression.
30 std::list<std::pair<int, int> > positions(const std::string& theExpression,
31 const std::string& theName);
32 /// Compiles theExpression and returns a list of parameters used in theExpression.
33 std::list<std::string> compile(const std::string& theExpression);
34 /// Extends local context with the list of parameters.
35 void extendLocalContext(const std::list<std::string>& theParameters);
36 /// Clears local context.
37 void clearLocalContext();
38 /// Evaluates theExpression and returns its value.
39 double evaluate(const std::string& theExpression, std::string& theError);
42 /// Returns error message.
43 std::string errorMessage();
44 /// Overrides PyInterp_Interp.
45 virtual bool initContext();
46 /// Reimplemented from PyInterp_Interp::closeContext().
47 virtual void closeContext();
50 #endif /* PARAMETERSPLUGIN_PYINTERP_H_ */