1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 * InitializationPlugin_PyInterp.h
5 * Created on: Apr 2, 2015
9 #ifndef INITIALIZATIONPLUGIN_PYINTERP_H_
10 #define INITIALIZATIONPLUGIN_PYINTERP_H_
12 #include <PyInterp_Interp.h>
13 #include <InitializationPlugin.h>
20 * \class InitializationPlugin_PyInterp
22 * \brief Helper class for using Python interpreter.
24 class INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_PyInterp : public PyInterp_Interp
27 InitializationPlugin_PyInterp();
28 virtual ~InitializationPlugin_PyInterp();
30 /// Returns a list of positions for theName in theExpression.
31 std::list<std::pair<int, int> > positions(const std::string& theExpression,
32 const std::string& theName);
33 /// Compiles theExpression and returns a list of parameters used in theExpression.
34 std::list<std::string> compile(const std::string& theExpression);
35 /// Extends local context with the list of parameters.
36 void extendLocalContext(const std::list<std::string>& theParameters);
37 /// Clears local context.
38 void clearLocalContext();
39 /// Evaluates theExpression and returns its value.
40 double evaluate(const std::string& theExpression, std::string& theError);
43 /// Returns error message.
44 std::string errorMessage();
45 /// Overrides PyInterp_Interp.
46 virtual bool initContext();
47 /// Reimplemented from PyInterp_Interp::closeContext().
48 virtual void closeContext();
51 #endif /* INITIALIZATIONPLUGIN_PYINTERP_H_ */