optimizations

This commit is contained in:
Jeff Hill
2003-02-12 23:54:34 +00:00
parent 90cf8344c2
commit 87aca7838e
13 changed files with 174 additions and 182 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ inline void caServerI::unlock () const
}
inline casMonEvent & caServerI::casMonEventFactory ( casMonitor & monitor,
const smartConstGDDPointer & pNewValue )
const gdd & pNewValue )
{
return * new ( this->casMonEventFreeList ) casMonEvent ( monitor, pNewValue );
}
+2 -2
View File
@@ -63,13 +63,13 @@ caStatus casAsyncReadIOI::cbFuncAsyncIO ()
case CA_PROTO_READ_NOTIFY:
status = client.readNotifyResponse ( &this->chan,
this->msg, this->pDD,
this->msg, *this->pDD,
this->completionStatus);
break;
case CA_PROTO_EVENT_ADD:
status = client.monitorResponse ( this->chan,
this->msg, this->pDD,
this->msg, *this->pDD,
this->completionStatus);
break;
+4 -4
View File
@@ -70,12 +70,12 @@ caStatus casCoreClient::createChanResponse ( const caHdrLargeArray &, const pvAt
return S_casApp_noSupport;
}
caStatus casCoreClient::readResponse ( casChannelI *, const caHdrLargeArray &,
const smartConstGDDPointer &, const caStatus )
const gdd &, const caStatus )
{
return S_casApp_noSupport;
}
caStatus casCoreClient::readNotifyResponse ( casChannelI *, const caHdrLargeArray &,
const smartConstGDDPointer &, const caStatus )
const gdd &, const caStatus )
{
return S_casApp_noSupport;
}
@@ -90,7 +90,7 @@ caStatus casCoreClient::writeNotifyResponse ( casChannelI &,
return S_casApp_noSupport;
}
caStatus casCoreClient::monitorResponse ( casChannelI &, const caHdrLargeArray &,
const smartConstGDDPointer &, const caStatus )
const gdd &, const caStatus )
{
return S_casApp_noSupport;
}
@@ -132,7 +132,7 @@ void casCoreClient::eventSignal()
}
caStatus casCoreClient::casMonitorCallBack ( casMonitor &,
const smartConstGDDPointer & )
const gdd & )
{
return S_cas_internal;
}
+4 -4
View File
@@ -57,16 +57,16 @@ public:
const caHdrLargeArray &, const pvAttachReturn &);
virtual caStatus readResponse (
casChannelI *, const caHdrLargeArray &,
const smartConstGDDPointer &, const caStatus );
const gdd &, const caStatus );
virtual caStatus readNotifyResponse (
casChannelI *, const caHdrLargeArray &,
const smartConstGDDPointer &, const caStatus );
const gdd &, const caStatus );
virtual caStatus writeResponse ( casChannelI &,
const caHdrLargeArray &, const caStatus );
virtual caStatus writeNotifyResponse ( casChannelI &,
const caHdrLargeArray &, const caStatus );
virtual caStatus monitorResponse ( casChannelI &,
const caHdrLargeArray &, const smartConstGDDPointer &,
const caHdrLargeArray &, const gdd &,
const caStatus status );
virtual caStatus accessRightsResponse ( casChannelI * );
virtual caStatus enumPostponedCreateChanResponse (
@@ -97,7 +97,7 @@ public:
void enableEvents ();
void disableEvents ();
caStatus casMonitorCallBack ( casMonitor &,
const smartConstGDDPointer & );
const gdd & );
void postEvent ( tsDLList <casMonitor > &,
const casEventMask &select, const gdd &event );
+1 -1
View File
@@ -51,7 +51,7 @@ inline bool casCoreClient::okToStartAsynchIO ()
}
inline casMonEvent & casCoreClient::casMonEventFactory ( casMonitor & monitor,
const smartConstGDDPointer & pNewValue )
const gdd & pNewValue )
{
return this->ctx.getServer()->casMonEventFactory ( monitor, pNewValue );
}
+1 -1
View File
@@ -26,7 +26,7 @@ caStatus casMonEvent::cbFunc (
casCoreClient & client, epicsGuard < epicsMutex > & guard )
{
return this->monitor.executeEvent (
client, * this, this->pValue, guard );
client, * this, *this->pValue, guard );
}
void casMonEvent::assign ( const gdd & valueIn )
+1
View File
@@ -25,6 +25,7 @@
#endif
#include "tsFreeList.h"
#include "smartGDDPointer.h"
#ifdef epicsExportSharedSymbols_casMonEventh
# define epicsExportSharedSymbols
+3 -5
View File
@@ -46,7 +46,7 @@ casMonitor::~casMonitor()
}
caStatus casMonitor::response ( casCoreClient & client,
const smartConstGDDPointer & value )
const gdd & value )
{
if ( this->pChannel ) {
// reconstruct request header
@@ -101,15 +101,13 @@ void casMonitor::installNewEventLog (
}
caStatus casMonitor::executeEvent ( casCoreClient & client,
casMonEvent & ev, smartConstGDDPointer & pValue,
casMonEvent & ev, const gdd & value,
epicsGuard < epicsMutex > & guard )
{
assert ( pValue.valid() );
if ( this->pChannel ) {
epicsGuardRelease < epicsMutex > unguard ( guard );
caStatus status = this->callBackIntf.casMonitorCallBack (
*this, pValue );
*this, value );
if ( status != S_cas_success ) {
return status;
}
+3 -3
View File
@@ -39,7 +39,7 @@
class casMonitorCallbackInterface { // X aCC 655
public:
virtual caStatus casMonitorCallBack ( class casMonitor &,
const smartConstGDDPointer & pValue ) = 0;
const gdd & ) = 0;
};
class casEvent;
@@ -56,11 +56,11 @@ public:
tsDLList < casEvent > & eventLogQue,
casMonEvent * pLog, const gdd & event );
caStatus response ( casCoreClient & client,
const smartConstGDDPointer & value );
const gdd & value );
void show ( unsigned level ) const;
bool selected ( const casEventMask & select ) const;
caStatus executeEvent ( casCoreClient &,
casMonEvent &, smartConstGDDPointer &,
casMonEvent &, const gdd &,
epicsGuard < epicsMutex > & );
bool matchingClientId ( caResId clientIdIn ) const;
unsigned numEventsQueued () const;
+114 -122
View File
@@ -143,10 +143,10 @@ void casStrmClient::show ( unsigned level ) const
*/
caStatus casStrmClient::readAction ()
{
const caHdrLargeArray *mp = this->ctx.getMsg();
const caHdrLargeArray * mp = this->ctx.getMsg();
caStatus status;
casChannelI *pChan;
smartGDDPointer pDesc;
casChannelI * pChan;
const gdd * pDesc;
status = this->verifyRequest ( pChan );
if ( status != ECA_NORMAL ) {
@@ -193,6 +193,10 @@ caStatus casStrmClient::readAction ()
pChan->getCID(), status, ECA_GETFAIL );
}
if ( pDesc ) {
pDesc->unreference ();
}
return status;
}
@@ -200,7 +204,7 @@ caStatus casStrmClient::readAction ()
// casStrmClient::readResponse()
//
caStatus casStrmClient::readResponse ( casChannelI * pChan, const caHdrLargeArray & msg,
const smartConstGDDPointer & pDesc, const caStatus status )
const gdd & desc, const caStatus status )
{
if ( status != S_casApp_success ) {
return this->sendErrWithEpicsStatus ( & msg,
@@ -229,9 +233,9 @@ caStatus casStrmClient::readResponse ( casChannelI * pChan, const caHdrLargeArra
// (places the data in network format)
//
int mapDBRStatus = gddMapDbr[msg.m_dataType].conv_dbr(
pPayload, msg.m_count, *pDesc, pChan->enumStringTable() );
pPayload, msg.m_count, desc, pChan->enumStringTable() );
if ( mapDBRStatus < 0 ) {
pDesc->dump ();
desc.dump ();
errPrintf ( S_cas_badBounds, __FILE__, __LINE__, "- get with PV=%s type=%u count=%u",
pChan->getPVI().getName(), msg.m_dataType, msg.m_count );
return this->sendErrWithEpicsStatus (
@@ -258,9 +262,9 @@ caStatus casStrmClient::readResponse ( casChannelI * pChan, const caHdrLargeArra
caStatus casStrmClient::readNotifyAction ()
{
const caHdrLargeArray * mp = this->ctx.getMsg();
int status;
casChannelI * pChan;
smartGDDPointer pDesc;
const gdd * pDesc;
int status;
status = this->verifyRequest ( pChan );
if ( status != ECA_NORMAL ) {
@@ -271,17 +275,12 @@ caStatus casStrmClient::readNotifyAction ()
// verify read access
//
if ( ! pChan->readAccess() ) {
if ( CA_V41 ( this->minor_version_number ) ) {
return this->readNotifyFailureResponse ( *mp, ECA_NORDACCESS );
}
else {
return this->readNotifyResponse ( NULL, *mp, NULL, S_cas_noRead );
}
return this->readNotifyFailureResponse ( *mp, ECA_NORDACCESS );
}
status = this->read ( pDesc );
if ( status == S_casApp_success ) {
status = this->readNotifyResponse ( pChan, *mp, pDesc, status );
status = this->readNotifyResponse ( pChan, *mp, *pDesc, status );
}
else if ( status == S_casApp_asyncCompletion ) {
status = S_cas_success;
@@ -290,9 +289,13 @@ caStatus casStrmClient::readNotifyAction ()
pChan->getPVI().addItemToIOBLockedList ( *this );
}
else {
status = this->readNotifyResponse ( pChan, *mp, pDesc, status );
status = this->readNotifyResponse ( pChan, *mp, *pDesc, status );
}
if ( pDesc ) {
pDesc->unreference ();
}
return status;
}
@@ -300,7 +303,7 @@ caStatus casStrmClient::readNotifyAction ()
// casStrmClient::readNotifyResponse()
//
caStatus casStrmClient::readNotifyResponse ( casChannelI * pChan,
const caHdrLargeArray & msg, const smartConstGDDPointer & pDesc,
const caHdrLargeArray & msg, const gdd & desc,
const caStatus completionStatus )
{
if ( completionStatus != S_cas_success ) {
@@ -326,12 +329,6 @@ caStatus casStrmClient::readNotifyResponse ( casChannelI * pChan,
return ecaStatus;
}
if ( ! pDesc ) {
errMessage ( S_cas_badParameter,
"no data in server tool asynch read resp ?" );
return this->readNotifyFailureResponse ( msg, ECA_GETFAIL );
}
epicsGuard < epicsMutex > guard ( this->mutex );
void *pPayload;
@@ -353,9 +350,9 @@ caStatus casStrmClient::readNotifyResponse ( casChannelI * pChan,
// convert gdd to db_access type
//
int mapDBRStatus = gddMapDbr[msg.m_dataType].conv_dbr ( pPayload,
msg.m_count, *pDesc, pChan->enumStringTable() );
msg.m_count, desc, pChan->enumStringTable() );
if ( mapDBRStatus < 0 ) {
pDesc->dump();
desc.dump();
errPrintf ( S_cas_badBounds, __FILE__, __LINE__,
"- get notify with PV=%s type=%u count=%u",
pChan->getPVI().getName(), msg.m_dataType, msg.m_count );
@@ -448,7 +445,7 @@ bool convertContainerMemberToAtomic ( gdd & dd,
//
// createDBRDD ()
//
static smartGDDPointer createDBRDD ( unsigned dbrType, unsigned elemCount )
static gdd * createDBRDD ( unsigned dbrType, unsigned elemCount )
{
/*
* DBR type has already been checked, but it is possible
@@ -456,11 +453,11 @@ static smartGDDPointer createDBRDD ( unsigned dbrType, unsigned elemCount )
* the DBR_XXXX type system
*/
if ( dbrType >= NELEMENTS ( gddDbrToAit ) ) {
return smartGDDPointer ();
return 0;
}
if ( gddDbrToAit[dbrType].type == aitEnumInvalid ) {
return smartGDDPointer ();
return 0;
}
aitUint16 appType = gddDbrToAit[dbrType].app;
@@ -468,16 +465,12 @@ static smartGDDPointer createDBRDD ( unsigned dbrType, unsigned elemCount )
//
// create the descriptor
//
smartGDDPointer pDescRet =
gdd * pDescRet =
gddApplicationTypeTable::app_table.getDD ( appType );
if ( ! pDescRet.valid () ) {
if ( ! pDescRet ) {
return pDescRet;
}
// smart pointer class maintains the ref count from here down
aitUint32 gddStatus = pDescRet->unreference();
assert ( ! gddStatus );
// fix the value element count
bool success = convertContainerMemberToAtomic (
*pDescRet, gddAppType_value, elemCount );
@@ -523,10 +516,11 @@ caStatus casStrmClient::monitorFailureResponse ( const caHdrLargeArray & msg,
// casStrmClient::monitorResponse ()
//
caStatus casStrmClient::monitorResponse ( casChannelI & chan, const caHdrLargeArray & msg,
const smartConstGDDPointer & pDesc, const caStatus completionStatus )
const gdd & desc, const caStatus completionStatus )
{
epicsGuard < epicsMutex > guard ( this->mutex );
void * pPayload;
void * pPayload = 0;
{
ca_uint32_t size = dbr_size_n ( msg.m_dataType, msg.m_count );
caStatus status = out.copyInHeader ( msg.m_cmmd, size,
@@ -542,29 +536,27 @@ caStatus casStrmClient::monitorResponse ( casChannelI & chan, const caHdrLargeAr
}
}
smartGDDPointer pDBRDD;
if ( ! chan.readAccess () ) {
return monitorFailureResponse ( msg, ECA_NORDACCESS );
}
else if ( completionStatus == S_cas_success ) {
gdd * pDBRDD = 0;
if ( completionStatus == S_cas_success ) {
pDBRDD = createDBRDD ( msg.m_dataType, msg.m_count );
if ( ! pDBRDD ) {
return monitorFailureResponse ( msg, ECA_ALLOCMEM );
}
else if ( pDesc.valid() ) {
else {
gddStatus gdds = gddApplicationTypeTable::
app_table.smartCopy ( & (*pDBRDD), & (*pDesc) );
app_table.smartCopy ( pDBRDD, & desc );
if ( gdds < 0 ) {
pDBRDD->unreference ();
errPrintf ( S_cas_noConvert, __FILE__, __LINE__,
"no conversion between event app type=%d and DBR type=%d Element count=%d",
pDesc->applicationType (), msg.m_dataType, msg.m_count);
desc.applicationType (), msg.m_dataType, msg.m_count);
return monitorFailureResponse ( msg, ECA_NOCONVERT );
}
}
else {
errMessage ( S_cas_badParameter, "no GDD in monitor response ?" );
return monitorFailureResponse ( msg, ECA_GETFAIL );
}
}
else {
errMessage ( completionStatus, "- in monitor response" );
@@ -582,6 +574,7 @@ caStatus casStrmClient::monitorResponse ( casChannelI & chan, const caHdrLargeAr
int mapDBRStatus = gddMapDbr[msg.m_dataType].conv_dbr ( pPayload, msg.m_count,
*pDBRDD, chan.enumStringTable() );
if ( mapDBRStatus < 0 ) {
pDBRDD->unreference ();
return monitorFailureResponse ( msg, ECA_NOCONVERT );
}
@@ -590,6 +583,7 @@ caStatus casStrmClient::monitorResponse ( casChannelI & chan, const caHdrLargeAr
(* cac_dbr_cvrt[msg.m_dataType])
( pPayload, pPayload, true, msg.m_count );
#endif
//
// force string message size to be the true size
//
@@ -601,6 +595,8 @@ caStatus casStrmClient::monitorResponse ( casChannelI & chan, const caHdrLargeAr
this->out.commitMsg ();
}
pDBRDD->unreference ();
return S_cas_success;
}
@@ -1284,7 +1280,7 @@ caStatus casStrmClient::eventAddAction ()
// to postpone asynchronous IO we can safely restart this
// request later.
//
smartGDDPointer pDD;
const gdd * pDD;
status = this->read ( pDD );
//
// always send immediate monitor response at event add
@@ -1300,7 +1296,7 @@ caStatus casStrmClient::eventAddAction ()
}
else {
status = this->monitorResponse ( *pciu,
*mp, pDD, status );
*mp, *pDD, status );
}
if ( status == S_cas_success ) {
@@ -1310,6 +1306,10 @@ caStatus casStrmClient::eventAddAction ()
pciu->installMonitor ( mon );
}
if ( pDD ) {
pDD->unreference ();
}
return status;
}
@@ -1620,11 +1620,7 @@ caStatus casStrmClient::write()
//
caStatus casStrmClient::writeScalarData ()
{
smartGDDPointer pDD;
const caHdrLargeArray * pHdr = this->ctx.getMsg ();
gddStatus gddStat;
caStatus status;
aitEnum type;
/*
* DBR type has already been checked, but it is possible
@@ -1634,52 +1630,52 @@ caStatus casStrmClient::writeScalarData ()
if ( pHdr->m_dataType >= NELEMENTS(gddDbrToAit) ) {
return S_cas_badType;
}
type = gddDbrToAit[pHdr->m_dataType].type;
aitEnum type = gddDbrToAit[pHdr->m_dataType].type;
if ( type == aitEnumInvalid ) {
return S_cas_badType;
}
aitEnum bestExternalType = this->ctx.getPV()->bestExternalType ();
pDD = new gddScalar (gddAppType_value, bestExternalType);
if (!pDD) {
gdd * pDD = new gddScalar ( gddAppType_value, bestExternalType );
if ( ! pDD ) {
return S_cas_noMemory;
}
//
// reference count is managed by smart pointer class
// from here down
//
gddStat = pDD->unreference();
assert (!gddStat);
//
// copy in, and convert to native type, the incoming data
//
gddStat = aitConvert (pDD->primitiveType(), pDD->dataAddress(), type,
this->ctx.getData(), 1, &this->ctx.getPV()->enumStringTable());
if (gddStat<0) {
status = S_cas_noConvert;
}
else {
gddStatus gddStat = aitConvert (
pDD->primitiveType(), pDD->dataAddress(), type,
this->ctx.getData(), 1, &this->ctx.getPV()->enumStringTable() );
caStatus status = S_cas_noConvert;
if ( gddStat >= 0 ) {
//
// set the status and severity to normal
//
pDD->setStat (epicsAlarmNone);
pDD->setSevr (epicsSevNone);
pDD->setStat ( epicsAlarmNone );
pDD->setSevr ( epicsSevNone );
//
// set the time stamp to the last time that
// we added bytes to the in buf
//
aitTimeStamp gddts = this->lastRecvTS;
pDD->setTimeStamp (&gddts);
pDD->setTimeStamp ( & gddts );
//
// call the server tool's virtual function
//
status = this->ctx.getPV()->write (this->ctx, *pDD);
status = this->ctx.getPV()->write ( this->ctx, *pDD );
}
//
// reference count is managed by smart pointer class
// from here down
//
gddStat = pDD->unreference();
assert ( ! gddStat );
return status;
}
@@ -1688,44 +1684,32 @@ caStatus casStrmClient::writeScalarData ()
//
caStatus casStrmClient::writeArrayData()
{
smartGDDPointer pDD;
const caHdrLargeArray *pHdr = this->ctx.getMsg();
gddDestructor *pDestructor;
gddStatus gddStat;
caStatus status;
aitEnum type;
char *pData;
size_t size;
const caHdrLargeArray *pHdr = this->ctx.getMsg ();
/*
* DBR type has already been checked, but it is possible
* that "gddDbrToAit" will not track with changes in
* the DBR_XXXX type system
*/
if (pHdr->m_dataType>=NELEMENTS(gddDbrToAit)) {
if ( pHdr->m_dataType >= NELEMENTS(gddDbrToAit) ) {
return S_cas_badType;
}
type = gddDbrToAit[pHdr->m_dataType].type;
if (type==aitEnumInvalid) {
aitEnum type = gddDbrToAit[pHdr->m_dataType].type;
if ( type == aitEnumInvalid ) {
return S_cas_badType;
}
aitEnum bestExternalType = this->ctx.getPV()->bestExternalType ();
pDD = new gddAtomic(gddAppType_value, bestExternalType, 1, pHdr->m_count);
if (!pDD) {
gdd * pDD = new gddAtomic(gddAppType_value, bestExternalType, 1, pHdr->m_count);
if ( ! pDD ) {
return S_cas_noMemory;
}
//
// GDD ref count is managed by smart pointer class from here down
//
gddStat = pDD->unreference();
assert (!gddStat);
size = aitSize[bestExternalType] * pHdr->m_count;
pData = new char [size];
if (!pData) {
size_t size = aitSize[bestExternalType] * pHdr->m_count;
char * pData = new char [size];
if ( ! pData ) {
pDD->unreference();
return S_cas_noMemory;
}
@@ -1733,60 +1717,64 @@ caStatus casStrmClient::writeArrayData()
// ok to use the default gddDestructor here because
// an array of characters was allocated above
//
pDestructor = new gddDestructor;
if (!pDestructor) {
gddDestructor * pDestructor = new gddDestructor;
if ( ! pDestructor ) {
pDD->unreference();
delete [] pData;
return S_cas_noMemory;
}
//
// install allocated area into the DD
//
pDD->putRef ( pData, type, pDestructor );
//
// convert the data from the protocol buffer
// to the allocated area so that they
// will be allowed to ref the DD
//
gddStat = aitConvert (bestExternalType, pData, type, this->ctx.getData(),
caStatus status = S_cas_noConvert;
gddStatus gddStat = aitConvert ( bestExternalType,
pData, type, this->ctx.getData(),
pHdr->m_count, &this->ctx.getPV()->enumStringTable() );
if (gddStat<0) {
status = S_cas_noConvert;
delete pDestructor;
delete [] pData;
}
else {
//
// install allocated area into the DD
//
pDD->putRef (pData, type, pDestructor);
if ( gddStat >= 0 ) {
//
// set the status and severity to normal
//
pDD->setStat (epicsAlarmNone);
pDD->setSevr (epicsSevNone);
pDD->setStat ( epicsAlarmNone );
pDD->setSevr ( epicsSevNone );
//
// set the time stamp to the last time that
// we added bytes to the in buf
//
aitTimeStamp gddts = this->lastRecvTS;
pDD->setTimeStamp (&gddts);
pDD->setTimeStamp ( & gddts );
//
// call the server tool's virtual function
//
status = this->ctx.getPV()->write(this->ctx, *pDD);
status = this->ctx.getPV()->write ( this->ctx, *pDD );
}
gddStat = pDD->unreference ();
assert ( ! gddStat );
return status;
}
//
// casStrmClient::read()
//
caStatus casStrmClient::read ( smartGDDPointer & pDescRet )
caStatus casStrmClient::read ( const gdd * & pDescRet )
{
const caHdrLargeArray * pHdr = this->ctx.getMsg();
pDescRet = createDBRDD ( pHdr->m_dataType, pHdr->m_count );
if ( ! pDescRet ) {
pDescRet = 0;
gdd * pDD = createDBRDD ( pHdr->m_dataType, pHdr->m_count );
if ( ! pDD ) {
return S_cas_noMemory;
}
@@ -1794,7 +1782,8 @@ caStatus casStrmClient::read ( smartGDDPointer & pDescRet )
// the PV state must not be modified during a transaction
//
caStatus status = this->ctx.getPV()->beginTransaction();
if (status) {
if ( status ) {
pDD->unreference ();
return status;
}
@@ -1806,7 +1795,9 @@ caStatus casStrmClient::read ( smartGDDPointer & pDescRet )
//
// call the server tool's virtual function
//
status = this->ctx.getPV()->read (this->ctx, *pDescRet);
status = this->ctx.getPV()->read ( this->ctx, * pDD );
this->ctx.getPV()->endTransaction();
//
// prevent problems when they initiate
@@ -1814,7 +1805,7 @@ caStatus casStrmClient::read ( smartGDDPointer & pDescRet )
// indicating so (and vise versa)
//
if ( this->userStartedAsyncIO ) {
if (status!=S_casApp_asyncCompletion) {
if ( status != S_casApp_asyncCompletion ) {
fprintf(stderr,
"Application returned %d from casPV::read() - expected S_casApp_asyncCompletion\n",
status);
@@ -1827,11 +1818,12 @@ caStatus casStrmClient::read ( smartGDDPointer & pDescRet )
"- expected asynch IO creation from casPV::read()");
}
if ( status ) {
pDescRet = NULL;
if ( status == S_casApp_success ) {
pDescRet = pDD;
}
this->ctx.getPV()->endTransaction();
else {
pDD->unreference ();
}
return status;
}
@@ -1938,7 +1930,7 @@ void casStrmClient::flush ()
// casStrmClient::casMonitorCallBack()
//
caStatus casStrmClient::casMonitorCallBack (
casMonitor & mon, const smartConstGDDPointer & value )
casMonitor & mon, const gdd & value )
{
return mon.response ( *this, value );
}
+8 -8
View File
@@ -34,16 +34,16 @@ public:
//
virtual caStatus createChanResponse (
const caHdrLargeArray &, const pvAttachReturn & );
caStatus readResponse ( casChannelI *pChan, const caHdrLargeArray &msg,
const smartConstGDDPointer &pDesc, const caStatus status);
caStatus readNotifyResponse ( casChannelI *pChan, const caHdrLargeArray &msg,
const smartConstGDDPointer &pDesc, const caStatus status);
caStatus readResponse ( casChannelI * pChan, const caHdrLargeArray & msg,
const gdd & desc, const caStatus status );
caStatus readNotifyResponse ( casChannelI *pChan, const caHdrLargeArray & msg,
const gdd & desc, const caStatus status );
caStatus writeResponse ( casChannelI &,
const caHdrLargeArray & msg, const caStatus status );
caStatus writeNotifyResponse ( casChannelI &,
const caHdrLargeArray &, const caStatus status );
caStatus monitorResponse ( casChannelI & chan, const caHdrLargeArray & msg,
const smartConstGDDPointer & pDesc, const caStatus status );
const gdd & desc, const caStatus status );
caStatus enumPostponedCreateChanResponse ( casChannelI & chan,
const caHdrLargeArray & hdr, unsigned dbrType );
caStatus channelCreateFailedResp ( const caHdrLargeArray &,
@@ -91,12 +91,12 @@ private:
//
// accessRightsResponse()
//
caStatus accessRightsResponse (casChannelI *pciu);
caStatus accessRightsResponse ( casChannelI * pciu );
//
// these prepare the gdd based on what is in the ca hdr
//
caStatus read ( smartGDDPointer & pDesc );
caStatus read ( const gdd * & pDesc );
caStatus write ();
caStatus writeArrayData();
@@ -128,7 +128,7 @@ private:
const caStatus status );
caStatus casMonitorCallBack ( casMonitor &,
const smartConstGDDPointer & pValue );
const gdd & );
casStrmClient ( const casStrmClient & );
casStrmClient & operator = ( const casStrmClient & );
-1
View File
@@ -29,7 +29,6 @@
//
#include "errMdef.h" // EPICS error codes
#include "gdd.h" // EPICS data descriptors
#include "smartGDDPointer.h" // auto ref gdd pointer
#include "alarm.h" // EPICS alarm severity/condition
#ifdef epicsExportSharedSymbols_casdefh
+32 -30
View File
@@ -52,7 +52,10 @@ caStatus outBuf::allocRawMsg ( bufSizeT msgsize, void **ppMsg )
msgsize = CA_MESSAGE_ALIGN ( msgsize );
if ( msgsize > this->bufSize ) {
return S_cas_hugeRequest;
this->expandBuffer ();
if ( msgsize > this->bufSize ) {
return S_cas_hugeRequest;
}
}
stackNeeded = this->bufSize - msgsize;
@@ -62,7 +65,7 @@ caStatus outBuf::allocRawMsg ( bufSizeT msgsize, void **ppMsg )
//
// Try to flush the output queue
//
this->flush ( this->stack-stackNeeded );
this->flush ( this->stack - stackNeeded );
//
// If this failed then the fd is nonblocking
@@ -82,48 +85,47 @@ caStatus outBuf::allocRawMsg ( bufSizeT msgsize, void **ppMsg )
return S_cas_success;
}
// code size is allowed to increase here somewhat in the
// interest of efficency since this is a very frequently
// called function
caStatus outBuf::copyInHeader ( ca_uint16_t response, ca_uint32_t payloadSize,
ca_uint16_t dataType, ca_uint32_t nElem, ca_uint32_t cid,
ca_uint32_t responseSpecific, void **ppPayload )
{
ca_uint32_t alignedPayloadSize = CA_MESSAGE_ALIGN ( payloadSize );
ca_uint32_t hdrSize;
char * pPayload;
if ( alignedPayloadSize < 0xffff && nElem < 0xffff ) {
hdrSize = sizeof ( caHdr );
}
else {
hdrSize = sizeof ( caHdr ) + 2 * sizeof (ca_uint32_t);
}
caHdr * pHdr;
caStatus status = this->allocRawMsg ( hdrSize + alignedPayloadSize,
reinterpret_cast < void ** > ( & pHdr ) );
if ( status != S_cas_success ) {
if ( status == S_cas_hugeRequest ) {
this->expandBuffer ();
status = this->allocRawMsg ( hdrSize + alignedPayloadSize,
reinterpret_cast < void ** > ( & pHdr ) );
if ( status != S_cas_success ) {
return status;
}
}
else {
ca_uint32_t msgSize = sizeof ( caHdr ) + alignedPayloadSize;
caHdr * pHdr;
caStatus status = this->allocRawMsg (
msgSize, reinterpret_cast < void ** > ( & pHdr ) );
if ( status != S_cas_success ) {
return status;
}
}
pHdr->m_cmmd = epicsHTON16 ( response );
pHdr->m_dataType = epicsHTON16 ( dataType );
pHdr->m_cid = epicsHTON32 ( cid );
pHdr->m_available = epicsHTON32 ( responseSpecific );
char * pPayload;
if ( hdrSize == sizeof ( caHdr ) ) {
pHdr->m_cmmd = epicsHTON16 ( response );
pHdr->m_dataType = epicsHTON16 ( dataType );
pHdr->m_cid = epicsHTON32 ( cid );
pHdr->m_available = epicsHTON32 ( responseSpecific );
pHdr->m_postsize = epicsHTON16 ( static_cast < epicsUInt16 > ( alignedPayloadSize ) );
pHdr->m_count = epicsHTON16 ( static_cast < epicsUInt16 > ( nElem ) );
pPayload = reinterpret_cast < char * > ( pHdr + 1 );
}
else {
ca_uint32_t msgSize = sizeof ( caHdr ) +
2 * sizeof (ca_uint32_t) + alignedPayloadSize;
caHdr * pHdr;
caStatus status = this->allocRawMsg (
msgSize, reinterpret_cast < void ** > ( & pHdr ) );
if ( status != S_cas_success ) {
return status;
}
pHdr->m_cmmd = epicsHTON16 ( response );
pHdr->m_dataType = epicsHTON16 ( dataType );
pHdr->m_cid = epicsHTON32 ( cid );
pHdr->m_available = epicsHTON32 ( responseSpecific );
pHdr->m_postsize = epicsHTON16 ( 0xffff );
pHdr->m_count = epicsHTON16 ( 0 );
ca_uint32_t * pLW = reinterpret_cast < ca_uint32_t * > ( pHdr + 1 );
@@ -142,7 +144,7 @@ caStatus outBuf::copyInHeader ( ca_uint16_t response, ca_uint32_t payloadSize,
*ppPayload = pPayload;
}
return status;
return S_cas_success;
}
//