OpendTect-6_4  6.4
qtcpsocketcomm.h
Go to the documentation of this file.
1 #ifndef qtcpsocketcomm_h
2 #define qtcpsocketcomm_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Nanne Hemstra
9  Date: March 2009
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include <QTcpSocket>
16 #include "netsocket.h"
17 
18 /*\brief QTcpSocket communication class
19 
20  Internal object, to hide Qt's signal/slot mechanism.
21 */
22 
23 QT_BEGIN_NAMESPACE
24 
25 class QTcpSocketComm : public QObject
26 {
27  Q_OBJECT
28  friend class Network::Socket;
29 
30  void disconnect() { netsocket_ = 0; }
31 
32 protected:
33 
34 QTcpSocketComm( QTcpSocket* qtcpsocket, Network::Socket* netsocket )
35  : qtcpsocket_(qtcpsocket)
36  , netsocket_(netsocket)
37 {
38  connect( qtcpsocket, SIGNAL(disconnected()), this, SLOT(trigDisconnect()));
39  connect( qtcpsocket, SIGNAL(readyRead()), this, SLOT(trigReadyRead()) );
40 }
41 
42 private slots:
43 
45 {
46  if ( netsocket_ )
47  netsocket_->disconnected.trigger( *netsocket_ );
48 }
49 
50 
52 {
53  if ( netsocket_ )
54  netsocket_->readyRead.trigger( *netsocket_ );
55 }
56 
57 private:
58 
59  QTcpSocket* qtcpsocket_;
61 
62 };
63 
64 QT_END_NAMESPACE
65 
66 #endif
void disconnect()
Definition: qtcpsocketcomm.h:30
QTcpSocket * qtcpsocket_
Definition: qtcpsocketcomm.h:59
QTcpSocketComm(QTcpSocket *qtcpsocket, Network::Socket *netsocket)
Definition: qtcpsocketcomm.h:34
Network::Socket * netsocket_
Definition: qtcpsocketcomm.h:60
Definition: qtcpsocketcomm.h:25
friend class Network::Socket
Definition: qtcpsocketcomm.h:28
void trigReadyRead()
Definition: qtcpsocketcomm.h:51
void trigDisconnect()
Definition: qtcpsocketcomm.h:44

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019