17 #include "generalmod.h" 37 virtual bool isBad()
const = 0;
40 virtual const char*
connType()
const = 0;
41 virtual bool forRead()
const = 0;
46 {
return const_cast<Conn*
>(
this)->
getStream(); }
65 virtual Conn*
gtConn()
const {
return const_cast<Conn*
>(
this); }
81 XConn() : conn_(0), mine_(true) {}
82 ~XConn() {
if ( mine_ )
delete conn_; }
85 {
return conn_ ? conn_->isBad() :
true; }
87 {
return conn_ ? conn_->creationMessage() : 0; }
89 {
return conn_ && conn_->forRead(); }
91 {
return conn_ && conn_->forWrite(); }
93 {
if ( conn_ ) conn_->close(); }
95 {
return conn_ ? conn_->
getStream() : 0; }
97 void setConn( Conn* c,
bool becomesmine=
true )
98 {
if ( mine_ )
delete conn_;
99 conn_ = c; mine_ = becomesmine; }
102 static const char* sType();
109 Conn*
gtConn()
const {
return const_cast<Conn*
>(conn_); }
Conn()
Definition: conn.h:61
#define mExpClass(module)
Definition: commondefs.h:160
bool mine_
Definition: conn.h:107
virtual bool isBad() const
Conn * conn_
Definition: conn.h:106
virtual bool isBad() const
Definition: conn.h:84
const Conn * conn() const
Returns the actual connection doing the work.
Definition: conn.h:49
virtual bool forWrite() const
Definition: conn.h:42
virtual bool forRead() const
virtual const char * creationMessage() const
Definition: conn.h:38
virtual bool forWrite() const
Definition: conn.h:90
virtual ~Conn()
Definition: conn.h:34
void setLinkedTo(const MultiID &id)
Definition: conn.h:53
virtual void close()
Definition: conn.h:35
const char * connType() const
Definition: conn.h:101
Conn * gtConn() const
Definition: conn.h:109
virtual StreamConn * getStream()
Definition: conn.h:44
virtual bool forRead() const
Definition: conn.h:88
const char * connType() const
Definition: streamconn.h:55
XConn()
Definition: conn.h:81
static const bool Read
Definition: conn.h:56
Connection implemented in terms of another Conn object.
Definition: conn.h:74
Conn * conn()
Definition: conn.h:48
void setConn(Conn *c, bool becomesmine=true)
Definition: conn.h:97
virtual void close()
Definition: conn.h:92
const MultiID & linkedTo() const
Definition: conn.h:52
Data connection.
Definition: conn.h:30
virtual StreamConn * getStream()
Definition: conn.h:94
virtual const char * creationMessage() const
Definition: conn.h:86
MultiID ioobjid_
Definition: conn.h:63
bool isStream() const
Definition: conn.h:45
static const bool Write
Definition: conn.h:57
virtual Conn * gtConn() const
Definition: conn.h:65
Connection with an underlying iostream.
Definition: streamconn.h:26
virtual StreamConn * getStream()
Definition: streamconn.h:41
~XConn()
Definition: conn.h:82
Compound key consisting of ints.
Definition: multiid.h:25