25 #ifndef WSCRIPTINTERPRETERPYTHON_H
26 #define WSCRIPTINTERPRETERPYTHON_H
35 #include <boost/thread/mutex.hpp>
38 #include <boost/python.hpp>
41 #include "../../common/WThreadedRunner.h"
43 #include "../wrappers/WLoggerWrapper.h"
44 #include "../wrappers/WModuleContainerWrapper.h"
46 #include "../WScriptInterpreter.h"
48 namespace pb = boost::python;
61 explicit WScriptInterpreterPython( boost::shared_ptr< WModuleContainer >
const& rootContainer );
66 virtual ~WScriptInterpreterPython();
79 virtual void setParameters( std::vector< std::string >
const& params );
86 virtual void execute( std::string
const& line );
100 virtual void executeFile( std::string
const& filename );
114 virtual std::string
const getName()
const;
133 explicit ScriptThread( WScriptInterpreterPython& interpreter );
138 virtual ~ScriptThread();
144 virtual void threadMain();
151 void addToExecuteQueue( std::string
const& script );
160 std::queue< std::string > m_scriptQueue;
163 boost::mutex m_queueMutex;
166 boost::shared_ptr< WCondition > m_condition;
172 WScriptInterpreterPython& m_interpreter;
176 pb::object m_pyModule;
179 pb::object m_pyMainNamespace;
194 boost::mutex m_mutex;
197 ScriptThread m_scriptThread;
200 #endif // PYTHON_FOUND
202 #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.