VirtualMachine.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3 
4  This file is part of the TerraLib - a Framework for building GIS enabled
5  applications.
6 
7  TerraLib is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License,
10  or (at your option) any later version.
11 
12  TerraLib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with TerraLib. See COPYING. If not, write to
19  TerraLib Team at <terralib-team@terralib.org>.
20  */
21 
22 /*!
23  \file terralib/vm/core/VirtualMachine.h
24 
25  \brief An abstract class that defines a Virtual Machine for executing code in
26  any TerraLib supported language.
27 
28  \author Frederico Augusto BedĂȘ
29  \author Gilberto Ribeiro de Queiroz
30 */
31 
32 #ifndef __TERRALIB_VM_CORE_VIRTUALMACHINE_H__
33 #define __TERRALIB_VM_CORE_VIRTUALMACHINE_H__
34 
35 // TerraLib
36 #include "Config.h"
37 
38 // STL
39 #include <string>
40 
41 // QT
42 #include <QObject>
43 
44 // Boost
45 #include <boost/noncopyable.hpp>
46 
47 namespace te
48 {
49  namespace vm
50  {
51  namespace core
52  {
53  class TEVMEXPORT VirtualMachine : public QObject,
54  public boost::noncopyable
55  {
56  Q_OBJECT
57  public:
58  /*!
59  \brief VirtualMachine
60  */
62  {
63  }
64 
65  /*!
66  \brief Virtual destructor.
67  */
68  virtual ~VirtualMachine()
69  {
70  }
71 
72  /*!
73  \Return the name of the Virtual Machine: it is also an identifier
74  about the VM type.
75  */
76  virtual std::string getName() const = 0;
77 
78  /*!
79  \brief Return the title of Virtual Machine: a name that can be used
80  by applications to show in a GUI.
81  */
82  virtual std::string getTitle() const = 0;
83 
84  /*!
85  \brief Returns a brief description about the underlying Virtual
86  Machine.
87  */
88  virtual std::string getDescription() const = 0;
89 
90  /*!
91  \brief setFileName Sets the file that will be used in the Virtual
92  Machine.
93  \param file The full path filename.
94  */
95  virtual void setFileName(QString file) = 0;
96 
97  /*!
98  \brief readline Method to be used by the language of the Virtual
99  Machine when doing a input operation.
100  \return A string containing the user input.
101  */
102  virtual std::string readline() = 0;
103 
104  public slots:
105  /*!
106  \brief write Writes the output coming from the Virtual Machine
107  \param str The out put string received.
108  */
109  virtual void write(const QString& str) = 0;
110  /*!
111  \brief stop Stops the current running script.
112  */
113  virtual void stop() = 0;
114  /*!
115  \brief execute Executes the script file previously set.
116  */
117  virtual void execute() = 0;
118 
119  /*!
120  \brief readline Reads a user input.
121  \param msg String of the input.
122  */
123  virtual void readline(QString msg) = 0;
124  signals:
125  /*!
126  \brief Signal emmited when the Virtual Machine needs to execute a
127  input operation.
128  */
129  void requestReadline();
130  /*!
131  \brief output Signal emmited when the Virtual Machine receives a
132  string.
133  \param msg String received from the Virtual Machine.
134  */
135  void output(QString msg);
136  };
137  } // end namespace core
138  } // end namespace vm
139 } // end namespace te
140 #endif // __TERRALIB_VM_CORE_VIRTUALMACHINE_H__
#define slots
VirtualMachine()
VirtualMachine.
URI C++ Library.
virtual ~VirtualMachine()
Virtual destructor.
#define TEVMEXPORT
Definition: Config.h:40
Configuration flags for TerraLib VM Library.