Salome HOME
Issue #2052: Modification of parameters don't work (sketch, extrusion)
[modules/shaper.git] / src / InitializationPlugin / InitializationPlugin_EvalListener.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2 /*
3  * InitializationPlugin_EvalListener.h
4  *
5  *  Created on: Apr 28, 2015
6  *      Author: sbh
7  */
8
9 #ifndef SRC_INITIALIZATIONPLUGIN_EVALLISTENER_H_
10 #define SRC_INITIALIZATIONPLUGIN_EVALLISTENER_H_
11
12 #include <InitializationPlugin.h>
13 #include <Events_Loop.h>
14
15 class ModelAPI_Attribute;
16 class ModelAPI_Document;
17 class ModelAPI_Feature;
18 class ModelAPI_ResultParameter;
19 class InitializationPlugin_Parameter;
20 class InitializationPlugin_PyInterp;
21
22 /**
23  * \class InitializationPlugin_EvalListener
24  * \ingroup Plugins
25  * \brief Class which process the events from the event loop.
26  */
27 class InitializationPlugin_EvalListener : public Events_Listener
28 {
29  public:
30   INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_EvalListener();
31   INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_EvalListener();
32
33   /// Reimplemented from Events_Listener::processEvent().
34   INITIALIZATIONPLUGIN_EXPORT
35     virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
36
37  protected:
38   /// Evaluates theExpression and returns its value.
39    double evaluate(std::shared_ptr<ModelAPI_Feature> theParameter,
40                   const std::string& theExpression, std::string& theError,
41                   std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
42                   const bool theIsParameter = false);
43
44   /// Processes Evaluation event.
45   void processEvaluationEvent(const std::shared_ptr<Events_Message>& theMessage);
46
47  private:
48   std::shared_ptr<InitializationPlugin_PyInterp> myInterp;
49 };
50
51 #endif /* SRC_INITIALIZATIONPLUGIN_INITIALIZATIONPLUGIN_EVALLISTENER_H_ */