Salome HOME
Object Browser tree needed method implementation
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_EvalListener.h
1 /*
2  * ParametersPlugin_EvalListener.h
3  *
4  *  Created on: Apr 28, 2015
5  *      Author: sbh
6  */
7
8 #ifndef SRC_PARAMETERSPLUGIN_EVALLISTENER_H_
9 #define SRC_PARAMETERSPLUGIN_EVALLISTENER_H_
10
11 #include <ParametersPlugin.h>
12 #include <Events_Loop.h>
13
14 class ModelAPI_Attribute;
15 class ModelAPI_Document;
16 class ParametersPlugin_Parameter;
17 class ParametersPlugin_PyInterp;
18
19 class ParametersPlugin_EvalListener : public Events_Listener
20 {
21  public:
22   PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener();
23   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener();
24
25   PARAMETERSPLUGIN_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
26
27  protected:
28   double evaluate(const std::string& theExpression, std::string& theError, 
29                   const std::shared_ptr<ModelAPI_Document>& theDocument);
30
31   void processEvaluationEvent(const std::shared_ptr<Events_Message>& theMessage);
32   void processObjectRenamedEvent(const std::shared_ptr<Events_Message>& theMessage);
33
34   std::string renameInPythonExpression(const std::string& theExpression,
35                                        const std::string& theOldName,
36                                        const std::string& theNewName);
37   void renameInParameter(std::shared_ptr<ParametersPlugin_Parameter> theParameter,
38                          const std::string& theOldName,
39                          const std::string& theNewName);
40   void renameInAttribute(std::shared_ptr<ModelAPI_Attribute> theAttribute,
41                          const std::string& theOldName,
42                          const std::string& theNewName);
43
44  private:
45   std::shared_ptr<ParametersPlugin_PyInterp> myInterp;
46 };
47
48 #endif /* SRC_PARAMETERSPLUGIN_PARAMETERSPLUGIN_EVALLISTENER_H_ */