Ginga  0.13.6.2086-83aa
The iTV middleware.
Predicate.h
1 /* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2 
3 This file is part of Ginga (Ginga-NCL).
4 
5 Ginga is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 
10 Ginga is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along 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 
23 GINGA_NAMESPACE_BEGIN
24 
25 class Predicate
26 {
27 public:
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  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 
66 private:
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 GINGA_NAMESPACE_END
79 
80 #endif // PREDICATE_H
Definition: Predicate.h:25