SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JuceConnectionTimer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Martin Hansen
3  *
4  * This file is part of SPAOP (Spatial Audio Object Positioner).
5  *
6  * SPAOP is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * SPAOP is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with SPAOP. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef JUCECONNECTIONTIMER_H_INCLUDED
21 #define JUCECONNECTIONTIMER_H_INCLUDED
22 
23 #include "ConnectionTimer.h"
24 #include "JuceHeader.h"
25 
32 namespace wonderjuce {
33 
37 class JuceConnectionTimer : public Timer,
39 {
40 public:
48 
53  JuceConnectionTimer(int intervalMs);
54 
57 
58  void setListener(Listener* listener);
59 
60  void start();
61 
62  void stop();
63 
64 private:
65  class Factory : public wonder::ConnectionTimer::Factory
66  {
67  ConnectionTimer* createConnectionTimer(int intervalMs);
68  };
69 
70  void timerCallback();
71 
72  Listener* listener_;
73  const int interval_;
74 };
75 
76 }
77 
78 #endif // JUCECONNECTIONTIMER_H_INCLUDED
void setListener(Listener *listener)
Sets the listener whose timeout() method must be called when the timer runs out.
Definition: JuceConnectionTimer.cpp:39
~JuceConnectionTimer()
Destructor.
Definition: JuceConnectionTimer.cpp:35
An implementation of wonder::ConnectionTimer using the Timer class of JUCE.
Definition: JuceConnectionTimer.h:37
An interface for a factory class that creates ConnectionTimers.
Definition: ConnectionTimer.h:72
A listener that must be notified by the timer on timeout.
Definition: ConnectionTimer.h:37
void stop()
Stops the timer.
Definition: JuceConnectionTimer.cpp:49
void start()
Starts the timer.
Definition: JuceConnectionTimer.cpp:44
JuceConnectionTimer(int intervalMs)
Constructor.
Definition: JuceConnectionTimer.cpp:30
static wonder::ConnectionTimer::Factory * getFactory()
A singleton-getter returning a wonder::ConnectionTimer::Factory that creates instances of JuceConnect...
Definition: JuceConnectionTimer.cpp:24
An interface defining a cyclic timer (to be used as a watchdog for connection timeouts) along with li...
Definition: ConnectionTimer.h:29