OpendTect-6_4  6.4
Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
Network::RequestConnection Class Reference
Inheritance diagram for Network::RequestConnection:
[legend]

Public Member Functions

 RequestConnection (const char *servername, unsigned short serverport, bool multithreaded=true, int connectiontimeout=-1)
 Initiates communications. More...
 
 RequestConnection (Socket *)
 
 ~RequestConnection ()
 
bool isOK () const
 
const char * server () const
 
unsigned short port () const
 
int ID () const
 
bool sendPacket (const RequestPacket &, bool waitforfinish=false)
 
RequestPacketpickupPacket (od_int32 reqid, int timeout, int *errorcode=0)
 
RequestPacketgetNextExternalPacket ()
 
bool isMultiThreaded ()
 
Socket * socket ()
 
uiString errMsg () const
 
- Public Member Functions inherited from CallBacker
 CallBacker ()
 
 CallBacker (const CallBacker &)
 
virtual ~CallBacker ()
 
bool attachCB (NotifierAccess &, const CallBack &, bool onlyifnew=false)
 
bool attachCB (NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false)
 
void detachCB (NotifierAccess &, const CallBack &)
 
void detachCB (NotifierAccess *notif, const CallBack &cb)
 
bool isNotifierAttached (NotifierAccess *) const
 Only for debugging purposes, don't use. More...
 

Static Public Member Functions

static int cInvalidRequest ()
 
static int cTimeout ()
 
static int cDisconnected ()
 

Public Attributes

CNotifier< RequestConnection, od_int32packetArrived
 
Notifier< RequestConnectionconnectionClosed
 

Private Types

enum  ThreadReadStatus { None, TryRead, ReadOK, ReadFail }
 

Private Member Functions

 mODTextTranslationClass (RequestConnection)
 
void socketThreadFunc (CallBacker *)
 
void connectToHost ()
 
void flush ()
 
void connCloseCB (CallBacker *)
 
void newConnectionCB (CallBacker *)
 
void dataArrivedCB (CallBacker *)
 
bool doSendPacket (const RequestPacket &, bool waitforfinish)
 
bool readFromSocket ()
 
bool writeToSocket ()
 
Network::RequestPacketreadConnection (int)
 
Network::RequestPacketgetNextAlreadyRead (int)
 
void requestEnded (od_int32)
 

Private Attributes

uiString errmsg_
 
ThreadReadStatus threadreadstatus_
 
TypeSet< od_int32ourrequestids_
 
ObjectSet< RequestPacketreceivedpackets_
 
Threads::ConditionVar lock_
 
Socket * socket_
 
int timeout_
 
bool ownssocket_
 
const RequestPacketpackettosend_
 
bool sendwithwait_
 
bool sendresult_
 
bool sendingfinished_
 
bool triggerread_
 
int id_
 
BufferString servername_
 
unsigned short serverport_
 
Threads::Threadsocketthread_
 
bool stopflag_
 
bool readfirst_
 

Additional Inherited Members

- Protected Member Functions inherited from CallBacker
void detachAllNotifiers ()
 Call from the destructor of your inherited object. More...
 

Detailed Description

Member Enumeration Documentation

Enumerator
None 
TryRead 
ReadOK 
ReadFail 

Constructor & Destructor Documentation

Network::RequestConnection::RequestConnection ( const char *  servername,
unsigned short  serverport,
bool  multithreaded = true,
int  connectiontimeout = -1 
)

Initiates communications.

Network::RequestConnection::RequestConnection ( Socket *  )

Socket does NOT become mine. Socket should be connected to whomever is my counterpart.

Network::RequestConnection::~RequestConnection ( )

Member Function Documentation

static int Network::RequestConnection::cDisconnected ( )
inlinestatic
static int Network::RequestConnection::cInvalidRequest ( )
inlinestatic
void Network::RequestConnection::connCloseCB ( CallBacker )
private
void Network::RequestConnection::connectToHost ( )
private
static int Network::RequestConnection::cTimeout ( )
inlinestatic
void Network::RequestConnection::dataArrivedCB ( CallBacker )
private
bool Network::RequestConnection::doSendPacket ( const RequestPacket ,
bool  waitforfinish 
)
private
uiString Network::RequestConnection::errMsg ( ) const
inline
void Network::RequestConnection::flush ( )
private
Network::RequestPacket* Network::RequestConnection::getNextAlreadyRead ( int  )
private
RequestPacket* Network::RequestConnection::getNextExternalPacket ( )
int Network::RequestConnection::ID ( ) const
inline
bool Network::RequestConnection::isMultiThreaded ( )
inline
bool Network::RequestConnection::isOK ( ) const
Network::RequestConnection::mODTextTranslationClass ( RequestConnection  )
private
void Network::RequestConnection::newConnectionCB ( CallBacker )
private
RequestPacket* Network::RequestConnection::pickupPacket ( od_int32  reqid,
int  timeout,
int *  errorcode = 0 
)

Must be called from same thread as construcor unless 'multithreaded' flag was set on constructor.

unsigned short Network::RequestConnection::port ( ) const
inline
Network::RequestPacket* Network::RequestConnection::readConnection ( int  )
private
bool Network::RequestConnection::readFromSocket ( )
private
void Network::RequestConnection::requestEnded ( od_int32  )
private
bool Network::RequestConnection::sendPacket ( const RequestPacket ,
bool  waitforfinish = false 
)

Must be called from same thread as construcor unless 'multithreaded' flag was set on constructor.

const char* Network::RequestConnection::server ( ) const
inline
Socket* Network::RequestConnection::socket ( )
inline
void Network::RequestConnection::socketThreadFunc ( CallBacker )
private
bool Network::RequestConnection::writeToSocket ( )
private

Member Data Documentation

Notifier<RequestConnection> Network::RequestConnection::connectionClosed
uiString Network::RequestConnection::errmsg_
private
int Network::RequestConnection::id_
private
Threads::ConditionVar Network::RequestConnection::lock_
private
TypeSet<od_int32> Network::RequestConnection::ourrequestids_
private
bool Network::RequestConnection::ownssocket_
private
CNotifier<RequestConnection,od_int32> Network::RequestConnection::packetArrived
const RequestPacket* Network::RequestConnection::packettosend_
private
bool Network::RequestConnection::readfirst_
private
ObjectSet<RequestPacket> Network::RequestConnection::receivedpackets_
private
bool Network::RequestConnection::sendingfinished_
private
bool Network::RequestConnection::sendresult_
private
bool Network::RequestConnection::sendwithwait_
private
BufferString Network::RequestConnection::servername_
private
unsigned short Network::RequestConnection::serverport_
private
Socket* Network::RequestConnection::socket_
private
Threads::Thread* Network::RequestConnection::socketthread_
private
bool Network::RequestConnection::stopflag_
private
ThreadReadStatus Network::RequestConnection::threadreadstatus_
private
int Network::RequestConnection::timeout_
private
bool Network::RequestConnection::triggerread_
private

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