OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GenericEval.h
Go to the documentation of this file.
1 /*
2  * GenericEval.h
3  *
4  * Template for a generic shell-oriented evaluator
5  * Copyright (c) 2008, 2013, 2014 Linas Vepstas <linas@linas.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License v3 as
9  * published by the Free Software Foundation and including the exceptions
10  * at http://opencog.org/wiki/Licenses
11  *
12  * This program 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 General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program; if not, write to:
19  * Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #ifndef _OPENCOG_GENERIC_EVAL_H
24 #define _OPENCOG_GENERIC_EVAL_H
25 
26 #include <string>
27 
34 namespace opencog {
40 {
41  protected:
42  std::string _input_line;
45 
46  public:
47  GenericEval(void) :
48  _input_line(""),
49  _pending_input(false),
50  _caught_error(false) {}
51  virtual ~GenericEval() {}
52 
57  virtual bool input_pending()
58  {
59  return _pending_input;
60  }
61 
65  virtual void clear_pending()
66  {
67  _input_line = "";
68  _pending_input = false;
69  _caught_error = false;
70  }
71 
75  virtual bool eval_error(void)
76  {
77  return _caught_error;
78  }
79 
88  virtual void begin_eval() = 0;
89  virtual void eval_expr(const std::string&) = 0;
90  virtual std::string poll_result() = 0;
91 };
92 
94 }
95 
96 #endif // _OPENCOG_GENERIC_EVAL_H
virtual void clear_pending()
Definition: GenericEval.h:65
virtual ~GenericEval()
Definition: GenericEval.h:51
virtual std::string poll_result()=0
virtual bool eval_error(void)
Definition: GenericEval.h:75
virtual void begin_eval()=0
virtual void eval_expr(const std::string &)=0
std::string _input_line
Definition: GenericEval.h:42
virtual bool input_pending()
Definition: GenericEval.h:57