changed list interface
This commit is contained in:
@@ -47,10 +47,10 @@ CASG::~CASG ()
|
||||
{
|
||||
if ( this->verify () ) {
|
||||
this->mutex.lock ();
|
||||
tsDLIterBD <syncGroupNotify> notify ( this->ioList.first () );
|
||||
tsDLIterBD <syncGroupNotify> notify = this->ioList.firstIter ();
|
||||
while ( notify.valid () ) {
|
||||
notify->release ();
|
||||
notify = this->ioList.first ();
|
||||
notify = this->ioList.firstIter ();
|
||||
}
|
||||
this->mutex.unlock ();
|
||||
this->client.uninstallCASG ( *this );
|
||||
@@ -160,9 +160,10 @@ void CASG::show ( unsigned level) const
|
||||
|
||||
if ( level ) {
|
||||
this->mutex.lock ();
|
||||
tsDLIterBD <syncGroupNotify> notify ( this->ioList.first () );
|
||||
tsDLIterConstBD <syncGroupNotify> notify = this->ioList.firstIter ();
|
||||
while ( notify.valid () ) {
|
||||
notify->show (level);
|
||||
notify++;
|
||||
}
|
||||
this->mutex.unlock ();
|
||||
}
|
||||
|
||||
@@ -156,9 +156,10 @@ cac::~cac ()
|
||||
{
|
||||
epicsAutoMutex autoMutex ( this->iiuListMutex );
|
||||
|
||||
tsDLIterBD <tcpiiu> piiu ( this->iiuList.first () );
|
||||
tsDLIterBD <tcpiiu> piiu = this->iiuList.firstIter ();
|
||||
while ( piiu.valid () ) {
|
||||
tsDLIterBD <tcpiiu> pnext = piiu.itemAfter ();
|
||||
tsDLIterBD <tcpiiu> pnext = piiu;
|
||||
pnext++;
|
||||
{
|
||||
epicsAutoMutex autoMutexTmp ( this->defaultMutex );
|
||||
piiu->disconnectAllChan ( limboIIU );
|
||||
@@ -168,9 +169,10 @@ cac::~cac ()
|
||||
piiu = pnext;
|
||||
}
|
||||
|
||||
piiu = this->iiuListLimbo.first ();
|
||||
piiu = this->iiuListLimbo.firstIter ();
|
||||
while ( piiu.valid () ) {
|
||||
tsDLIterBD <tcpiiu> pnext = piiu.itemAfter ();
|
||||
tsDLIterBD <tcpiiu> pnext = piiu;
|
||||
pnext++;
|
||||
piiu->suicide ();
|
||||
piiu = pnext;
|
||||
}
|
||||
@@ -220,9 +222,10 @@ void cac::processRecvBacklog ()
|
||||
{
|
||||
epicsAutoMutex autoMutex ( this->iiuListMutex );
|
||||
|
||||
tsDLIterBD < tcpiiu > piiu ( this->iiuList.first () );
|
||||
tsDLIterBD < tcpiiu > piiu = this->iiuList.firstIter ();
|
||||
while ( piiu.valid () ) {
|
||||
tsDLIterBD < tcpiiu > pNext = piiu.itemAfter ();
|
||||
tsDLIterBD < tcpiiu > pNext = piiu;
|
||||
pNext++;
|
||||
|
||||
if ( ! piiu->alive () ) {
|
||||
assert ( this->pudpiiu && this->pSearchTmr );
|
||||
@@ -271,7 +274,7 @@ void cac::flush ()
|
||||
* set the push pending flag on all virtual circuits
|
||||
*/
|
||||
epicsAutoMutex autoMutex ( this->iiuListMutex );
|
||||
tsDLIterBD <tcpiiu> piiu ( this->iiuList.first () );
|
||||
tsDLIterBD <tcpiiu> piiu = this->iiuList.firstIter ();
|
||||
while ( piiu.valid () ) {
|
||||
piiu->flush ();
|
||||
piiu++;
|
||||
@@ -292,7 +295,7 @@ void cac::show ( unsigned level ) const
|
||||
::printf ( "Channel Access Client Context at %p for user %s\n",
|
||||
this, this->pUserName );
|
||||
if ( level > 0u ) {
|
||||
tsDLIterConstBD < tcpiiu > piiu ( this->iiuList.first () );
|
||||
tsDLIterConstBD < tcpiiu > piiu = this->iiuList.firstIter ();
|
||||
while ( piiu.valid () ) {
|
||||
piiu->show ( level - 1u );
|
||||
piiu++;
|
||||
|
||||
@@ -36,7 +36,7 @@ cacChannelIO * cacServiceList::createChannelIO ( const char *pName,
|
||||
cacChannelIO *pChanIO = 0;
|
||||
|
||||
this->lock ();
|
||||
tsDLIterBD < cacServiceIO > iter ( this->services.first () );
|
||||
tsDLIterBD < cacServiceIO > iter = this->services.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
pChanIO = iter->createChannelIO ( pName, cacCtx, chan );
|
||||
if ( pChanIO ) {
|
||||
@@ -52,7 +52,7 @@ cacChannelIO * cacServiceList::createChannelIO ( const char *pName,
|
||||
void cacServiceList::show ( unsigned level ) const
|
||||
{
|
||||
this->lock ();
|
||||
tsDLIterConstBD < cacServiceIO > iter ( this->services.first () );
|
||||
tsDLIterConstBD < cacServiceIO > iter = this->services.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->show ( level );
|
||||
iter++;
|
||||
|
||||
@@ -15,7 +15,7 @@ inline inetAddrID::inetAddrID (const struct sockaddr_in &addrIn) :
|
||||
{
|
||||
}
|
||||
|
||||
inline bool inetAddrID::operator == (const inetAddrID &rhs)
|
||||
inline bool inetAddrID::operator == (const inetAddrID &rhs) const
|
||||
{
|
||||
if (this->addr.sin_addr.s_addr == rhs.addr.sin_addr.s_addr) {
|
||||
if (this->addr.sin_port == rhs.addr.sin_port) {
|
||||
|
||||
@@ -865,7 +865,7 @@ private:
|
||||
class inetAddrID {
|
||||
public:
|
||||
inetAddrID ( const struct sockaddr_in &addrIn );
|
||||
bool operator == ( const inetAddrID & );
|
||||
bool operator == ( const inetAddrID & ) const;
|
||||
resTableIndex hash ( unsigned nBitsHashIndex ) const;
|
||||
static unsigned maxIndexBitWidth ();
|
||||
static unsigned minIndexBitWidth ();
|
||||
|
||||
@@ -32,10 +32,10 @@ void netiiu::show ( unsigned level ) const
|
||||
|
||||
printf ( "network IO base class\n" );
|
||||
if ( level > 1 ) {
|
||||
tsDLIterConstBD < nciu > pChan ( this->channelList.first () );
|
||||
tsDLIterConstBD < nciu > pChan = this->channelList.firstIter ();
|
||||
while ( pChan.valid () ) {
|
||||
pChan->show ( level - 1u );
|
||||
pChan = pChan.itemAfter ();
|
||||
pChan++;
|
||||
}
|
||||
}
|
||||
if ( level > 2u ) {
|
||||
@@ -78,9 +78,10 @@ void netiiu::disconnectAllChan ( netiiu & newiiu )
|
||||
|
||||
{
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
tsDLIterBD < nciu > chan ( this->channelList.first () );
|
||||
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
|
||||
while ( chan.valid () ) {
|
||||
tsDLIterBD < nciu > next = chan.itemAfter ();
|
||||
tsDLIterBD < nciu > next = chan;
|
||||
next++;
|
||||
this->clearChannelRequest ( *chan );
|
||||
this->channelList.remove ( *chan );
|
||||
chan->disconnect ( newiiu );
|
||||
@@ -123,7 +124,7 @@ bool netiiu::destroyAllIO ( nciu &chan )
|
||||
void netiiu::connectTimeoutNotify ()
|
||||
{
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
tsDLIterBD < nciu > chan ( this->channelList.first () );
|
||||
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
|
||||
while ( chan.valid () ) {
|
||||
chan->connectTimeoutNotify ();
|
||||
chan++;
|
||||
@@ -133,7 +134,7 @@ void netiiu::connectTimeoutNotify ()
|
||||
void netiiu::resetChannelRetryCounts ()
|
||||
{
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
tsDLIterBD < nciu > chan ( this->channelList.first () );
|
||||
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
|
||||
while ( chan.valid () ) {
|
||||
chan->resetRetryCount ();
|
||||
chan++;
|
||||
@@ -146,12 +147,12 @@ bool netiiu::searchMsg ( unsigned short retrySeqNumber, unsigned &retryNoForThis
|
||||
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
|
||||
tsDLIterBD < nciu > chan = this->channelList.first ();
|
||||
if ( chan.valid () ) {
|
||||
status = chan->searchMsg ( retrySeqNumber, retryNoForThisChannel );
|
||||
nciu *pChan = this->channelList.first ();
|
||||
if ( pChan ) {
|
||||
status = pChan->searchMsg ( retrySeqNumber, retryNoForThisChannel );
|
||||
if ( status ) {
|
||||
this->channelList.remove ( *chan );
|
||||
this->channelList.add ( *chan );
|
||||
this->channelList.remove ( *pChan );
|
||||
this->channelList.add ( *pChan );
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -412,33 +412,35 @@ LOCAL void register_new_client ( osiSockAddr &from )
|
||||
}
|
||||
}
|
||||
|
||||
tsDLIterBD < repeaterClient > pclient = client_list.first ();
|
||||
tsDLIterBD < repeaterClient > pclient = client_list.firstIter ();
|
||||
while ( pclient.valid () ) {
|
||||
if ( pclient->identicalPort ( from ) ) {
|
||||
break;
|
||||
}
|
||||
pclient = pclient.itemAfter ();
|
||||
}
|
||||
|
||||
if ( ! pclient.valid () ) {
|
||||
pclient = new repeaterClient ( from );
|
||||
if ( ! pclient.valid () ) {
|
||||
pclient++;
|
||||
}
|
||||
|
||||
repeaterClient *pNewClient;
|
||||
if ( pclient.valid () ) {
|
||||
pNewClient = pclient.pointer ();
|
||||
}
|
||||
else {
|
||||
repeaterClient *pNewClient = new repeaterClient ( from );
|
||||
if ( ! pNewClient ) {
|
||||
ca_printf ( "%s: no memory for new client\n", __FILE__ );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! pclient->connect () ) {
|
||||
if ( ! pNewClient->connect () ) {
|
||||
pclient->destroy ();
|
||||
return;
|
||||
}
|
||||
|
||||
client_list.add ( *pclient );
|
||||
client_list.add ( *pNewClient );
|
||||
newClient = true;
|
||||
}
|
||||
|
||||
if ( ! pclient->sendConfirm () ) {
|
||||
client_list.remove (*pclient );
|
||||
pclient->destroy ();
|
||||
if ( ! pNewClient->sendConfirm () ) {
|
||||
client_list.remove ( *pNewClient );
|
||||
pNewClient->destroy ();
|
||||
debugPrintf ( ( "Deleted repeater client=%u (error while sending ack)\n",
|
||||
ntohs (from.ia.sin_port) ) );
|
||||
}
|
||||
|
||||
@@ -1958,9 +1958,10 @@ void tcpiiu::connectAllIO ( nciu &chan )
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
if ( chan.verifyConnected ( *this ) ) {
|
||||
tsDLIterBD < baseNMIU > pNetIO =
|
||||
chan.tcpiiuPrivateListOfIO::eventq.first ();
|
||||
chan.tcpiiuPrivateListOfIO::eventq.firstIter ();
|
||||
while ( pNetIO.valid () ) {
|
||||
tsDLIterBD < baseNMIU > next = pNetIO.itemAfter ();
|
||||
tsDLIterBD < baseNMIU > next = pNetIO;
|
||||
next++;
|
||||
class netSubscription *pSubscr = pNetIO->isSubscription ();
|
||||
if ( pSubscr ) {
|
||||
this->subscriptionRequest ( *pSubscr, false );
|
||||
@@ -1984,9 +1985,10 @@ void tcpiiu::disconnectAllIO ( nciu &chan )
|
||||
epicsAutoMutex autoMutex ( this->mutex );
|
||||
if ( chan.verifyConnected ( *this ) ) {
|
||||
tsDLIterBD < baseNMIU > pNetIO =
|
||||
chan.tcpiiuPrivateListOfIO::eventq.first ();
|
||||
chan.tcpiiuPrivateListOfIO::eventq.firstIter ();
|
||||
while ( pNetIO.valid () ) {
|
||||
tsDLIterBD < baseNMIU > next = pNetIO.itemAfter ();
|
||||
tsDLIterBD < baseNMIU > next = pNetIO;
|
||||
next++;
|
||||
class netSubscription *pSubscr = pNetIO->isSubscription ();
|
||||
this->ioTable.remove ( *pNetIO );
|
||||
if ( pSubscr ) {
|
||||
|
||||
@@ -109,7 +109,7 @@ caServerI::~caServerI()
|
||||
//
|
||||
// delete all clients
|
||||
//
|
||||
tsDLIterBD <casStrmClient> iter ( this->clientList.first () );
|
||||
tsDLIterBD <casStrmClient> iter = this->clientList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
tsDLIterBD <casStrmClient> tmp = iter;
|
||||
++tmp;
|
||||
@@ -245,7 +245,7 @@ void caServerI::sendBeacon()
|
||||
// addresses.
|
||||
//
|
||||
this->lock();
|
||||
tsDLIterBD <casIntfOS> iter ( this->intfList.first () );
|
||||
tsDLIterBD <casIntfOS> iter = this->intfList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->sendBeacon ();
|
||||
iter++;
|
||||
@@ -271,7 +271,7 @@ double caServerI::getBeaconPeriod() const
|
||||
//
|
||||
void caServerI::show (unsigned level) const
|
||||
{
|
||||
int bytes_reserved;
|
||||
int bytes_reserved;
|
||||
|
||||
printf( "Channel Access Server Status V%d.%d\n",
|
||||
CA_PROTOCOL_VERSION, CA_MINOR_VERSION);
|
||||
@@ -279,13 +279,13 @@ void caServerI::show (unsigned level) const
|
||||
this->epicsMutex::show(level);
|
||||
|
||||
this->lock();
|
||||
tsDLIterBD<casStrmClient> iterCl( this->clientList.first () );
|
||||
tsDLIterConstBD<casStrmClient> iterCl = this->clientList.firstIter ();
|
||||
while ( iterCl.valid () ) {
|
||||
iterCl->show (level);
|
||||
++iterCl;
|
||||
}
|
||||
|
||||
tsDLIterBD<casIntfOS> iterIF ( this->intfList.first () );
|
||||
tsDLIterConstBD<casIntfOS> iterIF = this->intfList.firstIter ();
|
||||
while ( iterIF.valid () ) {
|
||||
iterIF->casIntfOS::show ( level );
|
||||
++iterIF;
|
||||
|
||||
@@ -59,12 +59,12 @@ casChannelI::~casChannelI()
|
||||
//
|
||||
// cancel any pending asynchronous IO
|
||||
//
|
||||
tsDLIterBD<casAsyncIOI> iterAIO ( this->ioInProgList.first () );
|
||||
tsDLIterBD<casAsyncIOI> iterAIO = this->ioInProgList.firstIter ();
|
||||
while ( iterAIO.valid () ) {
|
||||
//
|
||||
// destructor removes from this list
|
||||
//
|
||||
tsDLIterBD<casAsyncIOI> tmpAIO = iterAIO;
|
||||
tsDLIterBD <casAsyncIOI> tmpAIO = iterAIO;
|
||||
++tmpAIO;
|
||||
iterAIO->serverDestroy ();
|
||||
iterAIO = tmpAIO;
|
||||
@@ -73,7 +73,7 @@ casChannelI::~casChannelI()
|
||||
//
|
||||
// cancel the monitors
|
||||
//
|
||||
tsDLIterBD <casMonitor> iterMon ( this->monitorList.first () );
|
||||
tsDLIterBD <casMonitor> iterMon = this->monitorList.firstIter ();
|
||||
while ( iterMon.valid () ) {
|
||||
//
|
||||
// destructor removes from this list
|
||||
@@ -104,7 +104,7 @@ void casChannelI::clearOutstandingReads()
|
||||
//
|
||||
// cancel any pending asynchronous IO
|
||||
//
|
||||
tsDLIterBD <casAsyncIOI> iterIO ( this->ioInProgList.first () );
|
||||
tsDLIterBD <casAsyncIOI> iterIO = this->ioInProgList.firstIter ();
|
||||
while ( iterIO.valid () ) {
|
||||
//
|
||||
// destructor removes from this list
|
||||
@@ -121,11 +121,11 @@ void casChannelI::clearOutstandingReads()
|
||||
//
|
||||
// casChannelI::show()
|
||||
//
|
||||
void casChannelI::show(unsigned level) const
|
||||
void casChannelI::show ( unsigned level ) const
|
||||
{
|
||||
this->lock();
|
||||
this->lock ();
|
||||
|
||||
tsDLIterBD<casMonitor> iter(this->monitorList.first());
|
||||
tsDLIterConstBD <casMonitor> iter = this->monitorList.firstIter ();
|
||||
if ( iter.valid () ) {
|
||||
printf("List of CA events (monitors) for \"%s\".\n",
|
||||
this->pv.getName());
|
||||
@@ -135,9 +135,9 @@ void casChannelI::show(unsigned level) const
|
||||
++iter;
|
||||
}
|
||||
|
||||
this->show(level);
|
||||
this->show ( level );
|
||||
|
||||
this->unlock();
|
||||
this->unlock ();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -60,7 +60,7 @@ inline void casChannelI::postEvent (const casEventMask &select, const smartConst
|
||||
{
|
||||
this->lock();
|
||||
|
||||
tsDLIterBD<casMonitor> iter(this->monitorList.first());
|
||||
tsDLIterBD<casMonitor> iter = this->monitorList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->post (select, pEvent);
|
||||
++iter;
|
||||
@@ -105,7 +105,7 @@ inline void casChannelI::addMonitor(casMonitor &mon)
|
||||
inline tsDLIterBD <casMonitor> casChannelI::findMonitor (const caResId clientIdIn)
|
||||
{
|
||||
this->lock ();
|
||||
tsDLIterBD <casMonitor> iter ( this->monitorList.first () );
|
||||
tsDLIterBD <casMonitor> iter = this->monitorList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
if ( clientIdIn == iter->getClientId () ) {
|
||||
break;
|
||||
|
||||
@@ -57,7 +57,7 @@ casCoreClient::~casCoreClient()
|
||||
}
|
||||
|
||||
this->lock();
|
||||
tsDLIterBD<casAsyncIOI> iterIO(this->ioInProgList.first());
|
||||
tsDLIterBD<casAsyncIOI> iterIO = this->ioInProgList.firstIter ();
|
||||
|
||||
//
|
||||
// cancel any pending asynchronous IO
|
||||
|
||||
@@ -62,12 +62,8 @@ casPVI::~casPVI()
|
||||
//
|
||||
// delete any attached channels
|
||||
//
|
||||
tsDLIterBD <casPVListChan> iter ( this->chanList.first () );
|
||||
tsDLIterBD <casPVListChan> iter = this->chanList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
//
|
||||
// deleting the channel removes it from the list
|
||||
//
|
||||
|
||||
tsDLIterBD<casPVListChan> tmp = iter;
|
||||
++tmp;
|
||||
iter->destroyClientNotify ();
|
||||
|
||||
@@ -135,9 +135,9 @@ inline void casPVI::postEvent (const casEventMask &select, const smartConstGDDPo
|
||||
}
|
||||
|
||||
this->lock();
|
||||
tsDLIterBD<casPVListChan> iter(this->chanList.first());
|
||||
tsDLIterBD<casPVListChan> iter = this->chanList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->postEvent(select, pEvent);
|
||||
iter->postEvent ( select, pEvent );
|
||||
++iter;
|
||||
}
|
||||
this->unlock();
|
||||
|
||||
@@ -95,7 +95,7 @@ casStrmClient::~casStrmClient()
|
||||
//
|
||||
// delete all channel attached
|
||||
//
|
||||
tsDLIterBD<casChannelI> iter(this->chanList.first());
|
||||
tsDLIterBD <casChannelI> iter = this->chanList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
//
|
||||
// destroying the channel removes it from the list
|
||||
@@ -975,7 +975,7 @@ caStatus casStrmClient::hostNameAction()
|
||||
}
|
||||
this->pHostName = pMalloc;
|
||||
|
||||
tsDLIterBD<casChannelI> iter(this->chanList.first());
|
||||
tsDLIterBD <casChannelI> iter = this->chanList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->setOwner(this->pUserName, this->pHostName);
|
||||
++iter;
|
||||
@@ -1023,7 +1023,7 @@ caStatus casStrmClient::clientNameAction()
|
||||
}
|
||||
this->pUserName = pMalloc;
|
||||
|
||||
tsDLIterBD <casChannelI> iter ( this->chanList.first () );
|
||||
tsDLIterBD <casChannelI> iter = this->chanList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->setOwner ( this->pUserName, this->pHostName );
|
||||
++iter;
|
||||
@@ -1495,11 +1495,11 @@ caStatus casStrmClient::clearChannelAction ()
|
||||
//
|
||||
caStatus casStrmClient::eventCancelAction ()
|
||||
{
|
||||
const caHdr *mp = this->ctx.getMsg ();
|
||||
void *dp = this->ctx.getData ();
|
||||
const caHdr *mp = this->ctx.getMsg ();
|
||||
void *dp = this->ctx.getData ();
|
||||
casChannelI *pciu;
|
||||
caHdr *reply;
|
||||
int status;
|
||||
caHdr *reply;
|
||||
int status;
|
||||
|
||||
/*
|
||||
* Verify the channel
|
||||
@@ -1519,19 +1519,19 @@ caStatus casStrmClient::eventCancelAction ()
|
||||
/*
|
||||
* verify the event (monitor)
|
||||
*/
|
||||
tsDLIterBD < casMonitor > pMon = pciu->findMonitor ( mp->m_available );
|
||||
tsDLIterBD <casMonitor> pMon = pciu->findMonitor ( mp->m_available );
|
||||
if ( ! pMon.valid () ) {
|
||||
//
|
||||
// this indicates client or server library corruption
|
||||
//
|
||||
return logBadId (mp, dp, ECA_BADMONID, mp->m_cid);
|
||||
return logBadId ( mp, dp, ECA_BADMONID, mp->m_cid );
|
||||
}
|
||||
|
||||
/*
|
||||
* allocate delete confirmed message
|
||||
*/
|
||||
status = allocMsg (0u, &reply);
|
||||
if (status) {
|
||||
status = allocMsg ( 0u, &reply );
|
||||
if ( status ) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1619,21 +1619,21 @@ caStatus casStrmClient::readSyncAction()
|
||||
// a read.
|
||||
//
|
||||
this->lock();
|
||||
tsDLIterBD<casChannelI> iter(this->chanList.first());
|
||||
tsDLIterBD <casChannelI> iter = this->chanList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->clearOutstandingReads ();
|
||||
++iter;
|
||||
}
|
||||
this->unlock();
|
||||
|
||||
status = this->allocMsg(0u, &reply);
|
||||
if(status){
|
||||
status = this->allocMsg ( 0u, &reply );
|
||||
if ( status ) {
|
||||
return status;
|
||||
}
|
||||
|
||||
*reply = *mp;
|
||||
|
||||
this->commitMsg();
|
||||
this->commitMsg ();
|
||||
|
||||
return S_cas_success;
|
||||
}
|
||||
|
||||
@@ -50,9 +50,10 @@ dbChannelIO::~dbChannelIO ()
|
||||
/*
|
||||
* remove any subscriptions attached to this channel
|
||||
*/
|
||||
tsDLIterBD <dbSubscriptionIO> iter = this->eventq.first ();
|
||||
tsDLIterBD <dbSubscriptionIO> iter = this->eventq.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
tsDLIterBD <dbSubscriptionIO> next = iter.itemAfter ();
|
||||
tsDLIterBD <dbSubscriptionIO> next = iter;
|
||||
next++;
|
||||
iter->destroy ();
|
||||
iter = next;
|
||||
}
|
||||
@@ -206,7 +207,7 @@ void dbChannelIO::show ( unsigned level ) const
|
||||
this->serviceIO.show ( level - 2u );
|
||||
printf ( "\tget callback cache at %p, with size %lu\n",
|
||||
this->pGetCallbackCache, this->getCallbackCacheSize );
|
||||
tsDLIterConstBD < dbSubscriptionIO > pItem = this->eventq.first ();
|
||||
tsDLIterConstBD < dbSubscriptionIO > pItem = this->eventq.firstIter ();
|
||||
while ( pItem.valid () ) {
|
||||
pItem->show ( level - 2u );
|
||||
pItem++;
|
||||
|
||||
@@ -100,79 +100,34 @@ template <class T, class ID> class resTableIter;
|
||||
//
|
||||
template <class T, class ID>
|
||||
class resTable {
|
||||
friend class resTableIter<T,ID>;
|
||||
public:
|
||||
|
||||
resTable (unsigned nHashTableEntries);
|
||||
virtual ~resTable();
|
||||
// Call " void T::show (unsigned level)" for each entry
|
||||
void show (unsigned level) const;
|
||||
int add (T &res); // returns -1 (id exists in table), 0 (success)
|
||||
T *remove (const ID &idIn); // remove entry
|
||||
T *lookup (const ID &idIn) const; // locate entry
|
||||
// Call (pT->*pCB) () for each entry
|
||||
void traverse ( void (T::*pCB)() );
|
||||
void traverseConst ( void (T::*pCB)() const ) const;
|
||||
unsigned numEntriesInstalled () const;
|
||||
//
|
||||
// exceptions thrown
|
||||
//
|
||||
class epicsShareClass dynamicMemoryAllocationFailed {};
|
||||
class epicsShareClass sizeExceedsMaxIndexWidth {};
|
||||
|
||||
resTable (unsigned nHashTableEntries);
|
||||
|
||||
virtual ~resTable();
|
||||
|
||||
//
|
||||
// Call (pT->show) (level) for each entry
|
||||
// where pT is a pointer to type T. Show
|
||||
// returns "void". Show dumps increasing
|
||||
// diagnostics to std out with increasing
|
||||
// magnitude of the its level argument.
|
||||
//
|
||||
void show (unsigned level) const;
|
||||
|
||||
//
|
||||
// add entry
|
||||
//
|
||||
// returns -1 if the id already exits in the table
|
||||
// and zero if successful
|
||||
//
|
||||
int add (T &res);
|
||||
|
||||
T *remove (const ID &idIn); // remove entry
|
||||
|
||||
T *lookup (const ID &idIn) const; // locate entry
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1100
|
||||
//
|
||||
// required by MS vis c++ 5.0 (but not by 4.0)
|
||||
//
|
||||
typedef void (T::*pSetMFArg_t)();
|
||||
# define pSetMFArg(ARG) pSetMFArg_t ARG
|
||||
typedef void (T::*pSetMFArgConst_t)() const;
|
||||
# define pSetMFArgConst(ARG) pSetMFArgConst_t ARG
|
||||
#else
|
||||
//
|
||||
// required by gnu g++ 2.7.2
|
||||
//
|
||||
# define pSetMFArg(ARG) void (T:: * ARG)()
|
||||
# define pSetMFArgConst(ARG) void (T:: * ARG)() const
|
||||
#endif
|
||||
|
||||
//
|
||||
// Call (pT->*pCB) () for each entry
|
||||
//
|
||||
// where pT is a pointer to type T and pCB is
|
||||
// a pointer to a member function of T with
|
||||
// no parameters that returns void
|
||||
//
|
||||
void traverse ( pSetMFArg(pCB) );
|
||||
void traverseConst ( pSetMFArgConst(pCB) ) const;
|
||||
|
||||
unsigned numEntriesInstalled () const;
|
||||
|
||||
private:
|
||||
tsSLList<T> *pTable;
|
||||
unsigned hashIdMask;
|
||||
unsigned hashIdNBits;
|
||||
unsigned nInUse;
|
||||
|
||||
tsSLList<T> *pTable;
|
||||
unsigned hashIdMask;
|
||||
unsigned hashIdNBits;
|
||||
unsigned nInUse;
|
||||
resTableIndex hash (const ID & idIn) const;
|
||||
T *find (tsSLList<T> &list, const ID &idIn) const;
|
||||
T *findDelete (tsSLList<T> &list, const ID &idIn);
|
||||
resTable ( const resTable & );
|
||||
resTable & operator = ( const resTable & );
|
||||
friend class resTableIter<T,ID>;
|
||||
};
|
||||
|
||||
|
||||
@@ -229,7 +184,6 @@ public:
|
||||
static resTableIndex hashEngine (const T &id);
|
||||
static const unsigned maxIndexBitWidth ();
|
||||
static const unsigned minIndexBitWidth ();
|
||||
|
||||
protected:
|
||||
T id;
|
||||
};
|
||||
@@ -279,11 +233,6 @@ private:
|
||||
//
|
||||
class epicsShareClass stringId {
|
||||
public:
|
||||
|
||||
//
|
||||
// exceptions
|
||||
//
|
||||
class epicsShareClass dynamicMemoryAllocationFailed {};
|
||||
enum allocationType {copyString, refString};
|
||||
stringId (const char * idIn, allocationType typeIn=copyString);
|
||||
virtual ~stringId();
|
||||
@@ -293,7 +242,10 @@ public:
|
||||
void show (unsigned level) const;
|
||||
static const unsigned maxIndexBitWidth ();
|
||||
static const unsigned minIndexBitWidth ();
|
||||
|
||||
//
|
||||
// exceptions
|
||||
//
|
||||
class epicsShareClass dynamicMemoryAllocationFailed {};
|
||||
private:
|
||||
stringId & operator = ( const stringId & );
|
||||
stringId ( const stringId &);
|
||||
@@ -401,15 +353,14 @@ void resTable<T,ID>::show (unsigned level) const
|
||||
maxEntries = 0u;
|
||||
while ( pList < &this->pTable[this->hashIdMask+1] ) {
|
||||
unsigned count;
|
||||
tsSLIter<T> pItem ( pList->first () );
|
||||
|
||||
tsSLIter<T> pItem = pList->firstIter ();
|
||||
count = 0;
|
||||
while ( pItem.valid () ) {
|
||||
if ( level >= 3u ) {
|
||||
pItem->show (level);
|
||||
}
|
||||
count++;
|
||||
pItem = pItem.itemAfter ();
|
||||
pItem++;
|
||||
}
|
||||
if ( count > 0u ) {
|
||||
X += count;
|
||||
@@ -433,17 +384,16 @@ void resTable<T,ID>::show (unsigned level) const
|
||||
// resTable<T,ID>::traverse
|
||||
//
|
||||
template <class T, class ID>
|
||||
void resTable<T,ID>::traverse (pSetMFArg(pCB))
|
||||
void resTable<T,ID>::traverse ( void (T::*pCB)() )
|
||||
{
|
||||
tsSLList<T> *pList;
|
||||
|
||||
pList = this->pTable;
|
||||
while ( pList < &this->pTable[this->hashIdMask+1] ) {
|
||||
tsSLIter<T> pItem ( pList->first () );
|
||||
tsSLIter<T> pItem = pList->firstIter ();
|
||||
while ( pItem.valid () ) {
|
||||
T * p = & ( *pItem );
|
||||
pItem = pItem.itemAfter ();
|
||||
(p->*pCB) ();
|
||||
( pItem.pointer ()->*pCB ) ();
|
||||
pItem++;
|
||||
}
|
||||
pList++;
|
||||
}
|
||||
@@ -453,17 +403,16 @@ void resTable<T,ID>::traverse (pSetMFArg(pCB))
|
||||
// resTable<T,ID>::traverseConst
|
||||
//
|
||||
template <class T, class ID>
|
||||
void resTable<T,ID>::traverseConst (pSetMFArgConst(pCB)) const
|
||||
void resTable<T,ID>::traverseConst ( void (T::*pCB)() const ) const
|
||||
{
|
||||
const tsSLList<T> *pList;
|
||||
|
||||
pList = this->pTable;
|
||||
while ( pList < &this->pTable[this->hashIdMask+1] ) {
|
||||
tsSLIterConst<T> pItem ( pList->first () );
|
||||
tsSLIterConst<T> pItem = pList->firstIter ();
|
||||
while ( pItem.valid () ) {
|
||||
const T * p = & ( *pItem );
|
||||
pItem = pItem.itemAfter ();
|
||||
(p->*pCB) ();
|
||||
( pItem.pointer ()->*pCB ) ();
|
||||
pItem++;
|
||||
}
|
||||
pList++;
|
||||
}
|
||||
@@ -509,17 +458,15 @@ int resTable<T,ID>::add (T &res)
|
||||
template <class T, class ID>
|
||||
T *resTable<T,ID>::find (tsSLList<T> &list, const ID &idIn) const
|
||||
{
|
||||
tsSLIter <T> pItem ( list.first () );
|
||||
ID *pId;
|
||||
|
||||
tsSLIter <T> pItem = list.firstIter ();
|
||||
while ( pItem.valid () ) {
|
||||
pId = & (*pItem) ;
|
||||
if ( *pId == idIn ) {
|
||||
const ID &id = *pItem;
|
||||
if ( id == idIn ) {
|
||||
break;
|
||||
}
|
||||
pItem = pItem.itemAfter ();
|
||||
pItem++;
|
||||
}
|
||||
return & (*pItem);
|
||||
return pItem.pointer ();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -535,14 +482,13 @@ T *resTable<T,ID>::find (tsSLList<T> &list, const ID &idIn) const
|
||||
template <class T, class ID>
|
||||
T *resTable<T,ID>::findDelete (tsSLList<T> &list, const ID &idIn)
|
||||
{
|
||||
tsSLIter <T> pItem ( list.first () );
|
||||
tsSLIter <T> pPrev ( 0 );
|
||||
ID *pId;
|
||||
tsSLIter <T> pItem = list.firstIter ();
|
||||
T *pPrev = 0;
|
||||
|
||||
while ( pItem.valid () ) {
|
||||
pId = & (*pItem);
|
||||
if ( *pId == idIn ) {
|
||||
if ( pPrev.valid () ) {
|
||||
const ID &id = *pItem;
|
||||
if ( id == idIn ) {
|
||||
if ( pPrev ) {
|
||||
list.remove ( *pPrev );
|
||||
}
|
||||
else {
|
||||
@@ -551,10 +497,10 @@ T *resTable<T,ID>::findDelete (tsSLList<T> &list, const ID &idIn)
|
||||
this->nInUse--;
|
||||
break;
|
||||
}
|
||||
pPrev = pItem;
|
||||
pItem = pItem.itemAfter ();
|
||||
pPrev = pItem.pointer ();
|
||||
pItem++;
|
||||
}
|
||||
return & (*pItem);
|
||||
return pItem.pointer ();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -585,8 +531,8 @@ inline resTableIter<T,ID>::resTableIter (const resTable<T,ID> &tableIn) :
|
||||
template <class T, class ID>
|
||||
T * resTableIter<T,ID>::next ()
|
||||
{
|
||||
if ( this->iter.valid () ) {
|
||||
T *p = & (*this->iter);
|
||||
if ( this->iter ) {
|
||||
T *p = this->iter;
|
||||
this->iter++;
|
||||
return p;
|
||||
}
|
||||
@@ -595,8 +541,8 @@ T * resTableIter<T,ID>::next ()
|
||||
return 0;
|
||||
}
|
||||
this->iter = tsSLIter<T> ( this->table.pTable[this->index++].first () );
|
||||
if ( this->iter.valid () ) {
|
||||
T *p = & (*this->iter);
|
||||
if ( this->iter ) {
|
||||
T *p = this->iter;
|
||||
this->iter++;
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ int main ()
|
||||
|
||||
tsDLIterConstBD<jane> bdIter ( janeList.first () );
|
||||
i = 0;
|
||||
while ( bdIter != bdIter.eol () ) {
|
||||
while ( bdIter ) {
|
||||
i++;
|
||||
bdIter++;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ int main ()
|
||||
clk = clock();
|
||||
{
|
||||
tsSLIter <fred> iter ( list.first () );
|
||||
while ( iter.valid () ) {
|
||||
while ( iter ) {
|
||||
iter->inc ();
|
||||
iter++;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ int main ()
|
||||
|
||||
{
|
||||
tsSLIter<fred> iter ( list.first() );
|
||||
while ( iter.valid () ) {
|
||||
while ( iter ) {
|
||||
iter->show();
|
||||
++iter;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ int main ()
|
||||
|
||||
{
|
||||
tsSLIter<jane> iter ( janeList.first() );
|
||||
while ( iter.valid () ) {
|
||||
while ( iter ) {
|
||||
iter->show();
|
||||
++iter;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ int main ()
|
||||
|
||||
{
|
||||
tsSLIter <fred> iter ( list.first () );
|
||||
while ( iter.valid () ) {
|
||||
while ( iter ) {
|
||||
iter->show();
|
||||
iter++;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ int main ()
|
||||
|
||||
{
|
||||
tsSLIter<fred> iter (list.first());
|
||||
assert ( iter == tsSLIter<fred>::eol() );
|
||||
assert ( ! iter );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -52,18 +52,18 @@ template <class T> class tsDLBwdIter; // deprecated
|
||||
//
|
||||
template <class T>
|
||||
class tsDLNode {
|
||||
public:
|
||||
tsDLNode();
|
||||
tsDLNode <T> operator = (const tsDLNode<T> &) const;
|
||||
private:
|
||||
T *pNext;
|
||||
T *pPrev;
|
||||
friend class tsDLList<T>;
|
||||
friend class tsDLIterBD<T>;
|
||||
friend class tsDLIterConstBD<T>;
|
||||
friend class tsDLIter<T>; // deprecated
|
||||
friend class tsDLFwdIter<T>; // deprecated
|
||||
friend class tsDLBwdIter<T>; // deprecated
|
||||
public:
|
||||
tsDLNode();
|
||||
tsDLNode <T> operator = (const tsDLNode<T> &) const;
|
||||
private:
|
||||
T *pNext;
|
||||
T *pPrev;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -75,65 +75,34 @@ private:
|
||||
//
|
||||
template <class T>
|
||||
class tsDLList {
|
||||
public:
|
||||
tsDLList (); // create empty list
|
||||
unsigned count () const; // number of items on list
|
||||
void add ( T &item ); // add item to end of list
|
||||
void add ( tsDLList<T> &addList ); // add to end of list - addList left empty
|
||||
void push ( T &item ); // add item to beginning of list
|
||||
void remove ( T &item ); // remove item from list
|
||||
T * get (); // removes first item on list
|
||||
T * pop (); // same as get ()
|
||||
void insertAfter ( T &item, T &itemBefore ); // insert item immediately after itemBefore
|
||||
void insertBefore ( T &item, T &itemAfter ); // insert item immediately before itemAfter
|
||||
int find (const T &item) const; // returns -1 if not present, node number if present
|
||||
T *first (void) const; // ptr to first item on list
|
||||
T *last (void) const; // ptr to last item on list
|
||||
tsDLIterConstBD <T> firstIter () const;
|
||||
tsDLIterBD <T> firstIter ();
|
||||
tsDLIterConstBD <T> lastIter () const;
|
||||
tsDLIterBD <T> lastIter ();
|
||||
private:
|
||||
T *pFirst;
|
||||
T *pLast;
|
||||
unsigned itemCount;
|
||||
void clear ();
|
||||
tsDLList (const tsDLList &); // not allowed
|
||||
const tsDLList <T> & operator = ( const tsDLList <T> & ); // not allowed
|
||||
friend class tsDLIter<T>; // deprecated
|
||||
friend class tsDLFwdIter<T>; // deprecated
|
||||
friend class tsDLBwdIter<T>; // deprecated
|
||||
public:
|
||||
|
||||
tsDLList (); // create empty list
|
||||
|
||||
unsigned count () const; // number of items on list
|
||||
|
||||
void add (T &item); // add item to end of list
|
||||
|
||||
// all Ts in addList added to end of list
|
||||
// (addList left empty)
|
||||
void add (tsDLList<T> &addList);
|
||||
|
||||
void push (T &item); // add item to beginning of list
|
||||
|
||||
// remove item from list
|
||||
void remove (T &item);
|
||||
|
||||
T * get (); // removes first item on list
|
||||
T * pop (); // same as get ()
|
||||
|
||||
// insert item in the list immediately after itemBefore
|
||||
void insertAfter (T &item, T &itemBefore);
|
||||
|
||||
// insert item in the list immediately before itemAfter)
|
||||
void insertBefore (T &item, T &itemAfter);
|
||||
|
||||
//
|
||||
// returns -1 if the item isnt on the list and the node
|
||||
// number (beginning with zero if it is)
|
||||
//
|
||||
int find (const T &item) const;
|
||||
|
||||
T *first (void) const; // ptr to first item on list
|
||||
T *last (void) const; // ptr to last item on list
|
||||
|
||||
private:
|
||||
T *pFirst;
|
||||
T *pLast;
|
||||
unsigned itemCount;
|
||||
|
||||
//
|
||||
// create empty list
|
||||
// (throw away any knowledge of current list)
|
||||
//
|
||||
void clear ();
|
||||
|
||||
//
|
||||
// copying one list item into another and
|
||||
// ending up with to list headers pointing
|
||||
// at the same list is always a questionable
|
||||
// thing to do.
|
||||
//
|
||||
// therefore, this is intentionally private
|
||||
// and _not_ implemented.
|
||||
//
|
||||
tsDLList (const tsDLList &);
|
||||
};
|
||||
|
||||
//
|
||||
@@ -144,40 +113,24 @@ private:
|
||||
template <class T>
|
||||
class tsDLIterConstBD {
|
||||
public:
|
||||
tsDLIterConstBD (const T *pInitialEntry);
|
||||
|
||||
tsDLIterConstBD<T> & operator = (const T *pNewEntry);
|
||||
|
||||
tsDLIterConstBD<T> itemAfter ();
|
||||
tsDLIterConstBD<T> itemBefore ();
|
||||
|
||||
bool valid () const;
|
||||
bool operator == (const tsDLIterConstBD<T> &rhs) const;
|
||||
bool operator != (const tsDLIterConstBD<T> &rhs) const;
|
||||
|
||||
const T & operator * () const;
|
||||
const T * operator -> () const;
|
||||
|
||||
tsDLIterConstBD<T> operator ++ (); // prefix ++
|
||||
tsDLIterConstBD<T> operator ++ (int); // postfix ++
|
||||
tsDLIterConstBD<T> operator -- (); // prefix --
|
||||
tsDLIterConstBD<T> operator -- (int); // postfix --
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
tsDLIterConstBD (const class tsDLIterConstBD<T> ©In);
|
||||
# endif
|
||||
|
||||
bool valid () const;
|
||||
|
||||
//
|
||||
// end of the list constant
|
||||
//
|
||||
static const tsDLIterConstBD<T> eol ();
|
||||
|
||||
tsDLIterConstBD<T> operator ++ ();
|
||||
tsDLIterConstBD<T> operator ++ (int);
|
||||
tsDLIterConstBD<T> operator -- ();
|
||||
tsDLIterConstBD<T> operator -- (int);
|
||||
const T * pointer () const;
|
||||
protected:
|
||||
union {
|
||||
const T *pConstEntry;
|
||||
T *pEntry;
|
||||
};
|
||||
tsDLIterConstBD ( const T *pInitialEntry );
|
||||
private:
|
||||
friend class tsDLList <T>;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -188,37 +141,19 @@ protected:
|
||||
template <class T>
|
||||
class tsDLIterBD : private tsDLIterConstBD<T> {
|
||||
public:
|
||||
tsDLIterBD (T *pInitialEntry);
|
||||
|
||||
tsDLIterBD<T> & operator = (T *pNewEntry);
|
||||
|
||||
tsDLIterBD<T> itemAfter ();
|
||||
tsDLIterBD<T> itemBefore ();
|
||||
|
||||
bool valid () const;
|
||||
bool operator == (const tsDLIterBD<T> &rhs) const;
|
||||
bool operator != (const tsDLIterBD<T> &rhs) const;
|
||||
|
||||
T & operator * () const;
|
||||
T * operator -> () const;
|
||||
|
||||
tsDLIterBD<T> operator ++ (); // prefix ++
|
||||
|
||||
tsDLIterBD<T> operator ++ (int); // postfix ++
|
||||
|
||||
tsDLIterBD<T> operator -- (); // prefix --
|
||||
|
||||
tsDLIterBD<T> operator -- (int); // postfix --
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
tsDLIterBD (const class tsDLIterBD<T> ©In);
|
||||
# endif
|
||||
|
||||
bool valid () const;
|
||||
|
||||
//
|
||||
// end of the list constant
|
||||
//
|
||||
static const tsDLIterBD<T> eol ();
|
||||
tsDLIterBD<T> operator ++ ();
|
||||
tsDLIterBD<T> operator ++ (int);
|
||||
tsDLIterBD<T> operator -- ();
|
||||
tsDLIterBD<T> operator -- (int);
|
||||
T * pointer () const;
|
||||
private:
|
||||
tsDLIterBD ( T *pInitialEntry );
|
||||
friend class tsDLList <T>;
|
||||
};
|
||||
|
||||
///////////////////////////////////
|
||||
@@ -238,19 +173,10 @@ inline tsDLNode<T>::tsDLNode() : pNext(0), pPrev(0) {}
|
||||
// do _not_ change the node pointers
|
||||
//
|
||||
template <class T>
|
||||
inline tsDLNode<T> tsDLNode<T>::operator = (const tsDLNode<T> &) const { return tsDLNode<T>(); }
|
||||
|
||||
//template <class T>
|
||||
//T * tsDLNode<T>::getNext (void) const
|
||||
//{
|
||||
// return pNext;
|
||||
//}
|
||||
|
||||
//template <class T>
|
||||
//T * tsDLNode<T>::getPrev (void) const
|
||||
//{
|
||||
// return pPrev;
|
||||
//}
|
||||
inline tsDLNode<T> tsDLNode<T>::operator = (const tsDLNode<T> &) const
|
||||
{
|
||||
return tsDLNode<T>();
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// tsDLList<T> member functions
|
||||
@@ -515,7 +441,7 @@ int tsDLList < T > :: find ( const T &item ) const
|
||||
tsDLIterConstBD < T > iter ( this->first () );
|
||||
int itemNo = 0;
|
||||
|
||||
while ( iter.valid () ) {
|
||||
while ( iter ) {
|
||||
if ( iter == thisItem ) {
|
||||
return itemNo;
|
||||
}
|
||||
@@ -525,31 +451,41 @@ int tsDLList < T > :: find ( const T &item ) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsDLIterConstBD <T> tsDLList < T > :: firstIter () const
|
||||
{
|
||||
return tsDLIterConstBD < T > ( this->pFirst );
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsDLIterBD <T> tsDLList < T > :: firstIter ()
|
||||
{
|
||||
return tsDLIterBD < T > ( this->pFirst );
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsDLIterConstBD <T> tsDLList < T > :: lastIter () const
|
||||
{
|
||||
return tsDLIterConstBD < T > ( this->pLast );
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsDLIterBD <T> tsDLList < T > :: lastIter ()
|
||||
{
|
||||
return tsDLIterBD < T > ( this->pLast );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
// tsDLIterConstBD<T> member functions
|
||||
//////////////////////////////////////////
|
||||
template <class T>
|
||||
inline tsDLIterConstBD<T>::tsDLIterConstBD (const T * pInitialEntry) :
|
||||
pConstEntry (pInitialEntry) {}
|
||||
|
||||
//
|
||||
// This is apparently required by some compiler, but
|
||||
// only causes trouble with MS Visual C 6.0. This
|
||||
// should not be required by any compiler. I am assuming
|
||||
// that this "some compiler" is a past version of MS
|
||||
// Visual C.
|
||||
//
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
template <class T>
|
||||
inline tsDLIterConstBD<T>::tsDLIterConstBD (const class tsDLIterBD<T> ©In) :
|
||||
pConstEntry (copyIn.pEntry) {}
|
||||
# endif
|
||||
inline tsDLIterConstBD<T>::tsDLIterConstBD ( const T *pInitialEntry ) :
|
||||
pConstEntry ( pInitialEntry ) {}
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterConstBD<T> & tsDLIterConstBD<T>::operator = (const T *pNewEntry)
|
||||
inline bool tsDLIterConstBD<T>::valid () const
|
||||
{
|
||||
this->pConstEntry = pNewEntry;
|
||||
return *this;
|
||||
return this->pConstEntry != 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -576,20 +512,6 @@ inline const T * tsDLIterConstBD<T>::operator -> () const
|
||||
return this->pConstEntry;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterConstBD<T> tsDLIterConstBD<T>::itemAfter ()
|
||||
{
|
||||
const tsDLNode<T> &node = *this->pConstEntry;
|
||||
return tsDLIterConstBD<T> (node.pNext);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterConstBD<T> tsDLIterConstBD<T>::itemBefore ()
|
||||
{
|
||||
const tsDLNode<T> &node = *this->pConstEntry;
|
||||
return tsDLIterConstBD<T> (node.pPrev);
|
||||
}
|
||||
|
||||
//
|
||||
// prefix ++
|
||||
//
|
||||
@@ -637,18 +559,9 @@ inline tsDLIterConstBD<T> tsDLIterConstBD<T>::operator -- (int)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool tsDLIterConstBD<T>::valid () const
|
||||
inline const T * tsDLIterConstBD<T>::pointer () const
|
||||
{
|
||||
return this->pEntry ? true : false;
|
||||
}
|
||||
|
||||
//
|
||||
// tsDLIterConstBD<T>::eol
|
||||
//
|
||||
template <class T>
|
||||
inline const tsDLIterConstBD<T> tsDLIterConstBD<T>::eol ()
|
||||
{
|
||||
return tsDLIterConstBD<T>(0);
|
||||
return this->pConstEntry;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
@@ -656,27 +569,13 @@ inline const tsDLIterConstBD<T> tsDLIterConstBD<T>::eol ()
|
||||
//////////////////////////////////////////
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterBD<T>::tsDLIterBD (T * pInitialEntry) :
|
||||
tsDLIterConstBD<T> (pInitialEntry) {}
|
||||
|
||||
//
|
||||
// This is apparently required by some compiler, but
|
||||
// only causes trouble with MS Visual C 6.0. This
|
||||
// should not be required by any compiler. I am assuming
|
||||
// that this "some compiler" is a past version of MS
|
||||
// Visual C.
|
||||
//
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
template <class T>
|
||||
inline tsDLIterBD<T>::tsDLIterBD (const class tsDLIterBD<T> ©In) :
|
||||
tsDLIterConstBD (copyIn) {}
|
||||
# endif
|
||||
inline tsDLIterBD<T>::tsDLIterBD ( T * pInitialEntry ) :
|
||||
tsDLIterConstBD<T> ( pInitialEntry ) {}
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterBD<T> & tsDLIterBD<T>::operator = (T *pNewEntry)
|
||||
inline bool tsDLIterBD<T>::valid () const
|
||||
{
|
||||
tsDLIterConstBD<T>::operator = (pNewEntry);
|
||||
return *this;
|
||||
return this->pEntry != 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -703,32 +602,6 @@ inline T * tsDLIterBD<T>::operator -> () const
|
||||
return this->pEntry;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterBD<T> tsDLIterBD<T>::itemAfter ()
|
||||
{
|
||||
tsDLNode<T> &node = *this->pEntry;
|
||||
return tsDLIterBD<T> (node.pNext);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterBD<T> tsDLIterBD<T>::itemBefore ()
|
||||
{
|
||||
tsDLNode<T> &node = *this->pEntry;
|
||||
return tsDLIterBD<T> (node.pPrev);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool tsDLIterBD<T>::valid () const
|
||||
{
|
||||
return this->pEntry ? true : false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const tsDLIterBD<T> tsDLIterBD<T>::eol ()
|
||||
{
|
||||
return tsDLIterBD<T>(0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline tsDLIterBD<T> tsDLIterBD<T>::operator ++ () // prefix ++
|
||||
{
|
||||
@@ -759,6 +632,12 @@ inline tsDLIterBD<T> tsDLIterBD<T>::operator -- (int) // postfix --
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T * tsDLIterBD<T>::pointer () const
|
||||
{
|
||||
return this->pEntry;
|
||||
}
|
||||
|
||||
#include "tsDLListDeprecated.h"
|
||||
|
||||
#endif // tsDLListH_include
|
||||
|
||||
@@ -54,16 +54,16 @@ template < class T > class tsSLIterConst;
|
||||
//
|
||||
template <class T>
|
||||
class tsSLNode {
|
||||
friend class tsSLList < T >;
|
||||
friend class tsSLIter < T >;
|
||||
friend class tsSLIterConst < T >;
|
||||
public:
|
||||
tsSLNode ();
|
||||
const tsSLNode < T > & operator = ( const tsSLNode < T > & ) const;
|
||||
private:
|
||||
tsSLNode ( const tsSLNode < T > & );
|
||||
void removeNextItem (); // removes the item after this node
|
||||
T *pNext;
|
||||
tsSLNode ( const tsSLNode < T > & );
|
||||
friend class tsSLList < T >;
|
||||
friend class tsSLIter < T >;
|
||||
friend class tsSLIterConst < T >;
|
||||
};
|
||||
|
||||
|
||||
@@ -82,8 +82,11 @@ public:
|
||||
void push ( T &item ); // same as add
|
||||
T * first () const;
|
||||
void remove ( T &itemBefore );
|
||||
tsSLIterConst <T> firstIter () const;
|
||||
tsSLIter <T> firstIter ();
|
||||
private:
|
||||
tsSLList ( const tsSLList & ); // intentionally _not_ implemented
|
||||
tsSLList ( const tsSLList & ); // dissallowed
|
||||
const tsSLList < T > & operator = ( const tsSLList < T > & ) const;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -92,37 +95,21 @@ private:
|
||||
template < class T >
|
||||
class tsSLIterConst {
|
||||
public:
|
||||
tsSLIterConst ( const T *pInitialEntry );
|
||||
|
||||
tsSLIterConst<T> & operator = ( const T *pNewEntry );
|
||||
|
||||
tsSLIterConst<T> itemAfter ();
|
||||
|
||||
bool valid () const;
|
||||
bool operator == (const tsSLIterConst<T> &rhs) const;
|
||||
bool operator != (const tsSLIterConst<T> &rhs) const;
|
||||
|
||||
const T & operator * () const;
|
||||
const T * operator -> () const;
|
||||
|
||||
tsSLIterConst<T> & operator ++ (); // prefix ++
|
||||
tsSLIterConst<T> operator ++ (int); // postfix ++
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
tsSLIterConst (const class tsSLIterConst<T> ©In);
|
||||
# endif
|
||||
|
||||
bool valid () const;
|
||||
|
||||
//
|
||||
// end of the list constant
|
||||
//
|
||||
static const tsSLIterConst<T> eol ();
|
||||
|
||||
tsSLIterConst<T> & operator ++ ();
|
||||
tsSLIterConst<T> operator ++ (int);
|
||||
const T * pointer () const;
|
||||
protected:
|
||||
union {
|
||||
const T *pConstEntry;
|
||||
T *pEntry;
|
||||
};
|
||||
tsSLIterConst ( const T *pInitialEntry );
|
||||
friend class tsSLList < T >;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -131,31 +118,17 @@ protected:
|
||||
template < class T >
|
||||
class tsSLIter : private tsSLIterConst<T> {
|
||||
public:
|
||||
tsSLIter ( T *pInitialEntry );
|
||||
|
||||
tsSLIter <T> & operator = ( T *pNewEntry );
|
||||
|
||||
tsSLIter <T> itemAfter ();
|
||||
|
||||
bool valid () const;
|
||||
bool operator == (const tsSLIter<T> &rhs) const;
|
||||
bool operator != (const tsSLIter<T> &rhs) const;
|
||||
|
||||
T & operator * () const;
|
||||
T * operator -> () const;
|
||||
|
||||
tsSLIter <T> & operator ++ (); // prefix ++
|
||||
tsSLIter <T> operator ++ (int); // postfix ++
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
tsSLIter (class tsSLIter<T> ©In);
|
||||
# endif
|
||||
|
||||
bool valid () const;
|
||||
|
||||
//
|
||||
// end of the list constant
|
||||
//
|
||||
static const tsSLIter <T> eol ();
|
||||
tsSLIter <T> & operator ++ ();
|
||||
tsSLIter <T> operator ++ (int);
|
||||
T * pointer () const;
|
||||
private:
|
||||
tsSLIter ( T *pInitialEntry );
|
||||
friend class tsSLList < T >;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////
|
||||
@@ -272,13 +245,27 @@ inline T * tsSLList < T > :: first () const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void tsSLList < T > :: remove ( T &itemBefore )
|
||||
inline void tsSLList < T > :: remove ( T &itemBefore )
|
||||
{
|
||||
tsSLNode < T > *pBeforeNode = &itemBefore;
|
||||
tsSLNode < T > *pAfterNode = pBeforeNode->pNext;
|
||||
pBeforeNode->pNext = pAfterNode->pNext;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline tsSLIterConst <T> tsSLList < T > :: firstIter () const
|
||||
{
|
||||
const tsSLNode < T > *pThisNode = this;
|
||||
return tsSLIterConst <T> ( pThisNode->pNext );
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline tsSLIter <T> tsSLList < T > :: firstIter ()
|
||||
{
|
||||
tsSLNode < T > *pThisNode = this;
|
||||
return tsSLIter <T> ( pThisNode->pNext );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
//
|
||||
// tsSLIterConst<T> inline member functions
|
||||
@@ -292,17 +279,9 @@ inline tsSLIterConst<T>::tsSLIterConst ( const T *pInitialEntry ) :
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsSLIterConst <T> & tsSLIterConst<T>::operator = ( const T *pNewEntry )
|
||||
inline bool tsSLIterConst<T>::valid () const
|
||||
{
|
||||
this->pConstEntry = pNewEntry;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsSLIterConst <T> tsSLIterConst<T>::itemAfter ()
|
||||
{
|
||||
const tsSLNode < T > *pCurNode = this->pConstEntry;
|
||||
return pCurNode->pNext;
|
||||
return this->pConstEntry != 0;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
@@ -346,28 +325,10 @@ inline tsSLIterConst<T> tsSLIterConst<T>::operator ++ (int) // postfix ++
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
template < class T >
|
||||
inline tsSLIterConst<T>::tsSLIterConst (const class tsSLIterConst<T> ©In) :
|
||||
pConstEntry ( copyIn.pConstEntry )
|
||||
template <class T>
|
||||
inline const T * tsSLIterConst < T > :: pointer () const
|
||||
{
|
||||
}
|
||||
# endif
|
||||
|
||||
template < class T >
|
||||
inline bool tsSLIterConst<T>::valid () const
|
||||
{
|
||||
return this->pConstEntry ? true : false;
|
||||
}
|
||||
|
||||
//
|
||||
// end of the list constant
|
||||
//
|
||||
template < class T >
|
||||
inline const tsSLIterConst<T> tsSLIterConst<T>::eol ()
|
||||
{
|
||||
return 0;
|
||||
return this->pConstEntry;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
@@ -383,17 +344,9 @@ inline tsSLIter<T>::tsSLIter ( T *pInitialEntry ) :
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsSLIter <T> & tsSLIter<T>::operator = ( T *pNewEntry )
|
||||
inline bool tsSLIter<T>::valid () const
|
||||
{
|
||||
tsSLIterConst<T>::operator = ( pNewEntry );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
inline tsSLIter <T> tsSLIter<T>::itemAfter ()
|
||||
{
|
||||
tsSLNode < T > *pCurNode = this->pEntry;
|
||||
return pCurNode->pNext;
|
||||
return this->pEntry != 0;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
@@ -435,29 +388,10 @@ inline tsSLIter<T> tsSLIter<T>::operator ++ (int) // postfix ++
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER < 1200
|
||||
template < class T >
|
||||
inline tsSLIter<T>::tsSLIter (const class tsSLIter<T> ©In) :
|
||||
tsSLIterConst<T> ( copyIn )
|
||||
template <class T>
|
||||
inline T * tsSLIter < T > :: pointer () const
|
||||
{
|
||||
return this->pEntry;
|
||||
}
|
||||
# endif
|
||||
|
||||
template < class T >
|
||||
inline bool tsSLIter<T>::valid () const
|
||||
{
|
||||
return this->pEntry ? true : false;
|
||||
}
|
||||
|
||||
//
|
||||
// end of the list constant
|
||||
//
|
||||
template < class T >
|
||||
inline const tsSLIter<T> tsSLIter<T>::eol ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // tsSLListh
|
||||
|
||||
@@ -163,7 +163,7 @@ epicsShareFunc void fdManager::process (double delay)
|
||||
minDelay = delay;
|
||||
}
|
||||
|
||||
tsDLIterBD<fdReg> iter (this->regList.first());
|
||||
tsDLIterBD < fdReg > iter = this->regList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
FD_SET(iter->getFD(), &this->fdSets[iter->getType()]);
|
||||
ioPending = 1;
|
||||
@@ -216,7 +216,7 @@ epicsShareFunc void fdManager::process (double delay)
|
||||
//
|
||||
// Look for activity
|
||||
//
|
||||
iter=this->regList.first();
|
||||
iter=this->regList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
tsDLIterBD<fdReg> tmp = iter;
|
||||
tmp++;
|
||||
|
||||
@@ -97,9 +97,10 @@ void ipAddrToAsciiEngine::show ( unsigned level ) const
|
||||
printf ( "ipAddrToAsciiEngine at %p with %u requests pendingh\n",
|
||||
this, this->labor.count () );
|
||||
if ( level > 0u ) {
|
||||
tsDLIterConstBD < ipAddrToAsciiAsynchronous > pItem = this->labor.first ();
|
||||
tsDLIterConstBD < ipAddrToAsciiAsynchronous > pItem = this->labor.firstIter ();
|
||||
while ( pItem.valid () ) {
|
||||
pItem->show ( level - 1u );
|
||||
pItem++;
|
||||
}
|
||||
printf ( "nextId = %u\n", this->nextId );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user