ginga 1.0
The Ginga iTV middleware
Loading...
Searching...
No Matches
Switch.h
1/* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2
3This file is part of Ginga (Ginga-NCL).
4
5Ginga is free software: you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10Ginga is distributed in the hope that it will be useful, but WITHOUT
11ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Ginga. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef SWITCH_H
19#define SWITCH_H
20
21#include "Composition.h"
22#include "Event.h"
23
24namespace ginga {
25
26class Switch : public Composition
27{
28public:
29 explicit Switch (const string &);
30 ~Switch ();
31
32 // Object:
33 string getObjectTypeAsString () override;
34 string toString () override;
35 bool beforeTransition (Event *, Event::Transition) override;
36 bool afterTransition (Event *, Event::Transition) override;
37
38 // Switch:
39 const list<pair<Object *, Predicate *> > *getRules ();
40 void addRule (Object *, Predicate *);
41 const map<string, list<Event *> > *getSwitchPorts ();
42 void addSwitchPort (const string &, const list<Event *> &);
43
44private:
45 map<string, list<Event *> > _switchPorts;
46 list<pair<Object *, Predicate *> > _rules;
47 Object *_selected;
48};
49
50}
51
52#endif // SWITCH_H
Definition Composition.h:26
Event state machine.
Definition Event.h:32
Transition
Event state transitions.
Definition Event.h:79
Definition Object.h:30
Definition Predicate.h:26
Definition Switch.h:27
bool afterTransition(Event *, Event::Transition) override
Finishes event transition.
Definition Switch.cpp:166
map< string, list< Event * > > _switchPorts
List of switchPorts.
Definition Switch.h:45
bool beforeTransition(Event *, Event::Transition) override
Initiates event transition.
Definition Switch.cpp:68