Salome HOME
Explicit initialization of myDisabled and myConcealed fields of base objects (to...
[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 ModelAPI_ResultParameter;
17 class ParametersPlugin_Parameter;
18 class ParametersPlugin_PyInterp;
19
20 class ParametersPlugin_EvalListener : public Events_Listener
21 {
22  public:
23   PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener();
24   PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener();
25
26   PARAMETERSPLUGIN_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
27
28  protected:
29   double evaluate(const std::string& theExpression, std::string& theError, 
30                   const std::shared_ptr<ModelAPI_Document>& theDocument);
31
32   void processEvaluationEvent(const std::shared_ptr<Events_Message>& theMessage);
33   void processObjectRenamedEvent(const std::shared_ptr<Events_Message>& theMessage);
34   void processReplaceParameterEvent(const std::shared_ptr<Events_Message>& theMessage);
35
36   std::string renameInPythonExpression(const std::string& theExpression,
37                                        const std::string& theOldName,
38                                        const std::string& theNewName);
39   void renameInParameter(std::shared_ptr<ParametersPlugin_Parameter> theParameter,
40                          const std::string& theOldName,
41                          const std::string& theNewName);
42   void renameInAttribute(std::shared_ptr<ModelAPI_Attribute> theAttribute,
43                          const std::string& theOldName,
44                          const std::string& theNewName);
45   void renameInDependants(std::shared_ptr<ModelAPI_ResultParameter> theResultParameter,
46                           const std::string& theNewName);
47
48  private:
49   std::shared_ptr<ParametersPlugin_PyInterp> myInterp;
50 };
51
52 #endif /* SRC_PARAMETERSPLUGIN_PARAMETERSPLUGIN_EVALLISTENER_H_ */