RTP Audio System  2.0.0
timedthread.h
Go to the documentation of this file.
00001 /*
00002  *  $Id: timedthread.h 1285 2011-12-18 13:25:14Z dreibh $
00003  *
00004  * SocketAPI implementation for the sctplib.
00005  * Copyright (C) 2005-2012 by Thomas Dreibholz
00006  *
00007  * Realized in co-operation between
00008  * - Siemens AG
00009  * - University of Essen, Institute of Computer Networking Technology
00010  * - University of Applied Sciences, Muenster
00011  *
00012  * Acknowledgement
00013  * This work was partially funded by the Bundesministerium fuer Bildung und
00014  * Forschung (BMBF) of the Federal Republic of Germany (Foerderkennzeichen 01AK045).
00015  * The authors alone are responsible for the contents.
00016  *
00017  * This program is free software: you can redistribute it and/or modify
00018  * it under the terms of the GNU General Public License as published by
00019  * the Free Software Foundation, either version 3 of the License, or
00020  * (at your option) any later version.
00021 
00022  * This program is distributed in the hope that it will be useful,
00023  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025  * GNU General Public License for more details.
00026  *
00027  * You should have received a copy of the GNU General Public License
00028  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00029  *
00030  * Contact: discussion@sctp.de
00031  *          dreibh@iem.uni-due.de
00032  *          tuexen@fh-muenster.de
00033  *
00034  * Purpose: Timed Thread Implementation
00035  *
00036  */
00037 
00038 
00039 #ifndef TIMEDTHREAD_H
00040 #define TIMEDTHREAD_H
00041 
00042 
00043 #include "tdsystem.h"
00044 #include "multitimerthread.h"
00045 
00046 
00047 
00060 class TimedThread : public SingleTimerThread
00061 {
00062    // ====== Constructor/Destructor =========================================
00063    public:
00085    TimedThread(const card64   usec,
00086                const char*    name  = "TimedThread",
00087                const cardinal flags = TF_CancelDeferred);
00088 
00092    ~TimedThread();
00093 
00094 
00095    // ====== Interval functions =============================================
00101    inline card64 getInterval();
00102 
00108    inline void setInterval(const card64 usec);
00109 
00119    inline void setNextAction(const card64 usec      = 0,
00120                              const card64 callLimit = 1);
00121 
00132    inline void setNextActionAbs(const card64 timeStamp = 0,
00133                                 const card64 callLimit = 1);
00134 
00142    inline cardinal getTimerCorrection();
00143 
00155    inline void setTimerCorrection(const cardinal maxCorrection = 0);
00156 
00162    inline void leaveCorrectionLoop();
00163 
00171    inline void setFastStart(const bool on);
00172 
00179    inline bool getFastStart() const;
00180 
00181 
00182    // ====== timerEvent() to be implemented by subclass =====================
00183    protected:
00190    virtual void timerEvent() = 0;
00191 
00192 
00193    // ====== Private data ===================================================
00194    private:
00195    void timerEvent(const cardinal timer);
00196 };
00197 
00198 
00199 #include "timedthread.icc"
00200 
00201 
00202 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines