Ginga  0.13.6.1771-df200
The iTV middleware.
Predicate.h
Go to the documentation of this file.
1 /* Copyright (C) 2006-2017 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 <http://www.gnu.org/licenses/>. */
17 
18 #ifndef PREDICATE_H
19 #define PREDICATE_H
20 
21 #include "aux-ginga.h"
22 
24 
25 class Predicate
26 {
27  public:
28  enum Type
29  {
30  FALSUM = 0, // false
31  VERUM, // true
36  };
37 
38  enum Test
39  {
40  EQ = 0, // ==
41  NE, // !=
42  LT, // <
43  LE, // <=
44  GT, // >
45  GE // >=
46  };
47 
49  ~Predicate ();
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:
68  struct
69  {
71  string left;
72  string right;
73  } _atom;
74  list<Predicate *> _children;
76 };
77 
79 
80 #endif // PREDICATE_H
Predicate(Predicate::Type)
Definition: Predicate.cpp:23
string right
Definition: Predicate.h:72
string left
Definition: Predicate.h:71
const list< Predicate * > * getChildren()
Definition: Predicate.cpp:150
void initParent(Predicate *)
Definition: Predicate.cpp:176
Predicate * _parent
Definition: Predicate.h:75
Definition: Predicate.h:44
Definition: Predicate.h:35
Predicate::Type getType()
Definition: Predicate.cpp:39
void setTest(const string &, Predicate::Test, const string &)
Definition: Predicate.cpp:130
Predicate * getParent()
Definition: Predicate.cpp:184
Predicate::Type _type
Definition: Predicate.h:67
#define GINGA_NAMESPACE_END
Definition: aux-ginga.h:62
Definition: Predicate.h:43
Definition: Predicate.h:40
Definition: Predicate.h:41
Definition: Predicate.h:34
void addChild(Predicate *)
Definition: Predicate.cpp:156
list< Predicate * > _children
Definition: Predicate.h:74
Definition: Predicate.h:32
Definition: Predicate.h:45
#define GINGA_NAMESPACE_BEGIN
Definition: aux-ginga.h:61
struct Predicate::@5 _atom
Type
Definition: Predicate.h:28
Predicate * clone()
Definition: Predicate.cpp:114
Definition: Predicate.h:31
string toString()
Definition: Predicate.cpp:45
Definition: Predicate.h:25
Predicate::Test test
Definition: Predicate.h:70
Definition: Predicate.h:33
Test
Definition: Predicate.h:38
void getTest(string *, Predicate::Test *, string *)
Definition: Predicate.cpp:140
Definition: Predicate.h:30
Definition: Predicate.h:42
~Predicate()
Definition: Predicate.cpp:32