fixed getString in transpose.cpp for ENUM types for STS and TIME datatypes; indents made consistent; angled brackets for headers

This commit is contained in:
2018-12-19 11:56:16 +01:00
parent b09186294d
commit ab743baa8b
26 changed files with 391 additions and 385 deletions
+177 -146
View File
@@ -1527,7 +1527,7 @@ int CAFE::getWFAsStringCache(unsigned int handle, std::string & psWF)
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
unsigned int c=(*it_handle).getChannelRequestMetaDataClient().getNelem();
//unsigned int c=(*it_handle).getChannelRequestMetaDataClient().getNelem();
unsigned int n=(*it_handle).getChannelRegalia().getNelem();
unsigned int r =min( (*it_handle).getChannelRequestMetaData().getNelemCache(),
((*it_handle).getChannelRequestMetaData().getNelem()-(*it_handle).getChannelRequestMetaData().getOffset()) ) ;
@@ -3989,6 +3989,36 @@ int CAFE::getAllChannelInfo(unsigned int handle, ChannelRegalia & channelInfo, P
/**
* \brief Supplment all handles with Severity levels and Desc information.
* If PV has a special field (DESC, HHSV HSV etc..) then do not supplement
* \return ICAFE_NORMAL
*
int CAFE::supplementHandles(std::vector<unsigned int> hV)
{
#define __METHOD__ "CAFE::supplementHandles(vector<unsigned int>)"
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
cafeConduit_set_by_handle::iterator it_handle;
int overallStatus=ICAFE_NORMAL;
for (unsigned int i=0; i<hV.size(); ++i) {
it_handle = handle_index.find(hV[i]);
if (it_handle != handle_index.end()) {
}
else {
overallStatus=ECAFE_INVALID_HANDLE;
}
}
return overallStatus;
return ICAFE_NORMAL;
#undef __METHOD__
}
*/
/**
* \brief Supplment all handles with Severity levels and Desc information.
* If PV has a special field (DESC, HHSV HSV etc..) then do not supplement
@@ -3996,7 +4026,8 @@ int CAFE::getAllChannelInfo(unsigned int handle, ChannelRegalia & channelInfo, P
*/
int CAFE::supplementHandles()
{
#define __METHOD__ "CAFE::supplementHandlesV()"
#define __METHOD__ "CAFE::supplementHandles()"
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
std::vector<std::string> pvV;
@@ -4171,173 +4202,173 @@ int CAFE::supplementHandlesV(std::vector<unsigned int> hV)
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
std::vector<std::string> pvV;
std::vector<std::string> pvAsGivenV;
std::vector<std::string> pvsToClose;
std::vector<unsigned int> allHandles;
std::vector<std::string> allPVs;
std::size_t found;
std::size_t foundField;
std::string field=""; std::string pv=""; std::string pvDevAttrib="";
std::vector<std::string> specialFields;
specialFields.reserve(5);
specialFields.push_back( (char *) "DESC");
specialFields.push_back( (char *) "HHSV");
specialFields.push_back( (char *) "HSV");
specialFields.push_back( (char *) "LSV");
specialFields.push_back( (char *) "LLSV");
std::vector<std::string> pvContainer; pvContainer.reserve(5);
unsigned int localHandle=0;
int status=ICAFE_NORMAL;
int overallStatus=ICAFE_NORMAL;
std::vector<std::string> pvV;
std::vector<std::string> pvAsGivenV;
std::vector<std::string> pvsToClose;
std::vector<unsigned int> allHandles;
std::vector<std::string> allPVs;
std::size_t found;
std::size_t foundField;
std::string field=""; std::string pv=""; std::string pvDevAttrib="";
std::vector<std::string> specialFields;
specialFields.reserve(5);
specialFields.push_back( (char *) "DESC");
specialFields.push_back( (char *) "HHSV");
specialFields.push_back( (char *) "HSV");
specialFields.push_back( (char *) "LSV");
specialFields.push_back( (char *) "LLSV");
std::vector<std::string> pvContainer; pvContainer.reserve(5);
unsigned int localHandle=0;
int status=ICAFE_NORMAL;
int overallStatus=ICAFE_NORMAL;
for (unsigned int i=0; i<hV.size(); ++i) {
it_handle = handle_index.find(hV[i]);
if (it_handle != handle_index.end()) {
pv=(*it_handle).getPV();
pvDevAttrib=pv;
field="";
found = pv.find(".");
if (it_handle != handle_index.end()) {
pv=(*it_handle).getPV();
pvDevAttrib=pv;
field="";
found = pv.find(".");
if (found != std::string::npos) {
field=pv.substr(found, pv.size()-1);
//DO NOT SUPPLEMENT CONDUIT OBJECT FOR PVS WITH SPECIAL FIELDS
bool breakFlag=false;
for (int j=0; j<specialFields.size(); ++j) {
foundField=field.find(specialFields[j]);
if (foundField != std::string::npos) {
breakFlag=true;
break;
}
}
//std::cout << "field = " << field << std::endl;
//std::cout << "pv.substr = " << pv.substr(0,found) << std::endl;
if (breakFlag) {
std::cout << "This pv is not supplemented = " << pv << std::endl;
continue;
}
if ( (*it_handle).hasDescription() && (*it_handle).hasAlarmSeverityStruct() ) {
std::cout << "This pv has already been supplemented = " << pv << std::endl;
continue;
}
pvDevAttrib=pv.substr(0,found);
pvV.push_back(pvDevAttrib);
//DO NOT SUPPLEMENT CONDUIT OBJECT FOR PVS WITH SPECIAL FIELDS
bool breakFlag=false;
for (int j=0; j<specialFields.size(); ++j) {
foundField=field.find(specialFields[j]);
if (foundField != std::string::npos) {
breakFlag=true;
break;
}
}
//std::cout << "field = " << field << std::endl;
//std::cout << "pv.substr = " << pv.substr(0,found) << std::endl;
if (breakFlag) {
std::cout << "This pv is not supplemented = " << pv << std::endl;
continue;
}
if ( (*it_handle).hasDescription() && (*it_handle).hasAlarmSeverityStruct() ) {
std::cout << "This pv has already been supplemented = " << pv << std::endl;
continue;
}
pvDevAttrib=pv.substr(0,found);
pvV.push_back(pvDevAttrib);
}
else {
pvV.push_back(pv);
}
pvAsGivenV.push_back(pv);
pvContainer.clear();
else {
pvV.push_back(pv);
}
pvAsGivenV.push_back(pv);
pvContainer.clear();
for (int j=0; j<specialFields.size(); ++j) {
std::string pvS=pvDevAttrib; pvS.append((char *)"."); pvS.append(specialFields[j]);
pvContainer.push_back(pvS);
}
//Check if already open -if yes do not add to pvHandlestoOpenAndClose
for (int i=0; i<pvContainer.size(); ++i) {
localHandle= handleHelper.getHandleFromPV(pvContainer[i].c_str());
if (localHandle == 0 ) {
pvsToClose.push_back(pvContainer[i]);
allPVs.push_back(pvContainer[i]);
}
else {
//pvHandlesAlreadyExisiting.insert(pvContainer[i]);
allPVs.push_back(pvContainer[i]);
}
}
}
else {
std::string pvS=pvDevAttrib; pvS.append((char *)"."); pvS.append(specialFields[j]);
pvContainer.push_back(pvS);
}
//Check if already open -if yes do not add to pvHandlestoOpenAndClose
for (int k=0; k<pvContainer.size(); ++k) {
localHandle= handleHelper.getHandleFromPV(pvContainer[k].c_str());
if (localHandle == 0 ) {
pvsToClose.push_back(pvContainer[k]);
allPVs.push_back(pvContainer[k]);
}
else {
//pvHandlesAlreadyExisiting.insert(pvContainer[k]);
allPVs.push_back(pvContainer[k]);
}
}
}
else {
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
cafeStatus.report(ECAFE_INVALID_HANDLE);
cout << "Handle=" << hV[i] << " either never existed or no longer exists " << endl;
overallStatus=ECAFE_INVALID_HANDLE;
}
}//for
CAFE::openPrepare();
try {
CAFE::open(allPVs, allHandles);
}
catch(CAFEException_open &e) {
return e.pvEx.statusCode;
}
CAFE::openNowAndWait(2.0);
//CAFE::printHandles();
//Get Asyn No Blocking
std::vector<int> allStatus;
std::vector<int> vRB; vRB.reserve(allHandles.size());
overallStatus=CAFE::get(allHandles, allStatus);
status=CAFE::waitForBundledEvents(allHandles, vRB);
if (status != ICAFE_NORMAL) { overallStatus=status;}
for (int i=0; i<pvV.size(); ++i) {
pvContainer.clear();
CAFE::openPrepare();
try {
CAFE::open(allPVs, allHandles);
}
catch(CAFEException_open &e) {
return e.pvEx.statusCode;
}
CAFE::openNowAndWait(2.0);
//CAFE::printHandles();
//Get Asyn No Blocking
std::vector<int> allStatus;
std::vector<int> vRB; vRB.reserve(allHandles.size());
overallStatus=CAFE::get(allHandles, allStatus);
status=CAFE::waitForBundledEvents(allHandles, vRB);
if (status != ICAFE_NORMAL) { overallStatus=status;}
for (int i=0; i<pvV.size(); ++i) {
pvContainer.clear();
for (int j=0; j<specialFields.size(); ++j) {
std::string pvS=pvV[i]; pvS.append((char *)"."); pvS.append(specialFields[j]);
pvContainer.push_back(pvS);
}
alarmSeverityStruct ass;
std::string desc="";
CAFE::getCache(pvContainer[0].c_str(), desc);
CAFE::getCache(pvContainer[1].c_str(), ass.hhsv);
CAFE::getCache(pvContainer[2].c_str(), ass.hsv);
CAFE::getCache(pvContainer[3].c_str(), ass.lsv);
CAFE::getCache(pvContainer[4].c_str(), ass.llsv);
std::cout << i << " " << pvContainer[0] << " " << desc << std::endl;
std::cout << i << " " << pvContainer[1] << " " << ass.hhsv << std::endl;
std::cout << i << " " << pvContainer[2] << " " << ass.hsv << std::endl;
std::cout << i << " " << pvContainer[3] << " " << ass.lsv << std::endl;
std::cout << i << " " << pvContainer[4] << " " << ass.llsv << std::endl;
std::string pvS=pvV[i]; pvS.append((char *)"."); pvS.append(specialFields[j]);
pvContainer.push_back(pvS);
}
alarmSeverityStruct ass;
std::string desc="";
CAFE::getCache(pvContainer[0].c_str(), desc);
CAFE::getCache(pvContainer[1].c_str(), ass.hhsv);
CAFE::getCache(pvContainer[2].c_str(), ass.hsv);
CAFE::getCache(pvContainer[3].c_str(), ass.lsv);
CAFE::getCache(pvContainer[4].c_str(), ass.llsv);
std::cout << i << " " << pvContainer[0] << " " << desc << std::endl;
std::cout << i << " " << pvContainer[1] << " " << ass.hhsv << std::endl;
std::cout << i << " " << pvContainer[2] << " " << ass.hsv << std::endl;
std::cout << i << " " << pvContainer[3] << " " << ass.lsv << std::endl;
std::cout << i << " " << pvContainer[4] << " " << ass.llsv << std::endl;
it_handle = handle_index.find(handleHelper.getHandleFromPV(pvAsGivenV[i].c_str()));
if (it_handle != handle_index.end()) {
if(MUTEX) {
cafeMutex.lock();
};
cafeMutex.lock();
};
handle_index.modify(it_handle, change_supplementHandle(ass,desc));
if(MUTEX) {
cafeMutex.unlock();
};
cafeMutex.unlock();
};
}
else {
std::cout << __METHOD__ << " INVALID HANDLE " <<std::endl;
}
}
CAFE::openPrepare();
for (int i=0; i < pvsToClose.size(); ++i) {
CAFE::close(handleHelper.getHandleFromPV(pvsToClose[i].c_str()));
}
CAFE::flushNow();
//CAFE::printHandles();
for (int i=0; i<pvAsGivenV.size(); ++i) {
std::string desc="";
handleHelper.getDescription( handleHelper.getHandleFromPV(pvAsGivenV[i].c_str()), desc);
std::cout << i << " DESC=" << desc << " for pv= " << pvAsGivenV[i].c_str() << std::endl;
}
}
CAFE::openPrepare();
for (int i=0; i < pvsToClose.size(); ++i) {
CAFE::close(handleHelper.getHandleFromPV(pvsToClose[i].c_str()));
}
CAFE::flushNow();
//CAFE::printHandles();
for (int i=0; i<pvAsGivenV.size(); ++i) {
std::string desc="";
handleHelper.getDescription( handleHelper.getHandleFromPV(pvAsGivenV[i].c_str()), desc);
std::cout << i << " DESC=" << desc << " for pv= " << pvAsGivenV[i].c_str() << std::endl;
}
return ICAFE_NORMAL;
#undef __METHOD__
}
+2 -2
View File
@@ -5,8 +5,8 @@
/// \version CAFE 1.0.0
///
#include "cafeEnum.h"
#include "enumStrings.h"
#include <cafeEnum.h>
#include <enumStrings.h>
template<> char const * enumStrings<CAFENUM::ChannelWaitForResponsePolicyKind>::data[]
= {"CAFENUM::WAIT", "CAFENUM::NO_WAIT"};
+7 -7
View File
@@ -6,13 +6,13 @@
///
#include <cadef.h>
#include "global.h"
#include "policies.h"
#include "conduitFriends.h"
#include "conduitConnectionHandlerArgs.h"
#include "conduitEventHandlerArgs.h"
#include "methodCallbacks.h"
#include "granules.h"
#include <global.h>
#include <policies.h>
#include <conduitFriends.h>
#include <conduitConnectionHandlerArgs.h>
#include <conduitEventHandlerArgs.h>
#include <methodCallbacks.h>
#include <granules.h>
using namespace std;
+3 -3
View File
@@ -5,8 +5,8 @@
/// \version CAFE 1.0.0
///
#include "connect.h"
#include "conduitFriends.h"
#include <connect.h>
#include <conduitFriends.h>
extern cafeConduit_set cs;
extern bool MUTEX;
@@ -82,7 +82,7 @@ void Connect::callbackHandlerException(struct exception_handler_args args)
strcpy(pName, ca_name(args.chid));
_handle = (unsigned long) ca_puser(args.chid);
sprintf(buf,
"%s with request handle=%d, channel=%s, op=%ld, datatype=%s, count=%ld. %s",
"%s with request handle=%u, channel=%s, op=%ld, datatype=%s, count=%ld. %s",
args.ctx, (unsigned int) _handle, pName, args.op, dbr_type_to_text (args.type), args.count,
"Possibly an IOC has been switched off or is rebooting.");
+4 -4
View File
@@ -6,10 +6,10 @@
/// \version CAFE 1.0.0
#include "enumStrings.h"
#include "defines.h"
#include "policies.h"
#include "cafeEnum.h"
#include <enumStrings.h>
#include <defines.h>
#include <policies.h>
#include <cafeEnum.h>
template<typename T>
+1 -1
View File
@@ -5,7 +5,7 @@
/// \version CAFE 1.0.0
///
#include "exceptionsHelper.h"
#include <exceptionsHelper.h>
using namespace std;
+1 -4
View File
@@ -4,11 +4,8 @@
/// \date Release: February 2015
/// \version CAFE 1.0.0
//include "connect.h"
//include "conduit.h"
//#include "cafeConduitFriends.h"
#include "helper.h"
#include <helper.h>
using namespace std;
+1 -1
View File
@@ -7,7 +7,7 @@
#include "loadGroupXMLParser.h"
#include <loadGroupXMLParser.h>
#if HAVE_LIBQTXML
#include <stdio.h>
+7 -7
View File
@@ -111,8 +111,8 @@ AMTAR = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run tar
#if HAVE_ZEROMQ
#libcafe_la_SOURCES += cafeService.cpp
#endif
AM_CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml -I/opt/gfa/python-3.5/latest/include/python3.5m -I$(top_srcdir)/include
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64 -L/opt/gfa/python-3.5/latest/lib -Wl,-rpath,/opt/gfa/python-3.5/latest/lib
AM_CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml -I$(top_srcdir)/include
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
AR = ar
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoconf
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoheader
@@ -123,7 +123,7 @@ CC = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc -E
CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml -I/opt/gfa/python-3.5/latest/include/python3.5m
CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
CXX = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++
CXXCPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++ -E
CXXDEPMODE = depmode=gcc3
@@ -146,9 +146,9 @@ INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64 -L/opt/gfa/python-3.5/latest/lib -Wl,-rpath,/opt/gfa/python-3.5/latest/lib
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
LIBOBJS =
LIBS = -lpython3.5m -lQtXml -lQtCore
LIBS = -lQtXml -lQtCore
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
@@ -207,7 +207,7 @@ htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/install-sh
libdir = /opt/gfa/cafe/python/python-3.5/pycafe-1.8.0/lib
libdir = /opt/gfa/cafe/cpp/cafe-1.8.0-gcc-6.3.0/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
@@ -216,7 +216,7 @@ mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /opt/gfa/cafe/python/python-3.5/pycafe-1.8.0
prefix = /opt/gfa/cafe/cpp/cafe-1.8.0-gcc-6.3.0
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
+3 -3
View File
@@ -4,9 +4,9 @@
/// \date Release: February 2015
/// \version CAFE 1.0.0
#include "conduitEventHandlerArgs.h"
#include "methodCallbacks.h"
#include "connect.h"
#include <conduitEventHandlerArgs.h>
#include <methodCallbacks.h>
#include <connect.h>
using namespace std;
+2 -2
View File
@@ -5,8 +5,8 @@
/// \version CAFE 1.0.0
///
#include "policyHelper.h"
#include "global.h"
#include <policyHelper.h>
#include <global.h>
using namespace std;
+1 -1
View File
@@ -7,7 +7,7 @@
#include "restorePVGroupXMLParser.h"
#include <restorePVGroupXMLParser.h>
#if HAVE_LIBQTXML
+115 -136
View File
@@ -8,7 +8,7 @@
#ifndef TRANSPOSE_CC
#define TRANSPOSE_CC
#include "transpose.h"
#include <transpose.h>
using namespace std;
@@ -108,8 +108,6 @@ int Transpose<dbr_string_t>::putString
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
for (unsigned int i=0; i<nelem; ++i) {
//Remove leading and blank spaces
@@ -690,58 +688,49 @@ int Transpose<dbr_string_t>::get(
break;
case DBR_ENUM:
for (unsigned int i=0; i<nelem; ++i) {
//Special treatment of ENUM: Transform VAL to String equivalent
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
{
//Special treatment of ENUM: Transform VAL to String equivalent
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStrings; ++j) {
if (strcmp(stig[j],"")==0) {
++noEmptyStrings;
}
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStrings; ++j) {
if (strcmp(stig[j],"")==0) {
++noEmptyStrings;
}
if (noStrings==noEmptyStrings) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
}
for (unsigned int i=0; i<nelem; ++i) {
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
}
else {
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
for (unsigned int j=0; j<noStrings; ++j) {
cout << stig[j] << " [" <<j << "] ";
}
cout << endl;
}
}
}
//if native DataType is ENUM then overwrite call Enum method and then convert to string!
//for (unsigned int i=0; i<nelem; ++i) {
// sprintf(val[i], "%s", stig[(*(&((PVDataL)->enmval)+i+offset))] );
// }
}
break;
if (noStrings==noEmptyStrings) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
}
for (unsigned int i=0; i<nelem; ++i) {
if ( ((*(&((PVDataL)->enmval)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
sprintf(val[i], "%s", stig[(*(&((PVDataL)->enmval)+i+offset))] );
}
else {
sprintf(val[i], "%d", (*(&((PVDataL)->enmval)+i+offset)) );
if ( ((*(&((PVDataL)->enmval)+i+offset)) >= noStrings) ) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->enmval)+i+offset)) << endl;
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
for (unsigned int j=0; j<noStrings; ++j) {
cout << stig[j] << " [" <<j << "] ";
}
cout << endl;
}
}
}
break;
}
case DBR_STRING:
memcpy( val, &(&((PVDataL)->strval))[offset], sizeof(dbr_string_t)*nelem) ;
break;
@@ -788,58 +777,49 @@ int Transpose<dbr_string_t>::get(
break;
case DBR_STS_ENUM:
for (unsigned int i=0; i<nelem; ++i) {
//Special treatment of ENUM: Transform VAL to String equivalent
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig)) ;
{
//Special treatment of ENUM: Transform VAL to String equivalent
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig)) ;
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStrings; ++j) {
if (strcmp(stig[j],"")==0) {
++noEmptyStrings;
}
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStrings; ++j) {
if (strcmp(stig[j],"")==0) {
++noEmptyStrings;
}
if (noStrings==noEmptyStrings) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
}
for (unsigned int i=0; i<nelem; ++i) {
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
}
else {
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
for (unsigned int j=0; j<noStrings; ++j) {
cout << stig[j] << " [" <<j << "] ";
}
cout << endl;
}
}
}
//if native DataType is ENUM then overwrite call Enum method and then convert to string!
//for (unsigned int i=0; i<nelem; ++i) {
// sprintf(val[i], "%s", stig[(*(&((PVDataL)->senmval.value)+i+offset))] );
//}
}
if (noStrings==noEmptyStrings) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
}
for (unsigned int i=0; i<nelem; ++i) {
if ( ((*(&((PVDataL)->senmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
sprintf(val[i], "%s", stig[(*(&((PVDataL)->senmval.value)+i+offset))] );
}
else {
sprintf(val[i], "%d", (*(&((PVDataL)->senmval.value)+i+offset)) );
if ( ((*(&((PVDataL)->senmval.value)+i+offset)) >= noStrings) ) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->senmval.value)+i+offset)) << endl;
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
for (unsigned int j=0; j<noStrings; ++j) {
cout << stig[j] << " [" <<j << "] ";
}
cout << endl;
}
}
}
alarmStatus = ((struct dbr_sts_enum *) PVDataL)->status;
alarmSeverity = ((struct dbr_sts_enum *) PVDataL)->severity;
break;
}
case DBR_STS_STRING:
for (unsigned int i=0; i<nelem; ++i) {
strcpy(val[i], (*(&((PVDataL)->sstrval.value)+i+offset))) ;
@@ -853,7 +833,6 @@ int Transpose<dbr_string_t>::get(
for (unsigned int i=0; i<nelem; ++i) {
sprintf(val[i], "%u", (*(&((PVDataL)->tchrval.value)+i+offset)));
}
//cout << "TRANSPOSE " << val[0] << endl;
ts = ((struct dbr_time_char *) PVDataL)->stamp;
alarmStatus = ((struct dbr_time_char *) PVDataL)->status;
alarmSeverity = ((struct dbr_time_char *) PVDataL)->severity;
@@ -899,56 +878,56 @@ int Transpose<dbr_string_t>::get(
break;
case DBR_TIME_ENUM:
for (unsigned int i=0; i<nelem; ++i) {
{
//Special treatment of ENUM: Transform VAL to String equivalent
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
//Special treatment of ENUM: Transform VAL to String equivalent
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
//if native DataType is ENUM then overwrite call Enum method and then convert to string!
//Check data type
//cout << "Classname " << (*it_handle).getChannelRegalia().getClassName() << endl;
//if native DataType is ENUM then overwrite call Enum method and then convert to string!
//Check data type
//cout << "Classname " << (*it_handle).getChannelRegalia().getClassName() << endl;
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStrings; ++j) {
if (strcmp(stig[j],"")==0) {
++noEmptyStrings;
}
}
if (noStrings==noEmptyStrings) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
}
for (unsigned int i=0; i<nelem; ++i) {
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
}
else {
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
for (unsigned int j=0; j<noStrings; ++j) {
cout << stig[j] << " [" <<j << "] ";
}
cout << endl;
}
}
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStrings; ++j) {
if (strcmp(stig[j],"")==0) {
++noEmptyStrings;
}
}
if (noStrings==noEmptyStrings) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
}
for (unsigned int i=0; i<nelem; ++i) {
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
}
else {
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
for (unsigned int j=0; j<noStrings; ++j) {
cout << stig[j] << " [" <<j << "] ";
}
cout << endl;
}
}
}
ts = ((struct dbr_time_enum *) PVDataL)->stamp;
alarmStatus = ((struct dbr_time_enum *) PVDataL)->status;
alarmSeverity = ((struct dbr_time_enum *) PVDataL)->severity;
break;
}
case DBR_TIME_STRING:
for (unsigned int i=0; i<nelem; ++i) {