Salome HOME
Issue #1084: parameter cyclic dependence
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_PyInterp.h
index 0e3cdee56401f7819ae60e5d31ce7a63102f2a99..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>&);
+  /// 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();
-  double evaluate(const std::string&, std::string&);
+  /// Evaluates theExpression and returns its value.
+  double evaluate(const std::string& theExpression, std::string& theError);
 
  protected:
+  /// Returns error message.
   std::string errorMessage();
-  // Overrides PyInterp_Interp
+  /// Overrides PyInterp_Interp.
   virtual bool initContext();
+  /// Reimplemented from PyInterp_Interp::closeContext().
+  virtual void closeContext();
 };
 
 #endif /* PARAMETERSPLUGIN_PYINTERP_H_ */