1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 * ParametersPlugin_EvalListener.h
5 * Created on: Apr 28, 2015
9 #ifndef SRC_PARAMETERSPLUGIN_EVALLISTENER_H_
10 #define SRC_PARAMETERSPLUGIN_EVALLISTENER_H_
12 #include <ParametersPlugin.h>
13 #include <Events_Loop.h>
15 class ModelAPI_Attribute;
16 class ModelAPI_Document;
17 class ModelAPI_Feature;
18 class ModelAPI_ResultParameter;
19 class ParametersPlugin_Parameter;
22 * \class ParametersPlugin_EvalListener
24 * \brief Class which process the events from the event loop.
26 class ParametersPlugin_EvalListener : public Events_Listener
28 /// map of old names, that were valid for perameres, but now parameter name is changed to invalid
29 /// stored not shared pointers to features to avoid memory keeping on the feature delete
30 std::map<ParametersPlugin_Parameter*, std::string> myOldNames;
32 PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener();
33 PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener();
35 /// Reimplemented from Events_Listener::processEvent().
36 PARAMETERSPLUGIN_EXPORT
37 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
40 /// Processes ObjectRenamed event.
41 void processObjectRenamedEvent(const std::shared_ptr<Events_Message>& theMessage);
42 /// Processes ReplaceParameter event.
43 void processReplaceParameterEvent(const std::shared_ptr<Events_Message>& theMessage);
45 /// Renames theOldName in theExpression by theNewName.
46 std::string renameInPythonExpression(const std::string& theExpression,
47 const std::string& theOldName,
48 const std::string& theNewName);
49 /// Renames theOldName in the expression attribute of theParameter by theNewName.
50 void renameInParameter(std::shared_ptr<ParametersPlugin_Parameter> theParameter,
51 const std::string& theOldName,
52 const std::string& theNewName);
53 /// Renames theOldName in the text fields of theAttribute by theNewName.
54 void renameInAttribute(std::shared_ptr<ModelAPI_Attribute> theAttribute,
55 const std::string& theOldName,
56 const std::string& theNewName);
57 /// Renames theOldName in all dependents of theResultParameter by theNewName.
58 void renameInDependents(std::shared_ptr<ModelAPI_ResultParameter> theResultParameter,
59 const std::string& theOldName,
60 const std::string& theNewName);
63 #endif /* SRC_PARAMETERSPLUGIN_PARAMETERSPLUGIN_EVALLISTENER_H_ */