OpenWalnut
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
src
core
scripting
WScriptInterpreter.h
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
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.
14
//
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.
19
//
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/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#ifndef WSCRIPTINTERPRETER_H
26
#define WSCRIPTINTERPRETER_H
27
28
#include <string>
29
#include <vector>
30
31
/**
32
* \class WScriptInterpreter
33
*
34
* An abstract base class for a script interpreter.
35
*/
36
class
WScriptInterpreter
37
{
38
public
:
39
/**
40
* Destructor.
41
*/
42
virtual
~WScriptInterpreter
();
43
44
/**
45
* Initialize OpenWalnut-bindings. These allow OW-classes to be used via the script interpreter.
46
*/
47
virtual
void
initBindings
() = 0;
48
49
/**
50
* Sets the script parameters. These are the parameters you would normally call your script with, e.g.
51
* "./myscript.py param 1 param2".
52
*
53
* \param params The parameters to the script. In our example, they would be "./myscript.py", "param", "1" and "param2".
54
*/
55
virtual
void
setParameters
( std::vector< std::string >
const
& params ) = 0;
56
57
/**
58
* Execute some code.
59
*
60
* \param line The code to interpret.
61
*/
62
virtual
void
execute
( std::string
const
& line ) = 0;
63
64
/**
65
* Execute a script in a seperate thread. This function returns immediately.
66
*
67
* \param script The script to execute.
68
*/
69
virtual
void
executeAsync
( std::string
const
& script ) = 0;
70
71
/**
72
* Execute a file.
73
*
74
* \param filename The script file to execute.
75
*/
76
virtual
void
executeFile
( std::string
const
& filename ) = 0;
77
78
/**
79
* Execute a script file in a seperate thread. This function returns immediately.
80
*
81
* \param filename The script file to execute.
82
*/
83
virtual
void
executeFileAsync
( std::string
const
& filename ) = 0;
84
85
/**
86
* Get the name of the language interpreted by this interpreter.
87
*
88
* \return The name of the script language.
89
*/
90
virtual
std::string
const
getName
()
const
= 0;
91
92
/**
93
* Get the default extension for script file belonging to the script interpreter's language.
94
*
95
* \return The default file extension.
96
*/
97
virtual
std::string
const
getExtension
()
const
= 0;
98
};
99
100
#endif // WSCRIPTINTERPRETER_H
Generated by
1.8.4