clingo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
program.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_INPUT_PROGRAM_HH
22 #define _GRINGO_INPUT_PROGRAM_HH
23 
24 #include <gringo/input/literal.hh>
26 #include <gringo/ground/program.hh>
27 #include <gringo/unique_list.hh>
28 
29 namespace Gringo { namespace Input {
30 
31 // {{{ declaration of Program
32 
34 
35 struct Block {
37 
38  Term const &sig() const;
39  operator Term const &() const;
40 
48 };
50 
51 class Program {
52 public:
54 
55  Program();
56  Program(Program &&x);
57  void begin(Location const &loc, FWString name, IdVec &&params);
58  void add(UStm &&stm);
60  void rewrite(Defines &defs);
61  bool check();
62  void print(std::ostream &out) const;
64  ~Program();
65 
66 private:
67  void rewriteDots();
68  void rewriteArithmetics();
69  void unpool();
70 
71  unsigned auxNames_ = 0;
72  Ground::LocSet locs_;
73  Ground::SigSet sigs_;
74  BlockMap blocks_;
75  Block *current_;
76  Projections project_;
77  UStmVec stms_;
79 };
80 
81 std::ostream &operator<<(std::ostream &out, Program const &p);
82 
83 // }}}
84 
85 } } // namespace Input Gringo
86 
87 #endif //_GRINGO_INPUT_PROGRAM_HH
Definition: locatable.hh:30
IdVec params
Definition: program.hh:43
Definition: literal.hh:52
Definition: program.hh:51
void add(UStm &&stm)
Definition: program.cc:64
bool check()
Definition: program.cc:156
Definition: term.hh:109
UStmVec stms
Definition: program.hh:47
void begin(Location const &loc, FWString name, IdVec &&params)
Definition: program.cc:60
Block(Location const &loc, FWString name, IdVec &&params)
Definition: program.cc:35
Term const & sig() const
Definition: program.cc:46
Ground::IdVec IdVec
Definition: program.hh:33
void rewrite(Defines &defs)
Definition: program.cc:72
FWString name
Definition: program.hh:42
UStmVec addedStms
Definition: program.hh:46
std::shared_ptr< std::pair< UTerm, ValVec >> SEdb
Definition: program.hh:31
Ground::Program toGround(PredDomMap &domains)
Definition: program.cc:178
std::vector< UStm > UStmVec
Definition: statement.hh:67
Definition: program.hh:48
void addClassicalNegation(FWSignature x)
Definition: program.cc:164
Definition: program.hh:35
ValVec addedEdb
Definition: program.hh:44
Definition: value.hh:86
Ground::SEdb edb
Definition: program.hh:45
tuple p
Definition: server.py:49
Definition: term.hh:53
std::ostream & operator<<(std::ostream &out, CSPElem const &x)
Definition: aggregates.hh:159
std::vector< std::pair< Location, FWString >> IdVec
Definition: program.hh:30
void print(std::ostream &out) const
Definition: program.cc:168
int x
Definition: utility.cc:65
Definition: unique_list.hh:157
Location loc
Definition: program.hh:41
std::set< Location > LocSet
Definition: dependency.hh:62
std::vector< Value > ValVec
Definition: value.hh:41
DefinedBy defs
Definition: dependency.cc:118
Program()
Definition: program.cc:54
~Program()
Definition: program.cc:213
std::unique_ptr< Statement > UStm
Definition: programbuilder.hh:180
LparseOutputter & out
Definition: output.cc:685