eventthread.h 2.3 KB
Newer Older
yanmorin's avatar
   
yanmorin committed
1
/*
2
3
 *  Copyright (C) 2009 Savoir-Faire Linux inc.
 *  Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
jpbl's avatar
jpbl committed
4
5
6
 *                                                                              
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 3 of the License, or
jpbl's avatar
jpbl committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *  (at your option) any later version.
 *                                                                              
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *                                                                              
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef __EVENT_THREAD_H__
#define __EVENT_THREAD_H__

#include <cc++/thread.h>

yanmorin's avatar
   
yanmorin committed
25
class VoIPLink;
26

yanmorin's avatar
   
yanmorin committed
27
/**
28
29
 * @file eventthread.h
 * @brief General thread to listen events continuously
yanmorin's avatar
   
yanmorin committed
30
 */
31

jpbl's avatar
jpbl committed
32
class EventThread : public ost::Thread {
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

    friend class SIPEventThread;
    friend class IAXEventThread;

    public:
        /**
         * Thread constructor 
         */
        EventThread (VoIPLink* link) : Thread(), _linkthread(link){
            setCancel( cancelDeferred );
        }
        
        
        virtual ~EventThread (void){
            terminate();
        }
        
        virtual void run () = 0;
        
    private:
Yun Liu's avatar
Yun Liu committed
53
54
55
56
        EventThread(const EventThread& rh); // copy constructor
        EventThread& operator=(const EventThread& rh);  // assignment operator	

        /** VoIPLink is the object being called by getEvents() method  */
57
58
59
60
61
62
63
64
65
66
67
        VoIPLink*	_linkthread;
};

class IAXEventThread : public EventThread {
    
    public:
        IAXEventThread( VoIPLink* voiplink )
            : EventThread( voiplink ){
        }

        virtual void run();
jpbl's avatar
jpbl committed
68
69
};

70
71
72
73
74
75
76
77
78
79
80
class SIPEventThread : public EventThread {
    
    public:
        SIPEventThread( VoIPLink* voiplink )
            : EventThread( voiplink ){
        }

        virtual void run();
};


jpbl's avatar
jpbl committed
81
#endif // __EVENT_THREAD_H__