OpenASIP  2.0
SimpleScriptInterpreter.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 SimpleScriptInterpreter.hh
26  *
27  * Declaration of SimpleScriptInterpreter.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_SIMPLE_SCRIPT_INTERPRETER_HH
34 #define TTA_SIMPLE_SCRIPT_INTERPRETER_HH
35 
36 #include <map>
37 #include <string>
38 
39 #include "ScriptInterpreter.hh"
40 
41 class InterpreterContext;
42 class LineReader;
43 
44 /**
45  * Interpreter which uses only custom commands.
46  *
47  * Custom commands are user defined commands.
48  */
50 public:
52  virtual ~SimpleScriptInterpreter();
53 
54  virtual void initialize(
55  int argc,
56  char* argv[],
58  LineReader* reader);
59 
60  virtual void setVariableToInterpreter(
61  const std::string& name, const DataObject& value);
62 
63  virtual DataObject variable(const std::string& name);
64  virtual bool interpret(const std::string& commandLine);
65  virtual void setResultToInterpreter(const DataObject& value);
66 
67  virtual InterpreterContext& context() const;
68 
69 protected:
70  virtual void addCustomCommandToInterpreter(const CustomCommand& command);
72  const CustomCommand& command);
73 private:
74  /// Map for variables.
75  typedef std::map<std::string, std::string> VariableMap;
76 
77  /// Copying not allowed.
79  /// Assignment not allowed.
81 
82  /// Holds all the variables given to interpreter.
84  /// Context for interpreter.
86 };
87 
88 #endif
SimpleScriptInterpreter::variable
virtual DataObject variable(const std::string &name)
Definition: SimpleScriptInterpreter.cc:102
SimpleScriptInterpreter::variables_
VariableMap variables_
Holds all the variables given to interpreter.
Definition: SimpleScriptInterpreter.hh:83
SimpleScriptInterpreter::context_
InterpreterContext * context_
Context for interpreter.
Definition: SimpleScriptInterpreter.hh:85
DataObject
Definition: DataObject.hh:50
SimpleScriptInterpreter::~SimpleScriptInterpreter
virtual ~SimpleScriptInterpreter()
Definition: SimpleScriptInterpreter.cc:54
SimpleScriptInterpreter::context
virtual InterpreterContext & context() const
Definition: SimpleScriptInterpreter.cc:185
SimpleScriptInterpreter::initialize
virtual void initialize(int argc, char *argv[], InterpreterContext *context, LineReader *reader)
Definition: SimpleScriptInterpreter.cc:64
SimpleScriptInterpreter::addCustomCommandToInterpreter
virtual void addCustomCommandToInterpreter(const CustomCommand &command)
Definition: SimpleScriptInterpreter.cc:193
SimpleScriptInterpreter::VariableMap
std::map< std::string, std::string > VariableMap
Map for variables.
Definition: SimpleScriptInterpreter.hh:75
ScriptInterpreter.hh
CustomCommand
Definition: CustomCommand.hh:54
InterpreterContext
Definition: InterpreterContext.hh:40
SimpleScriptInterpreter
Definition: SimpleScriptInterpreter.hh:49
SimpleScriptInterpreter::removeCustomCommandFromInterpreter
virtual void removeCustomCommandFromInterpreter(const CustomCommand &command)
Definition: SimpleScriptInterpreter.cc:200
SimpleScriptInterpreter::setVariableToInterpreter
virtual void setVariableToInterpreter(const std::string &name, const DataObject &value)
Definition: SimpleScriptInterpreter.cc:82
LineReader
Definition: LineReader.hh:52
SimpleScriptInterpreter::SimpleScriptInterpreter
SimpleScriptInterpreter()
Definition: SimpleScriptInterpreter.cc:48
SimpleScriptInterpreter::interpret
virtual bool interpret(const std::string &commandLine)
Definition: SimpleScriptInterpreter.cc:118
SimpleScriptInterpreter::setResultToInterpreter
virtual void setResultToInterpreter(const DataObject &value)
Definition: SimpleScriptInterpreter.cc:177
ScriptInterpreter
Definition: ScriptInterpreter.hh:55
SimpleScriptInterpreter::operator=
SimpleScriptInterpreter & operator=(const ScriptInterpreter &)
Assignment not allowed.