moved app type jump table to exPV class for improved readability

This commit is contained in:
Jeff Hill
1998-05-29 16:45:14 +00:00
parent 5e83b24f01
commit 47837552b0
4 changed files with 71 additions and 50 deletions
+4 -4
View File
@@ -25,7 +25,7 @@ caStatus exAsyncPV::read (const casCtx &ctx, gdd &valueIn)
return S_casApp_noMemory;
}
return S_casApp_asyncCompletion;
return S_casApp_asyncCompletion;
}
//
@@ -73,7 +73,7 @@ const char *exAsyncWriteIO::name() const
// exAsyncReadIO::expire()
// (a virtual function that runs when the base timer expires)
//
void exAsyncReadIO::expire()
void exAsyncReadIO::expire ()
{
caStatus status;
@@ -81,12 +81,12 @@ void exAsyncReadIO::expire()
// map between the prototype in and the
// current value
//
status = exServer::read(this->pv, this->proto);
status = this->pv.exPV::readNoCtx (this->proto);
//
// post IO completion
//
this->postIOCompletion(status, this->proto);
this->postIOCompletion (status, this->proto);
}
//
+35 -1
View File
@@ -5,6 +5,11 @@
#include "exServer.h"
#include "gddApps.h"
//
// static data for exPV
//
char exPV::hasBeenInitialized = 0;
gddAppFuncTable<exPV> exPV::ft;
osiTime exPV::currentTime;
//
@@ -223,6 +228,35 @@ void exPV::show(unsigned level) const
}
}
//
// exPV::initFT()
//
void exPV::initFT()
{
if (exPV::hasBeenInitialized) {
return;
}
exPV::ft.installReadFunc ("status", &exPV::getStatus);
exPV::ft.installReadFunc ("severity", &exPV::getSeverity);
exPV::ft.installReadFunc ("seconds", &exPV::getSeconds);
exPV::ft.installReadFunc ("nanoseconds", &exPV::getNanoseconds);
exPV::ft.installReadFunc ("precision", &exPV::getPrecision);
exPV::ft.installReadFunc ("graphicHigh", &exPV::getHighLimit);
exPV::ft.installReadFunc ("graphicLow", &exPV::getLowLimit);
exPV::ft.installReadFunc ("controlHigh", &exPV::getHighLimit);
exPV::ft.installReadFunc ("controlLow", &exPV::getLowLimit);
exPV::ft.installReadFunc ("alarmHigh", &exPV::getHighLimit);
exPV::ft.installReadFunc ("alarmLow", &exPV::getLowLimit);
exPV::ft.installReadFunc ("alarmHighWarning", &exPV::getHighLimit);
exPV::ft.installReadFunc ("alarmLowWarning", &exPV::getLowLimit);
exPV::ft.installReadFunc ("units", &exPV::getUnits);
exPV::ft.installReadFunc ("value", &exPV::getValue);
exPV::ft.installReadFunc ("enums", &exPV::getEnums);
exPV::hasBeenInitialized = 1;
}
//
// exPV::getStatus()
//
@@ -400,6 +434,6 @@ caStatus exPV::write (const casCtx &, gdd &valueIn)
//
caStatus exPV::read (const casCtx &, gdd &protoIn)
{
return exServer::read(*this, protoIn);
return this->ft.read (*this, protoIn);
}
+1 -21
View File
@@ -24,11 +24,6 @@
template class resTable <pvEntry,stringId>;
#endif
//
// static data for exServer
//
gddAppFuncTable<exPV> exServer::ft;
//
// static list of pre-created PVs
//
@@ -64,22 +59,7 @@ exServer::exServer(const char * const pvPrefix, unsigned aliasCount, aitBool sca
const char * const pNameFmtStr = "%.100s%.20s";
const char * const pAliasFmtStr = "%.100s%.20s%u";
exServer::ft.installReadFunc ("status", &exPV::getStatus);
exServer::ft.installReadFunc ("severity", &exPV::getSeverity);
exServer::ft.installReadFunc ("seconds", &exPV::getSeconds);
exServer::ft.installReadFunc ("nanoseconds", &exPV::getNanoseconds);
exServer::ft.installReadFunc ("precision", &exPV::getPrecision);
exServer::ft.installReadFunc ("graphicHigh", &exPV::getHighLimit);
exServer::ft.installReadFunc ("graphicLow", &exPV::getLowLimit);
exServer::ft.installReadFunc ("controlHigh", &exPV::getHighLimit);
exServer::ft.installReadFunc ("controlLow", &exPV::getLowLimit);
exServer::ft.installReadFunc ("alarmHigh", &exPV::getHighLimit);
exServer::ft.installReadFunc ("alarmLow", &exPV::getLowLimit);
exServer::ft.installReadFunc ("alarmHighWarning", &exPV::getHighLimit);
exServer::ft.installReadFunc ("alarmLowWarning", &exPV::getLowLimit);
exServer::ft.installReadFunc ("units", &exPV::getUnits);
exServer::ft.installReadFunc ("value", &exPV::getValue);
exServer::ft.installReadFunc ("enums", &exPV::getEnums);
exPV::initFT();
//
// hash table size may need adjustment here?
+31 -24
View File
@@ -185,20 +185,6 @@ public:
// Gets called when we add noise to the current value
//
virtual void scan() = 0;
//
// Std PV Attribute fetch support
//
gddAppFuncTableStatus getStatus(gdd &value);
gddAppFuncTableStatus getSeverity(gdd &value);
gddAppFuncTableStatus getSeconds(gdd &value);
gddAppFuncTableStatus getNanoseconds(gdd &value);
gddAppFuncTableStatus getPrecision(gdd &value);
gddAppFuncTableStatus getHighLimit(gdd &value);
gddAppFuncTableStatus getLowLimit(gdd &value);
gddAppFuncTableStatus getUnits(gdd &value);
gddAppFuncTableStatus getValue(gdd &value);
gddAppFuncTableStatus getEnums(gdd &value);
//
//
@@ -222,7 +208,12 @@ public:
caStatus read (const casCtx &, gdd &protoIn);
caStatus write (const casCtx &, gdd &protoIn);
caStatus readNoCtx (gdd &protoIn)
{
return this->ft.read (*this, protoIn);
}
caStatus write (const casCtx &, gdd &value);
void destroy();
@@ -236,6 +227,8 @@ public:
return this->info.getName();
}
static void initFT();
protected:
gdd *pValue;
exScanTimer *pScanTimer;
@@ -246,6 +239,27 @@ protected:
static osiTime currentTime;
virtual caStatus updateValue (gdd &value) = 0;
private:
//
// Std PV Attribute fetch support
//
gddAppFuncTableStatus getStatus(gdd &value);
gddAppFuncTableStatus getSeverity(gdd &value);
gddAppFuncTableStatus getSeconds(gdd &value);
gddAppFuncTableStatus getNanoseconds(gdd &value);
gddAppFuncTableStatus getPrecision(gdd &value);
gddAppFuncTableStatus getHighLimit(gdd &value);
gddAppFuncTableStatus getLowLimit(gdd &value);
gddAppFuncTableStatus getUnits(gdd &value);
gddAppFuncTableStatus getValue(gdd &value);
gddAppFuncTableStatus getEnums(gdd &value);
//
// static
//
static gddAppFuncTable<exPV> ft;
static char hasBeenInitialized;
};
//
@@ -292,11 +306,6 @@ public:
void installAliasName(pvInfo &info, const char *pAliasName);
inline void removeAliasName(pvEntry &entry);
static gddAppFuncTableStatus read(exPV &pv, gdd &value)
{
return exServer::ft.read(pv, value);
}
//
// removeIO
//
@@ -325,8 +334,6 @@ private:
//
static pvInfo bill;
static pvInfo billy;
static gddAppFuncTable<exPV> ft;
};
//
@@ -345,12 +352,12 @@ public:
//
// read
//
caStatus read(const casCtx &ctxIn, gdd &value);
caStatus read (const casCtx &ctxIn, gdd &protoIn);
//
// write
//
caStatus write(const casCtx &ctxIn, gdd &value);
caStatus write (const casCtx &ctxIn, gdd &value);
//
// removeIO