Replaced dbAddr with dbChannel in all CA-server related code
* Routines with a db_access interface are named dbChannel_xxx * Using dbch for member variable names in Jeff's code It seems to work! TODO: Make dbChannel use a freelist
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
@@ -30,11 +30,11 @@ dbContextReadNotifyCache::dbContextReadNotifyCache ( epicsMutex & mutexIn ) :
|
||||
|
||||
class privateAutoDestroyPtr {
|
||||
public:
|
||||
privateAutoDestroyPtr (
|
||||
privateAutoDestroyPtr (
|
||||
dbContextReadNotifyCacheAllocator & allocator, unsigned long size ) :
|
||||
_allocator ( allocator ), _p ( allocator.alloc ( size ) ) {}
|
||||
~privateAutoDestroyPtr () { _allocator.free ( _p ); }
|
||||
char * get () const { return _p; }
|
||||
char * get () const { return _p; }
|
||||
private:
|
||||
dbContextReadNotifyCacheAllocator & _allocator;
|
||||
char * _p;
|
||||
@@ -43,28 +43,28 @@ private:
|
||||
};
|
||||
|
||||
// extra effort taken here to not hold the lock when calling the callback
|
||||
void dbContextReadNotifyCache::callReadNotify (
|
||||
epicsGuard < epicsMutex > & guard, struct dbAddr & addr,
|
||||
void dbContextReadNotifyCache::callReadNotify (
|
||||
epicsGuard < epicsMutex > & guard, struct dbChannel * dbch,
|
||||
unsigned type, unsigned long count, cacReadNotify & notify )
|
||||
{
|
||||
guard.assertIdenticalMutex ( _mutex );
|
||||
|
||||
if ( type > INT_MAX ) {
|
||||
notify.exception ( guard, ECA_BADTYPE,
|
||||
"type code out of range (high side)",
|
||||
notify.exception ( guard, ECA_BADTYPE,
|
||||
"type code out of range (high side)",
|
||||
type, count );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( addr.no_elements < 0 ) {
|
||||
notify.exception ( guard, ECA_BADCOUNT,
|
||||
if ( dbChannelElements(dbch) < 0 ) {
|
||||
notify.exception ( guard, ECA_BADCOUNT,
|
||||
"database has negetive element count",
|
||||
type, count);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( count > static_cast < unsigned > ( addr.no_elements ) ) {
|
||||
notify.exception ( guard, ECA_BADCOUNT,
|
||||
if ( count > static_cast < unsigned long > ( dbChannelElements(dbch) ) ) {
|
||||
notify.exception ( guard, ECA_BADCOUNT,
|
||||
"element count out of range (high side)",
|
||||
type, count);
|
||||
return;
|
||||
@@ -75,21 +75,21 @@ void dbContextReadNotifyCache::callReadNotify (
|
||||
int status;
|
||||
{
|
||||
epicsGuardRelease < epicsMutex > unguard ( guard );
|
||||
status = db_get_field ( &addr, static_cast <int> ( type ),
|
||||
ptr.get (), static_cast <int> ( count ), 0 );
|
||||
status = dbChannel_get ( dbch, static_cast <int> ( type ),
|
||||
ptr.get (), static_cast <long> ( count ), 0 );
|
||||
}
|
||||
if ( status ) {
|
||||
notify.exception ( guard, ECA_GETFAIL,
|
||||
notify.exception ( guard, ECA_GETFAIL,
|
||||
"db_get_field() completed unsuccessfuly",
|
||||
type, count );
|
||||
}
|
||||
else {
|
||||
notify.completion (
|
||||
else {
|
||||
notify.completion (
|
||||
guard, type, count, ptr.get () );
|
||||
}
|
||||
}
|
||||
|
||||
void dbContextReadNotifyCache::show (
|
||||
void dbContextReadNotifyCache::show (
|
||||
epicsGuard < epicsMutex > & guard, unsigned level ) const
|
||||
{
|
||||
guard.assertIdenticalMutex ( _mutex );
|
||||
@@ -155,8 +155,8 @@ void dbContextReadNotifyCacheAllocator::show ( unsigned level ) const
|
||||
pNext = _pReadNotifyCache->pNext;
|
||||
count++;
|
||||
}
|
||||
printf ( "\tcount %lu and size %lu\n",
|
||||
static_cast < unsigned long > ( count ),
|
||||
printf ( "\tcount %lu and size %lu\n",
|
||||
static_cast < unsigned long > ( count ),
|
||||
_readNotifyCacheSize );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user