SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConnectionTimer.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 CONNECTIONTIMER_H_INCLUDED
21 #define CONNECTIONTIMER_H_INCLUDED
22 
23 namespace wonder {
24 
30 {
31 public:
32 
34  virtual ~ConnectionTimer(){}
35 
37  class Listener
38  {
39  public:
41  virtual ~Listener(){}
42 
44  virtual void onTimeout() = 0;
45  };
46 
53  virtual void setListener(Listener* listener) = 0;
54 
62  virtual void start() = 0;
63 
65  virtual void stop() = 0;
66 
72  class Factory
73  {
74  public:
75 
77  virtual ~Factory(){}
78 
85  virtual ConnectionTimer* createConnectionTimer(int intervalMs) = 0;
86  };
87 };
88 
89 }
90 
91 #endif // CONNECTIONTIMER_H_INCLUDED
virtual ~Listener()
Destructor.
Definition: ConnectionTimer.h:41
virtual ~ConnectionTimer()
Destructor.
Definition: ConnectionTimer.h:34
virtual void start()=0
Starts the timer.
An interface for a factory class that creates ConnectionTimers.
Definition: ConnectionTimer.h:72
virtual void onTimeout()=0
Must be called by the timer on timeout.
virtual void setListener(Listener *listener)=0
Sets the listener whose timeout() method must be called when the timer runs out.
A listener that must be notified by the timer on timeout.
Definition: ConnectionTimer.h:37
virtual ConnectionTimer * createConnectionTimer(int intervalMs)=0
Creates a new ConnectionTimer.
virtual void stop()=0
Stops the timer.
virtual ~Factory()
Destructor.
Definition: ConnectionTimer.h:77
An interface defining a cyclic timer (to be used as a watchdog for connection timeouts) along with li...
Definition: ConnectionTimer.h:29