1
//---------------------------------------------------------------------------
3
// Project: OpenWalnut ( http://www.openwalnut.org )
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
8
// This file is part of OpenWalnut.
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
23
//---------------------------------------------------------------------------
25
#ifndef WSCRIPTENGINE_H
26
#define WSCRIPTENGINE_H
31
#include <boost/shared_ptr.hpp>
33
#include "../kernel/WModuleContainer.h"
35
#include "WScriptInterpreter.h"
38
* The script engine. Provides all script interpreters available for the OpenWalnut installation. Which
39
* interpreters are available depends on the libs available at OpenWalnut build time.
45
* Constructs a new script engine.
47
* \param rootContainer The root module container to use for modules inserted via scripts.
49
explicit WScriptEngine( boost::shared_ptr< WModuleContainer > const& rootContainer );
54
virtual ~WScriptEngine();
57
* This finds an interpreter suitable for executing script files ending with the given extension.
59
* \param ext The extension of the script file to execute.
61
* \return The matching script interpreter or a NULL-pointer, if no such interpreter was available.
63
boost::shared_ptr< WScriptInterpreter > getInterpreterByFileExtension( std::string const& ext );
66
* This finds an interpreter by script language name.
68
* \param name The name of the script language.
70
* \return The matching script interpreter or a NULL-pointer, if no such interpreter was available.
72
boost::shared_ptr< WScriptInterpreter > getInterpreter( std::string const& name );
75
* Get the number of script interpreters available.
77
* \return The number of available script interpreters.
79
std::size_t getNumInterpreters() const;
82
* Get the i'th script interpreter.
84
* \param index The index of the script interpreter to retrieve, must be in [0,getNumInterpreters()-1].
86
* \return The script interpreter or a NULL-pointer if the index was invalid.
88
boost::shared_ptr< WScriptInterpreter > getInterpreter( std::size_t index );
91
//! The list of available script interpreters.
92
std::vector< boost::shared_ptr< WScriptInterpreter > > m_interpreters;
95
#endif // WSCRIPTENGINE_H