25 #ifndef WSCRIPTINTERPRETERPYTHON_H
26 #define WSCRIPTINTERPRETERPYTHON_H
34 #include <boost/thread/mutex.hpp>
35 #include <boost/python.hpp>
37 #include "../../common/WThreadedRunner.h"
39 #include "../wrappers/WLoggerWrapper.h"
40 #include "../wrappers/WModuleContainerWrapper.h"
42 #include "../WScriptInterpreter.h"
44 namespace pb = boost::python;
57 explicit WScriptInterpreterPython( boost::shared_ptr< WModuleContainer >
const& rootContainer );
62 virtual ~WScriptInterpreterPython();
75 virtual void setParameters( std::vector< std::string >
const& params );
82 virtual void execute( std::string
const& line );
96 virtual void executeFile( std::string
const& filename );
110 virtual std::string
const getName()
const;
129 explicit ScriptThread( WScriptInterpreterPython& interpreter );
134 virtual ~ScriptThread();
140 virtual void threadMain();
147 void addToExecuteQueue( std::string
const& script );
156 std::queue< std::string > m_scriptQueue;
159 boost::mutex m_queueMutex;
162 boost::shared_ptr< WCondition > m_condition;
168 WScriptInterpreterPython& m_interpreter;
172 pb::object m_pyModule;
175 pb::object m_pyMainNamespace;
190 boost::mutex m_mutex;
193 ScriptThread m_scriptThread;
196 #endif // PYTHON_FOUND
198 #endif // WSCRIPTINTERPRETERPYTHON_H
virtual std::string const getExtension() const =0
Get the default extension for script file belonging to the script interpreter's language.
virtual void execute(std::string const &line)=0
Execute some code.
virtual void executeFile(std::string const &filename)=0
Execute a file.
Base class for all classes needing to be executed in a separate thread.
An abstract base class for a script interpreter.
Class allowing multiple conditions to be used for one waiting cycle.
virtual void executeAsync(std::string const &script)=0
Execute a script in a seperate thread.
virtual std::string const getName() const =0
Get the name of the language interpreted by this interpreter.
virtual void setParameters(std::vector< std::string > const ¶ms)=0
Sets the script parameters.
virtual void executeFileAsync(std::string const &filename)=0
Execute a script file in a seperate thread.
Encapsulates a module container.
virtual void initBindings()=0
Initialize OpenWalnut-bindings.