clingo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
python.hh
Go to the documentation of this file.
1 // {{{ GPL License
2 
3 // This file is part of gringo - a grounder for logic programs.
4 // Copyright (C) 2013 Roland Kaminski
5 
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 // }}}
20 
21 #ifndef _GRINGO_PYTHON_HH
22 #define _GRINGO_PYTHON_HH
23 
24 #include <ostream>
25 #include <gringo/locatable.hh>
26 
27 namespace Gringo {
28 
29 struct Control;
30 struct PythonImpl;
31 struct Python {
32  using NewControlFunc = Control* (*)(int, char const **);
33  using FreeControlFunc = void (*)(Control *);
34 
35  Python();
36  bool exec(Location const &loc, FWString code);
37  ValVec call(Location const &loc, FWString name, ValVec const &args);
38  bool callable(FWString name);
39  void main(Control &ctl);
40  static void initlib(NewControlFunc newControl, FreeControlFunc freeControl);
41  ~Python();
42 
43  static std::unique_ptr<PythonImpl> impl;
44 };
45 
46 } // namespace Gringo
47 
48 #endif // _GRINGO_PYTHON_HH
49 
50 
Control *(*)(int, char const **) NewControlFunc
Definition: python.hh:32
bool exec(Location const &loc, FWString code)
Definition: python.cc:2052
Definition: locatable.hh:30
Definition: python.hh:31
bool callable(FWString name)
Definition: python.cc:2058
void(*)(Control *) FreeControlFunc
Definition: python.hh:33
static std::unique_ptr< PythonImpl > impl
Definition: python.hh:43
void main(Control &ctl)
Definition: python.cc:2064
static void initlib(NewControlFunc newControl, FreeControlFunc freeControl)
Definition: python.cc:2066
ValVec call(Location const &loc, FWString name, ValVec const &args)
Definition: python.cc:2061
Definition: control.hh:91
std::vector< Value > ValVec
Definition: value.hh:41