ginga 1.0
The Ginga iTV middleware
Loading...
Searching...
No Matches
Predicate.h
1/* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2
3This file is part of Ginga (Ginga-NCL).
4
5Ginga is free software: you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10Ginga is distributed in the hope that it will be useful, but WITHOUT
11ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Ginga. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef PREDICATE_H
19#define PREDICATE_H
20
21#include "aux-ginga.h"
22
23namespace ginga {
24
26{
27public:
28 enum Type
29 {
30 FALSUM = 0, // false
31 VERUM, // true
32 ATOM,
33 NEGATION,
34 CONJUNCTION,
35 DISJUNCTION,
36 };
37
38 enum Test
39 {
40 EQ = 0, // ==
41 NE, // !=
42 LT, // <
43 LE, // <=
44 GT, // >
45 GE // >=
46 };
47
48 explicit Predicate (Predicate::Type);
49 ~Predicate ();
50 Predicate::Type getType ();
51 string toString ();
52 Predicate *clone ();
53
54 // Atomic only.
55 void getTest (string *, Predicate::Test *, string *);
56 void setTest (const string &, Predicate::Test, const string &);
57
58 // Non-atomic only.
59 const list<Predicate *> *getChildren ();
60 void addChild (Predicate *);
61
62 // Both.
63 Predicate *getParent ();
64 void initParent (Predicate *);
65
66private:
67 Predicate::Type _type;
68 struct
69 {
70 Predicate::Test test;
71 string left;
72 string right;
73 } _atom;
74 list<Predicate *> _children;
75 Predicate *_parent;
76};
77
78}
79
80#endif // PREDICATE_H
Definition Predicate.h:26