diff --git a/src/cas/generic/casChannelI.cc b/src/cas/generic/casChannelI.cc index ea64ca536..40f37bb3d 100644 --- a/src/cas/generic/casChannelI.cc +++ b/src/cas/generic/casChannelI.cc @@ -24,16 +24,18 @@ // // casChannelI::casChannelI() // -casChannelI::casChannelI (const casCtx &ctx) : - client ( * (casStrmClient *) ctx.getClient ()), - pv (*ctx.getPV()), - cid (ctx.getMsg()->m_cid), - accessRightsEvPending (FALSE) +casChannelI::casChannelI ( const casCtx & ctx ) : + pClient ( 0 ), pPV ( 0 ), cid ( 0xffffffff ), + accessRightsEvPending ( false ) { - assert (&this->client); - assert (&this->pv); +} - this->client.installChannel (*this); +void casChannelI::bindToClientI ( casCoreClient & client, casPVI & pv, caResId cidIn ) +{ + this->pClient = & client; + this->pPV = & pv; + this->cid = cidIn; + client.installChannel ( *this ); } // @@ -71,12 +73,12 @@ casChannelI::~casChannelI() iterMon = tmpMon; } - this->client.removeChannel(*this); + this->pClient->removeChannel(*this); // // force PV delete if this is the last channel attached // - this->pv.deleteSignal(); + this->pPV->deleteSignal(); this->unlock(); } @@ -115,7 +117,7 @@ void casChannelI::show ( unsigned level ) const tsDLIterConst iter = this->monitorList.firstIter (); if ( iter.valid () ) { printf("List of CA events (monitors) for \"%s\".\n", - this->pv.getName()); + this->pPV->getName()); } while ( iter.valid () ) { iter->show ( level ); @@ -136,9 +138,9 @@ caStatus casChannelI::cbFunc(casEventSys &) { caStatus stat; - stat = this->client.accessRightsResponse(this); + stat = this->pClient->accessRightsResponse(this); if (stat==S_cas_success) { - this->accessRightsEvPending = FALSE; + this->accessRightsEvPending = false; } return stat; } @@ -168,10 +170,10 @@ void casChannelI::destroyClientNotify () pCDEV = new casChanDelEv (this->getCID()); if (pCDEV) { - this->client.casEventSys::addToEventQueue (*pCDEV); + this->pClient->casEventSys::addToEventQueue (*pCDEV); } else { - status = this->client.disconnectChan (this->getCID()); + status = this->pClient->disconnectChan (this->getCID()); if (status) { // // At this point there is no space in pool @@ -185,7 +187,7 @@ void casChannelI::destroyClientNotify () // will result in bugs because no doubt this // could be called by a client member function. // - this->client.setDestroyPending(); + this->pClient->setDestroyPending(); } } this->destroy(); diff --git a/src/cas/generic/casChannelIIL.h b/src/cas/generic/casChannelIIL.h index 67c1e4c62..93d20ccad 100644 --- a/src/cas/generic/casChannelIIL.h +++ b/src/cas/generic/casChannelIIL.h @@ -27,7 +27,7 @@ // inline void casChannelI::lock() const { - this->client.lock(); + this->pClient->lock(); } // @@ -35,7 +35,7 @@ inline void casChannelI::lock() const // inline void casChannelI::unlock() const { - this->client.unlock(); + this->pClient->unlock(); } // @@ -112,7 +112,7 @@ inline void casChannelI::removeAsyncIO(casAsyncIOI &io) { this->lock(); this->ioInProgList.remove(io); - this->pv.unregisterIO(); + this->pPV->unregisterIO(); this->unlock(); } @@ -130,9 +130,9 @@ inline const caResId casChannelI::getSID() // inline void casChannelI::postAccessRightsEvent() { - if (!this->accessRightsEvPending) { - this->accessRightsEvPending = TRUE; - this->client.addToEventQueue(*this); + if ( ! this->accessRightsEvPending ) { + this->accessRightsEvPending = true; + this->pClient->addToEventQueue ( *this ); } } @@ -141,7 +141,7 @@ inline void casChannelI::postAccessRightsEvent() // inline const gddEnumStringTable & casChannelI::enumStringTable () const { - return this->pv.enumStringTable (); + return this->pPV->enumStringTable (); } #endif // casChannelIIL_h diff --git a/src/cas/generic/casInternal.h b/src/cas/generic/casInternal.h index ad4a19725..1c10e1de4 100644 --- a/src/cas/generic/casInternal.h +++ b/src/cas/generic/casInternal.h @@ -283,9 +283,11 @@ public: casChannelI (const casCtx &ctx); epicsShareFunc virtual ~casChannelI(); + void bindToClientI ( casCoreClient & client, casPVI & pv, caResId cid ); + casCoreClient &getClient () const { - return this->client; + return *this->pClient; } const caResId getCID () { @@ -316,7 +318,7 @@ public: casPVI &getPVI () const { - return this->pv; + return *this->pPV; } void installAsyncIO (casAsyncIOI &); @@ -356,10 +358,10 @@ public: protected: tsDLList monitorList; tsDLList ioInProgList; - casCoreClient &client; - casPVI &pv; - caResId const cid; // client id - unsigned accessRightsEvPending:1; + casCoreClient * pClient; + casPVI * pPV; + caResId cid; // client id + bool accessRightsEvPending:1; epicsShareFunc virtual void destroy (); casChannelI ( const casChannelI & ); @@ -372,8 +374,10 @@ protected: class casPVListChan : public casChannelI, public tsDLNode { public: - casPVListChan (const casCtx &ctx); + casPVListChan ( const casCtx &ctx ); + void bindToClient ( casCoreClient & client, casPVI & pv, caResId cid ); epicsShareFunc virtual ~casPVListChan(); +private: casPVListChan ( const casPVListChan & ); casPVListChan & operator = ( const casPVListChan & ); }; diff --git a/src/cas/generic/casPVListChan.cc b/src/cas/generic/casPVListChan.cc index bbbb9be38..da0b54f6e 100644 --- a/src/cas/generic/casPVListChan.cc +++ b/src/cas/generic/casPVListChan.cc @@ -25,7 +25,12 @@ casPVListChan::casPVListChan (const casCtx &ctx) : casChannelI(ctx) { - this->pv.installChannel(*this); +} + +void casPVListChan::bindToClient ( casCoreClient & client, casPVI & pv, caResId cid ) +{ + this->bindToClientI ( client, pv, cid ); + this->pPV->installChannel ( *this ); } // @@ -33,7 +38,7 @@ casPVListChan::casPVListChan (const casCtx &ctx) : // casPVListChan::~casPVListChan() { - this->pv.removeChannel(*this); + this->pPV->removeChannel(*this); // // delete signal to PV occurs in // casChannelI::~casChannelI diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index 94605c42b..0d437c148 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -1077,6 +1077,8 @@ caStatus casStrmClient::createChanResponse(const caHdrLargeArray &hdr, const pvA return this->channelCreateFailed (&hdr, S_cas_noMemory); } + pChan->bindToClient ( *this, *pPV, hdr.m_cid ); + pChanI = (casChannelI *) pChan; //