Ginga  0.13.6.1771-df200
The iTV middleware.
Event.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 EVENT_H
19 #define EVENT_H
20 
21 #include "aux-ginga.h"
22 #include "Predicate.h"
23 
25 
26 class Object;
27 class Event
28 {
29 public:
30  enum Type
31  {
32  SELECTION = 0,
35  };
36 
37  enum State
38  {
39  SLEEPING = 0,
42  };
43 
45  {
46  START = 0,
51  };
52 
53  Event (Event::Type, Object *, const string &id);
54  ~Event ();
55 
57  Object *getObject ();
58  string getId ();
59  string getFullId ();
61  string toString ();
62 
63  bool isLambda ();
64  void getInterval (Time *, Time *);
65  void setInterval (Time, Time);
66 
67  bool getParameter (const string &, string *);
68  bool setParameter (const string &, const string &);
69 
71  void reset ();
72 
73 public:
74  static string getEventTypeAsString (Event::Type);
75  static string getEventStateAsString (Event::State);
77 
78 private:
79  Event::Type _type; // event type
80  Object *_object; // target object
81  string _id; // event id
82  Event::State _state; // event state
83  Time _begin; // begin-time
84  Time _end; // end-time
85  map<string, string> _parameters; // parameters
86 };
87 
88 typedef struct
89 {
90  Event *event; // Target event
91  Event::Transition transition; // Target transition
92  Predicate *predicate; // if appears in condition
93  string value; // if attribution event
94 } Action;
95 
97 
98 #endif // EVENT_H
static string getEventTypeAsString(Event::Type)
Definition: Event.cpp:206
~Event()
Definition: Event.cpp:38
Definition: Object.h:29
Definition: Event.h:34
string getId()
Definition: Event.cpp:55
void setInterval(Time, Time)
Definition: Event.cpp:140
Time _end
Definition: Event.h:84
Time _begin
Definition: Event.h:83
Definition: Event.h:41
Event(Event::Type, Object *, const string &id)
Definition: Event.cpp:27
State
Definition: Event.h:37
static string getEventTransitionAsString(Event::Transition)
Definition: Event.cpp:238
#define GINGA_NAMESPACE_END
Definition: aux-ginga.h:62
Definition: Event.h:32
string toString()
Definition: Event.cpp:90
bool getParameter(const string &, string *)
Definition: Event.cpp:147
Definition: Event.h:40
bool setParameter(const string &, const string &)
Definition: Event.cpp:153
Event * event
Definition: Event.h:90
Object * getObject()
Definition: Event.cpp:49
#define GINGA_NAMESPACE_BEGIN
Definition: aux-ginga.h:61
Event::Transition transition
Definition: Event.h:91
Definition: Event.h:47
Definition: Event.h:88
Transition
Definition: Event.h:44
Definition: Event.h:50
Definition: Event.h:33
string _id
Definition: Event.h:81
Predicate * predicate
Definition: Event.h:92
Definition: Event.h:48
Event::State getState()
Definition: Event.cpp:84
Definition: Event.h:27
string value
Definition: Event.h:93
string getFullId()
Definition: Event.cpp:61
Definition: Predicate.h:25
static string getEventStateAsString(Event::State)
Definition: Event.cpp:222
Event::State _state
Definition: Event.h:82
Event::Type _type
Definition: Event.h:79
Type
Definition: Event.h:30
Definition: Event.h:39
Object * _object
Definition: Event.h:80
Event::Type getType()
Definition: Event.cpp:43
bool transition(Event::Transition)
Definition: Event.cpp:159
void getInterval(Time *, Time *)
Definition: Event.cpp:133
bool isLambda()
Definition: Event.cpp:127
void reset()
Definition: Event.cpp:197
Definition: Event.h:49
Definition: Event.h:46
GstClockTime Time
Definition: aux-ginga.h:115
map< string, string > _parameters
Definition: Event.h:85