OpenASIP  2.0
Script.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file Script.hh
26  *
27  * Declaration of Script class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
31  */
32 
33 #ifndef TTA_SCRIPT_HH
34 #define TTA_SCRIPT_HH
35 
36 #include <string>
37 #include <vector>
38 
39 #include "ScriptInterpreter.hh"
40 #include "DataObject.hh"
41 #include "Exception.hh"
42 
43 /**
44  * Helper class that contains line(s) of script that can be executed on
45  * demand.
46  */
47 class Script {
48 public:
49  Script(ScriptInterpreter* interpreter, std::string scriptLine);
50  Script(ScriptInterpreter* interpreter, std::vector<std::string>& script);
51  virtual ~Script();
52 
53  virtual DataObject execute();
55  virtual std::vector<std::string> script() const;
56 protected:
57  /// Interpreter executing the commands.
59 private:
60  /// Result of execution.
62  /// Flag indicating whether script has been executed or not.
64  /// Contains script.
65  std::vector<std::string> scriptLines_;
66 };
67 
68 #include "Script.icc"
69 
70 #endif
Script::lastResult
DataObject lastResult()
Script::scriptLines_
std::vector< std::string > scriptLines_
Contains script.
Definition: Script.hh:65
Script::execute
virtual DataObject execute()
Definition: Script.cc:82
Script::script
virtual std::vector< std::string > script() const
Definition: Script.cc:106
Script::executeCalled_
bool executeCalled_
Flag indicating whether script has been executed or not.
Definition: Script.hh:63
Exception.hh
DataObject
Definition: DataObject.hh:50
Script::result_
DataObject result_
Result of execution.
Definition: Script.hh:61
Script.icc
ScriptInterpreter.hh
Script::interpreter_
ScriptInterpreter * interpreter_
Interpreter executing the commands.
Definition: Script.hh:58
DataObject.hh
Script
Definition: Script.hh:47
Script::Script
Script(ScriptInterpreter *interpreter, std::string scriptLine)
Definition: Script.cc:47
ScriptInterpreter
Definition: ScriptInterpreter.hh:55
Script::~Script
virtual ~Script()
Definition: Script.cc:71