clingo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
literal.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_OUTPUT_LITERAL_HH
22 #define _GRINGO_OUTPUT_LITERAL_HH
23 
24 #include <gringo/clonable.hh>
25 #include <gringo/comparable.hh>
26 #include <gringo/hashable.hh>
27 #include <gringo/value.hh>
28 
29 namespace Gringo { namespace Output {
30 
31 struct LparseOutputter;
32 struct LparseTranslator;
33 struct Statement;
34 using UStm = std::unique_ptr<Statement>;
35 using UStmVec = std::vector<UStm>;
36 using CSPBound = std::pair<int, int>;
37 
38 // {{{ declaration of Literal
39 
40 struct Literal;
41 using ULit = std::unique_ptr<Literal>;
42 struct Literal : Clonable<Literal>, Hashable, Comparable<Literal> {
43  virtual ULit toLparse(LparseTranslator &x) = 0;
44  virtual void makeEqual(ULit &&lit, LparseTranslator &x) const = 0;
45  virtual void printPlain(std::ostream &out) const = 0;
46  virtual bool isIncomplete() const = 0;
47  virtual int lparseUid(LparseOutputter &out) const = 0;
48  virtual bool isBound(Value &value, bool negate) const { (void)value; (void)negate; return false; }
49  virtual void updateBound(CSPBound &bounds, bool negate) const { (void)bounds; (void)negate; }
50  virtual bool invertible() const { return false; }
51  virtual void invert() { assert(false); }
52  virtual ~Literal() { }
53 };
54 using LitVec = std::vector<std::reference_wrapper<Literal>>;
55 using ULitVec = std::vector<ULit>;
56 
57 // }}}
58 
59 } } // namespace Output Gringo
60 
62 
63 #endif // _GRINGO_OUTPUT_LITERAL_HH
64 
Definition: comparable.hh:29
virtual void makeEqual(ULit &&lit, LparseTranslator &x) const =0
virtual void updateBound(CSPBound &bounds, bool negate) const
Definition: literal.hh:49
virtual ULit toLparse(LparseTranslator &x)=0
Definition: value.hh:113
Definition: statement.hh:47
Definition: lparseoutputter.hh:38
Definition: literal.hh:42
virtual bool isBound(Value &value, bool negate) const
Definition: literal.hh:48
Definition: hashable.hh:36
std::vector< ULit > ULitVec
Definition: literal.hh:55
Literal & lit
Definition: statements.cc:1284
std::pair< int, int > CSPBound
Definition: literal.hh:36
std::vector< UStm > UStmVec
Definition: literal.hh:35
std::unique_ptr< Statement > UStm
Definition: literal.hh:34
std::unique_ptr< Literal > ULit
Definition: literal.hh:41
virtual void invert()
Definition: literal.hh:51
virtual bool isIncomplete() const =0
virtual ~Literal()
Definition: literal.hh:52
virtual void printPlain(std::ostream &out) const =0
Definition: clonable.hh:29
int x
Definition: utility.cc:65
virtual bool invertible() const
Definition: literal.hh:50
#define GRINGO_HASH(T)
Definition: hashable.hh:29
std::vector< std::reference_wrapper< Literal >> LitVec
Definition: literal.hh:54
virtual int lparseUid(LparseOutputter &out) const =0
LparseOutputter & out
Definition: output.cc:685