Ginga  0.13.6.2086-83aa
The iTV middleware.
Event.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 EVENT_H
19 #define EVENT_H
20 
21 #include "aux-ginga.h"
22 #include "Predicate.h"
23 
24 GINGA_NAMESPACE_BEGIN
25 
26 class Object;
27 
31 class Event
32 {
33 public:
34 
36  enum Type
37  {
45 
53 
61  };
62 
64  enum State
65  {
66  OCCURRING = 0,
69  };
70 
73  {
74  ABORT = 0,
78  STOP,
79  };
80 
81  Event (Event::Type, Object *, const string &id);
82  ~Event ();
83 
84  Event::Type getType ();
85  Object *getObject ();
86  string getId ();
87  string getFullId ();
88  Event::State getState ();
89  string toString ();
90 
91  bool isLambda ();
92  void getInterval (Time *, Time *);
93  void setInterval (Time, Time);
94 
95  bool hasLabel ();
96  std::string getLabel ();
97  void setLabel (const std::string &);
98 
99  bool getParameter (const string &, string *);
100  bool setParameter (const string &, const string &);
101 
103  void reset ();
104 
105 public:
106  static string getEventTypeAsString (Event::Type);
107  static string getEventStateAsString (Event::State);
108  static string getEventTransitionAsString (Event::Transition);
109 
110 private:
113  string _id;
115  Time _begin;
116  Time _end;
117  std::string _label;
118  map<string, string> _parameters;
119 };
120 
124 typedef struct
125 {
129  string value;
130  string duration;
131 } Action;
132 
133 GINGA_NAMESPACE_END
134 
135 #endif // EVENT_H
Definition: Object.h:29
Attribution event.
Definition: Event.h:44
std::string _label
Label.
Definition: Event.h:117
Time _end
End time.
Definition: Event.h:116
Time _begin
Begin time.
Definition: Event.h:115
Paused.
Definition: Event.h:67
State
Event state.
Definition: Event.h:64
Selection event.
Definition: Event.h:60
Occurring.
Definition: Event.h:66
Event * event
Target event.
Definition: Event.h:126
Event::Transition transition
Desired transition.
Definition: Event.h:127
Pause.
Definition: Event.h:75
Action.
Definition: Event.h:124
Transition
Event state transitions.
Definition: Event.h:72
Abort.
Definition: Event.h:74
Presentation event.
Definition: Event.h:52
string _id
Event id.
Definition: Event.h:113
Predicate * predicate
Predicate conditioning the execution.
Definition: Event.h:128
Resume.
Definition: Event.h:76
Event state machine.
Definition: Event.h:31
string value
Value to set (if attribution).
Definition: Event.h:129
string duration
Duration.
Definition: Event.h:130
Definition: Predicate.h:25
Event::State _state
Event state.
Definition: Event.h:114
Event::Type _type
Event type.
Definition: Event.h:111
Type
Event type.
Definition: Event.h:36
Sleeping.
Definition: Event.h:68
Object * _object
Target object.
Definition: Event.h:112
bool transition(Event::Transition)
Transitions event.
Definition: Event.cpp:183
Stop.
Definition: Event.h:78
Start.
Definition: Event.h:77
map< string, string > _parameters
Parameters.
Definition: Event.h:118