1 // Copyright (C) 2014-2022 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SRC_INITIALIZATIONPLUGIN_EVALLISTENER_H_
21 #define SRC_INITIALIZATIONPLUGIN_EVALLISTENER_H_
23 #include <InitializationPlugin.h>
24 #include <Events_Loop.h>
26 class ModelAPI_Attribute;
27 class ModelAPI_Document;
28 class ModelAPI_Feature;
29 class ModelAPI_ResultParameter;
30 class InitializationPlugin_Parameter;
31 class InitializationPlugin_PyInterp;
34 * \class InitializationPlugin_EvalListener
36 * \brief Class which process the events from the event loop.
38 class InitializationPlugin_EvalListener : public Events_Listener
41 INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_EvalListener();
42 INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_EvalListener();
44 /// Reimplemented from Events_Listener::processEvent().
45 INITIALIZATIONPLUGIN_EXPORT
46 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
48 // performs the python call to initialize high level data model on internal data model creation
52 /// Evaluates theExpression and returns its value.
53 double evaluate(std::shared_ptr<ModelAPI_Feature> theParameter,
54 const std::wstring& theExpression, std::string& theError,
55 std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
56 const bool theIsParameter = false);
58 /// Evaluates theExpression with variable local and returns its value.
59 double evaluate(std::wstring& theVariable,
60 double theValueVariable,
61 std::shared_ptr<ModelAPI_Feature> theParameter,
62 const std::wstring& theExpression,
63 std::string& theError,
64 std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
68 /// Processes Evaluation event.
69 void processEvaluationEvent(const std::shared_ptr<Events_Message>& theMessage);
72 std::shared_ptr<InitializationPlugin_PyInterp> myInterp;
75 #endif /* SRC_INITIALIZATIONPLUGIN_INITIALIZATIONPLUGIN_EVALLISTENER_H_ */