sipxmedialib  Version 3.3
MpMMTimer.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007-2009 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2007-2009 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // $$
10 
11 #ifndef _MpMMTimer_h_
12 #define _MpMMTimer_h_
13 
14 // SYSTEM INCLUDES
15 #include <os/OsStatus.h>
16 #include <os/OsTime.h>
17 #include <os/OsNotification.h>
18 #include <utl/UtlString.h>
19 
20 // APPLICATION INCLUDES
21 #include "mp/MpTypes.h"
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
31 
44 class MpMMTimer
45 {
46 /* //////////////////////////////// PUBLIC //////////////////////////////// */
47 public:
48  typedef enum
49  {
50  Linear = 0,
52  } MMTimerType;
53 
54 /* =============================== CREATORS =============================== */
56 
57 
59  static MpMMTimer *create(MMTimerType type, const UtlString &name = "");
67  virtual ~MpMMTimer();
69 
71 
72 /* ============================= MANIPULATORS ============================= */
74 
75 
76  virtual
77  OsStatus setNotification(OsNotification* notification);
92  virtual
93  OsStatus run(unsigned usecPeriodic) = 0;
115  virtual
116  OsStatus stop() = 0;
130  virtual
131  OsStatus waitForNextTick();
144 
145 /* ============================== ACCESSORS =============================== */
147 
148 
149  virtual
150  OsStatus getResolution(unsigned& resolution);
159  virtual
160  OsStatus getPeriodRange(unsigned* pMinUSecs, unsigned* pMaxUSecs = NULL);
170  inline MMTimerType getTimerType() const;
172 
174 
175 /* =============================== INQUIRY ================================ */
177 
178 
179 
181 
182 /* ////////////////////////////// PROTECTED /////////////////////////////// */
183 protected:
185 
187  inline MpMMTimer(MMTimerType type);
188 
189 /* /////////////////////////////// PRIVATE //////////////////////////////// */
190 private:
191 
192 };
193 
194 /* ============================ INLINE METHODS ============================ */
195 
197 : mTimerType(type)
198 {
199 }
200 
202 {
203  return mTimerType;
204 }
205 
206 #endif //_MpMMTimer_h_
High-precision periodic timer (MultiMedia timer) base class.
Definition: MpMMTimer.h:44
MMTimerType
Definition: MpMMTimer.h:48
virtual ~MpMMTimer()
Destructor.
Definition: MpMMTimer.cpp:64
MpMMTimer(MMTimerType type)
protected constructor, as this is an abstract class.
Definition: MpMMTimer.h:196
static MpMMTimer * create(MMTimerType type, const UtlString &name="")
Factory method to create timer class instance of the given type.
Definition: MpMMTimer.cpp:43
virtual OsStatus getResolution(unsigned &resolution)
Get resolution of timer in microseconds.
Definition: MpMMTimer.cpp:84
MMTimerType mTimerType
Definition: MpMMTimer.h:184
For use with setNotification()
Definition: MpMMTimer.h:51
virtual OsStatus setNotification(OsNotification *notification)
Set notification for the OsNotification timer type.
Definition: MpMMTimer.cpp:70
virtual OsStatus stop()=0
Stop periodical firing.
virtual OsStatus getPeriodRange(unsigned *pMinUSecs, unsigned *pMaxUSecs=NULL)
Get the range of timer periods that can be generated.
Definition: MpMMTimer.cpp:89
MMTimerType getTimerType() const
Get the type of timer fire.
Definition: MpMMTimer.h:201
For use with waitForNextTick()
Definition: MpMMTimer.h:50
virtual OsStatus waitForNextTick()
Definition: MpMMTimer.cpp:75
virtual OsStatus run(unsigned usecPeriodic)=0
Start periodical firing.