Ginga  0.13.6.2086-83aa
The iTV middleware.
Object.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 OBJECT_H
19 #define OBJECT_H
20 
21 #include "Event.h"
22 
23 GINGA_NAMESPACE_BEGIN
24 
25 class Document;
26 class Composition;
27 class MediaSettings;
28 
29 class Object
30 {
31 public:
32  Object (const string &);
33  virtual ~Object ();
34 
35  string getId ();
36 
37  Document *getDocument ();
38  void initDocument (Document *);
39 
40  Composition *getParent ();
41  void initParent (Composition *);
42 
43  virtual string getObjectTypeAsString () = 0;
44  virtual string toString ();
45 
46  const list<string> *getAliases ();
47  bool hasAlias (const string &);
48  void addAlias (const string &);
49 
50  const set<Event *> *getEvents ();
51  Event *getEvent (Event::Type, const string &);
52  Event *getAttributionEvent (const string &);
53  void addAttributionEvent (const string &);
54  Event *getPresentationEvent (const string &);
55  Event *getPresentationEventByLabel (const string &);
56  void addPresentationEvent (const string &, Time, Time);
57  void addPresentationEvent (const string &, const string &);
58  Event *getSelectionEvent (const string &);
59  void addSelectionEvent (const string &);
60 
61  Event *getLambda ();
62  bool isOccurring ();
63  bool isPaused ();
64  bool isSleeping ();
65 
66  virtual string getProperty (const string &);
67  virtual void setProperty (const string &, const string &, Time dur = 0);
68 
69  const list<pair<Action, Time> > *getDelayedActions ();
70  void addDelayedAction (Event *, Event::Transition,
71  const string &value = "", Time delay = 0);
72 
73  virtual void sendKey (const string &, bool);
74  virtual void sendTick (Time, Time, Time);
75 
89  virtual bool beforeTransition (Event *, Event::Transition) = 0;
90 
104  virtual bool afterTransition (Event *, Event::Transition) = 0;
105 
106 protected:
107  string _id; // id
108  Document *_doc; // parent document
109  Composition *_parent; // parent object
110  list<string> _aliases; // aliases
111  Time _time; // playback time
112  map<string, string> _properties; // property map
113  Event *_lambda; // lambda event
114  set<Event *> _events; // all events
115  list<pair<Action, Time> > _delayed; // delayed actions
116 
117  virtual void doStart ();
118  virtual void doStop ();
119 };
120 
121 GINGA_NAMESPACE_END
122 
123 #endif // OBJECT_H
Definition: Object.h:29
Definition: Composition.h:25
Definition: MediaSettings.h:25
virtual bool afterTransition(Event *, Event::Transition)=0
Finishes event transition.
Transition
Event state transitions.
Definition: Event.h:72
NCL document.
Definition: Document.h:34
Event state machine.
Definition: Event.h:31
Type
Event type.
Definition: Event.h:36
virtual bool beforeTransition(Event *, Event::Transition)=0
Initiates event transition.