fix DBR2PVD() DBF_ENUM handling

must treat DBF_ENUM differently in
pvif than in dbf_copy as the storage
types used are different.
This commit is contained in:
Michael Davidsaver
2018-04-17 19:08:24 -07:00
parent 6089591abb
commit 1cc1d1857e
4 changed files with 34 additions and 2 deletions

View File

@ -18,6 +18,22 @@
namespace pvd = epics::pvData;
// note that we handle DBF_ENUM differently than in pvif.cpp
static
pvd::ScalarType DBR2PVD(short dbr)
{
switch(dbr) {
#define CASE(BASETYPE, PVATYPE, DBFTYPE, PVACODE) case DBR_##DBFTYPE: return pvd::pv##PVACODE;
#define CASE_SKIP_BOOL
#include "pv/typemap.h"
#undef CASE_SKIP_BOOL
#undef CASE
case DBF_ENUM: return pvd::pvUShort;
case DBF_STRING: return pvd::pvString;
}
throw std::invalid_argument("Unsupported DBR code");
}
long copyPVD2DBF(const pvd::PVField::const_shared_pointer& inraw,
void *outbuf, short outdbf, long *outnReq)
{

View File

@ -302,6 +302,21 @@ long pvaGetTimeStamp(const DBLINK *plink, epicsTimeStamp *pstamp)
return -1;
}
// note that we handle DBF_ENUM differently than in pvif.cpp
pvd::ScalarType DBR2PVD(short dbr)
{
switch(dbr) {
#define CASE(BASETYPE, PVATYPE, DBFTYPE, PVACODE) case DBR_##DBFTYPE: return pvd::pv##PVACODE;
#define CASE_SKIP_BOOL
#include "pv/typemap.h"
#undef CASE_SKIP_BOOL
#undef CASE
case DBF_ENUM: return pvd::pvUShort;
case DBF_STRING: return pvd::pvString;
}
throw std::invalid_argument("Unsupported DBR code");
}
long pvaPutValue(DBLINK *plink, short dbrType,
const void *pbuffer, long nRequest)
{

View File

@ -623,15 +623,17 @@ struct PVIFScalarNumeric : public PVIF
} // namespace
static
pvd::ScalarType DBR2PVD(short dbr)
{
switch(dbr) {
#define CASE(BASETYPE, PVATYPE, DBFTYPE, PVACODE) case DBR_##DBFTYPE: return pvd::pv##PVACODE;
#define CASE_ENUM
#define CASE_SKIP_BOOL
#include "pv/typemap.h"
#undef CASE_ENUM
#undef CASE_SKIP_BOOL
#undef CASE
case DBF_ENUM: return pvd::pvUShort;
case DBF_STRING: return pvd::pvString;
}
throw std::invalid_argument("Unsupported DBR code");

View File

@ -29,7 +29,6 @@
# define USE_MULTILOCK
#endif
epics::pvData::ScalarType DBR2PVD(short dbr);
short PVD2DBR(epics::pvData::ScalarType pvt);
// copy from PVField (.value sub-field) to DBF buffer