Salome HOME
Issue #1084: parameter cyclic dependence
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_PyInterp.h
index 6bb2a210d46ccd8e5f217716854a39da7bfc8005..6764db13a2112c211243269215043921aee352ba 100644 (file)
 
 #include <list>
 #include <string>
+#include <utility>
 
+/**
+ * \class ParametersPlugin_PyInterp
+ * \ingroup Plugins
+ * \brief Helper class for using Python interpreter.
+ */
 class PARAMETERSPLUGIN_EXPORT ParametersPlugin_PyInterp : public PyInterp_Interp
 {
  public:
   ParametersPlugin_PyInterp();
   virtual ~ParametersPlugin_PyInterp();
 
-  std::list<std::string> compile(const std::string&);
-  void extendLocalContext(const std::list<std::string>&);
-  double evaluate(const std::string&, std::string&);
+  /// Returns a list of positions for theName in theExpression.
+  std::list<std::pair<int, int> > positions(const std::string& theExpression,
+                                            const std::string& theName);
+  /// Compiles theExpression and returns a list of parameters used in theExpression.
+  std::list<std::string> compile(const std::string& theExpression);
+  /// Extends local context with the list of parameters.
+  void extendLocalContext(const std::list<std::string>& theParameters);
+  /// Clears local context.
+  void clearLocalContext();
+  /// Evaluates theExpression and returns its value.
+  double evaluate(const std::string& theExpression, std::string& theError);
 
  protected:
-  std::list<std::string> _compile(const std::string&);
-  void _extendLocalContext(const std::list<std::string>&);
-  double _evaluate(const std::string&, std::string&);
+  /// Returns error message.
   std::string errorMessage();
+  /// Overrides PyInterp_Interp.
+  virtual bool initContext();
+  /// Reimplemented from PyInterp_Interp::closeContext().
+  virtual void closeContext();
 };
 
 #endif /* PARAMETERSPLUGIN_PYINTERP_H_ */