additional methods to handleHelper
This commit is contained in:
@@ -26,7 +26,7 @@ export CAFE_EPICS_V_MINOR=$EBMIN
|
||||
export CAFE_EPICS_V_PATCH=$EBPAT
|
||||
|
||||
|
||||
CAFE_VERSION=cafe-1.3.0-final-1
|
||||
CAFE_VERSION=cafe-1.3.0-final-2
|
||||
|
||||
|
||||
./configure \
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -31,31 +31,31 @@ void callbackHandlerMonitor( struct event_handler_args args) {
|
||||
if (args.type < DBR_GR_STRING) {
|
||||
PVDataHolder pvd(args.count);
|
||||
(*it_handle).getPVDataHolder(pvd);
|
||||
pvd.print();
|
||||
cout << "val/D//= " << pvd.getAsString(0) << endl;
|
||||
//pvd.print();
|
||||
//cout << "val/D//= " << pvd.getAsString(0) << endl;
|
||||
|
||||
}
|
||||
else if (args.type < DBR_PUT_ACKT) {
|
||||
PVCtrlHolder pvc(args.count);
|
||||
(*it_handle).getPVCtrlHolder(pvc);
|
||||
pvc.print();
|
||||
cout << "val/C/= " << pvc.getAsString(0) << endl;
|
||||
//pvc.print();
|
||||
//cout << "val/C/= " << pvc.getAsString(0) << endl;
|
||||
}
|
||||
|
||||
|
||||
//cout << "args.usr = " << (unsigned int) args.usr << endl;
|
||||
//cout << "getUsrArgs() = " << (unsigned int) (*it_handle).getUsrArgs() << endl;
|
||||
|
||||
|
||||
/*
|
||||
vector<MonitorPolicy> mpV = (*it_handle).getMonitorPolicyVector();
|
||||
|
||||
|
||||
cout << args.usr << endl;
|
||||
cout << (*it_handle).getUsrArgs() << endl;
|
||||
|
||||
for (int i=0; i<mpV.size(); ++i) {
|
||||
|
||||
|
||||
for (int i=0; i<mpV.size(); ++i) {
|
||||
cout << " i " << i << endl;
|
||||
cout << mpV[i].getUserArgs() << endl;
|
||||
mpV[i].print();
|
||||
}
|
||||
|
||||
*/
|
||||
//**** END USER CODE ***//
|
||||
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void handlerPut( struct event_handler_args args) {
|
||||
|
||||
handle_index.modify(it_handle, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
|
||||
cout << __METHOD__ << " WITH_CALLBACK_USER_SUPLLIED for PUT done " << (*it_handle).getChannelRequestStatusPut().getCallbackProgressKind() << endl;
|
||||
//cout << __METHOD__ << " WITH_CALLBACK_USER_SUPLLIED for PUT done " << (*it_handle).getChannelRequestStatusPut().getCallbackProgressKind() << endl;
|
||||
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
@@ -155,22 +155,25 @@ void handlerGet( struct event_handler_args args) {
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
|
||||
//**** ADD USER CODE HERE ***//
|
||||
|
||||
|
||||
if (args.type < DBR_GR_STRING) {
|
||||
PVDataHolder pvd(args.count);
|
||||
(*it_handle).getPVDataHolder(pvd);
|
||||
pvd.print();
|
||||
cout << "val/D//= " << pvd.getAsString(0) << endl;
|
||||
//pvd.print();
|
||||
//cout << "val/D//= " << pvd.getAsString(0) << endl;
|
||||
|
||||
}
|
||||
else if (args.type < DBR_PUT_ACKT) {
|
||||
PVCtrlHolder pvc(args.count);
|
||||
(*it_handle).getPVCtrlHolder(pvc);
|
||||
pvc.print();
|
||||
cout << "val/C/= " << pvc.getAsString(0) << endl;
|
||||
//pvc.print();
|
||||
//cout << "val/C/= " << pvc.getAsString(0) << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**** END USER CODE ***//
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
#CAFE version to link to
|
||||
CAFE_VERSION=cafe-1.3.0-final-1
|
||||
CAFE_VERSION=cafe-1.3.0-final-2
|
||||
|
||||
#PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
|
||||
#PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
|
||||
|
||||
@@ -94,13 +94,22 @@ int getCache(const unsigned int _handle, vector<long long> & V,
|
||||
int getCache(const unsigned int _handle, vector<double> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//6
|
||||
|
||||
|
||||
//NON_BLOCKING
|
||||
int get(vector<unsigned int> handleV, vector<int> &statusV);
|
||||
|
||||
int getV(vector<unsigned int> handleV, vector<int> &statusV){
|
||||
status=get(handleV, statusV); ca_flush_io(); //Yes let's flush here!
|
||||
status=get(handleV, statusV); ca_flush_io(); //Yes let's flush here!
|
||||
return status;}
|
||||
|
||||
int get(vector<string> pvV, vector<int> &statusV) {
|
||||
vector<unsigned int> hV;
|
||||
hV.reserve(pvV.size());
|
||||
hV=handleHelper.getHandlesFromPVs(pvV);
|
||||
return get(hV, statusV);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int getScalars(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV){ //0
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
|
||||
@@ -40,6 +40,10 @@ class Connect
|
||||
CAFEStatus cafeStatus;
|
||||
CAFEStatusSeverity cafeStatusSeverity;
|
||||
|
||||
CAFEGlobalAlarmSeverity epicsAlarmSeverity;
|
||||
CAFEGlobalAlarmCondition epicsAlarmStatus;
|
||||
|
||||
|
||||
cafeConduit_set::iterator itcs;
|
||||
cafeGroup_set::iterator itgs;
|
||||
|
||||
@@ -140,6 +144,11 @@ class Connect
|
||||
CAFEStatus getCafeStatus() {return cafeStatus;}
|
||||
CAFEStatusSeverity getCafeStatusSeverity() {return cafeStatusSeverity;}
|
||||
|
||||
CAFEGlobalAlarmCondition getEpicsAlarmStatus() {return epicsAlarmStatus;}
|
||||
CAFEGlobalAlarmCondition getEpicsAlarmCondition() {return epicsAlarmStatus;}
|
||||
CAFEGlobalAlarmSeverity getEpicsAlarmSeverity() {return epicsAlarmSeverity;}
|
||||
|
||||
|
||||
int flushNow() {return ca_flush_io();}
|
||||
|
||||
int _ca_flush_io(){return ca_flush_io();}
|
||||
@@ -493,6 +502,13 @@ class Connect
|
||||
int printStatusIfError(vector<unsigned int> handleV, vector<int> statusV);
|
||||
|
||||
|
||||
int printStatus(const char *pv, int status);
|
||||
int printStatusIfError(const char *pv, int status);
|
||||
int printStatus(const char * pvArray, unsigned int nelem, int * statusArray);
|
||||
int printStatusIfError(const char * pvArray, unsigned int nelem, int * statusArray);
|
||||
int printStatus(vector<string> pvV, vector<int> statusV);
|
||||
int printStatusIfError(vector<string> pvV, vector<int> statusV);
|
||||
|
||||
int setPVAlias(unsigned int handle, const char * pv) throw (CAFEException_open);
|
||||
|
||||
// GROUP FUNCTIONS
|
||||
|
||||
@@ -83,6 +83,8 @@ class HandleHelper : public Helper {
|
||||
unsigned int getHandleFromPVAlias(const char * _pv);
|
||||
unsigned int getHandleFromPVAlias(const char * _pv, ca_client_context * ccc);
|
||||
|
||||
vector<unsigned int> getHandlesFromPVs(vector<string> pvV, ca_client_context * ccc);
|
||||
vector<unsigned int> getHandlesFromPVs(vector<string> pvV);
|
||||
|
||||
vector<unsigned int> getHandlesFromWithinGroupV(unsigned int gh);
|
||||
unsigned int * getHandlesFromWithinGroup(unsigned int gh);
|
||||
|
||||
@@ -764,15 +764,15 @@ template <class CTYPE> int Instant<CTYPE>::clientRequests(
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
union db_access_val * PVDataL;
|
||||
unsigned int nelem;
|
||||
//unsigned int offset;
|
||||
chtype dbrTypeRequest_DataBuffer;
|
||||
//union db_access_val * PVDataL;
|
||||
//unsigned int nelem;
|
||||
|
||||
//chtype dbrTypeRequest_DataBuffer;
|
||||
|
||||
PVDataL = (*it_handle).getPutBuffer ();
|
||||
nelem = (*it_handle).getChannelRequestMetaPrimitive().getNelem();
|
||||
//PVDataL = (*it_handle).getPutBuffer ();
|
||||
//nelem = (*it_handle).getChannelRequestMetaPrimitive().getNelem();
|
||||
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaPrimitive().getDbrDataType();
|
||||
//dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaPrimitive().getDbrDataType();
|
||||
|
||||
switch(_dbrType) {
|
||||
case DBR_STRING:
|
||||
@@ -805,15 +805,7 @@ template <class CTYPE> int Instant<CTYPE>::clientRequests(
|
||||
return ECAFE_INVALID_SWITCH_CASE;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
epicsTimeStamp ts;
|
||||
ts.secPastEpoch= 0; // default value if cache does not have timeStamp
|
||||
ts.nsec = 0; // default value if cache does not have timeStamp
|
||||
dbr_short_t alarmStatus =-1; // default value if cache does not have alarmStatus
|
||||
dbr_short_t alarmSeverity =-1; // default value if cache does not have alarmSeverity
|
||||
//helper function to set TimeStamps!
|
||||
helper.setSTS(_handle, alarmStatus, alarmSeverity, ts);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
@@ -186,7 +186,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/cpp/cafe-1.3.0-final-1/lib
|
||||
libdir = /opt/gfa/cafe/cpp/cafe-1.3.0-final-2/lib
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
@@ -195,7 +195,7 @@ mandir = ${datarootdir}/man
|
||||
mkdir_p = /bin/mkdir -p
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.3.0-final-1
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.3.0-final-2
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
|
||||
@@ -107,7 +107,8 @@ enum CAFE_ERROR_STATE { ECAFE_NODATA=ICAFE_STATUS_ERROR,
|
||||
ECAFE_INVALID_ENUM_INDEX,
|
||||
ECAFE_PVGROUP_GROUPHANDLE_MISMATCH,
|
||||
ECAFE_TIMEOUT_SET_AND_MATCH,
|
||||
ECAFE_HANDLE_MISMATCH_SET_AND_MATCH
|
||||
ECAFE_HANDLE_MISMATCH_SET_AND_MATCH,
|
||||
ECAFE_INCONSISTENT_CONTAINER_CORRECTED
|
||||
};
|
||||
|
||||
enum CAFE_FILE_ERROR { ECAFE_LOAD_COLLECTION=ICAFE_FILE_ERROR,
|
||||
@@ -415,6 +416,7 @@ public:
|
||||
* 1033 ECAFE_PVGROUP_GROUPHANDLE_MISMATCH \n
|
||||
* 1034 ECAFE_TIMEOUT_SET_AND_MATCH \n
|
||||
* 1035 ECAFE_HANDLE_MISMATCH_SET_AND_MATCH \n
|
||||
* 1036 ECAFE_INCONSISTENT_CONTAINER_CORRECTED \n
|
||||
* 1100 ECAFE_LOAD_COLLECTION \n
|
||||
* 1101 ECAFE_LOAD_GROUP \n
|
||||
* 1200 ECAFE_BPM_DATA_IS_INVALID \n
|
||||
@@ -507,7 +509,10 @@ public:
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_TIMEOUT_SET_AND_MATCH, "Readback channel did not reach set value within specified timeout period "));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_HANDLE_MISMATCH_SET_AND_MATCH, "Number of set/readback handles do not match"));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_LOAD_COLLECTION, "CAFE collection could not be loaded from xml configuration file " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_INCONSISTENT_CONTAINER_CORRECTED, "Boost container required update after consistency check"));
|
||||
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_LOAD_COLLECTION, "CAFE collection could not be loaded from xml configuration file " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "CAFE group could not be loaded from group xml configuration file " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_BPM_DATA_IS_INVALID, "CAFE BPM Service: Data Validity channel reports BPM data is INVALID " ));
|
||||
@@ -659,12 +664,15 @@ public:
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_HASH_UNIQUEID_EXISTS, "CAFE ERROR: ECAFE_HASH_UNIQUEID_EXISTS"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_WRONG_CA_CONTEXT, "CAFE ERROR: ECAFE_WRONG_CA_CONTEXT"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_CAFENUM_POLICY_TYPE, "CAFE ERROR: ECAFE_INVALID_CAFENUM_POLICY_TYPE"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED, "CAFE_ERROR: ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_ENUM_INDEX, "CAFE_ERROR: ECAFE_INVALID_ENUM_INDEX"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED, "CAFE_ERROR: ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_ENUM_INDEX, "CAFE_ERROR: ECAFE_INVALID_ENUM_INDEX"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_PVGROUP_GROUPHANDLE_MISMATCH, "CAFE ERROR:ECAFE_PVGROUP_GROUPHANDLE_MISMATCH"));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_TIMEOUT_SET_AND_MATCH, "CAFE ERROR: CAFE_TIMEOUT_SET_AND_MATCH"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_HANDLE_MISMATCH_SET_AND_MATCH, "CAFE ERROR: CAFE_HANDLE_MISMATCH_SET_AND_MATCH"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_INCONSISTENT_CONTAINER_CORRECTED,"CAFE ERROR: ECAFE_INCONSISTENT_CONTAINER_CORRECTED"));
|
||||
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_LOAD_COLLECTION, "CAFE ERROR: ECAFE_LOAD_COLLECTION"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "CAFE ERROR: ECAFE_LOAD_GROUP"));
|
||||
|
||||
@@ -871,6 +879,9 @@ public:
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_TIMEOUT_SET_AND_MATCH, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_HANDLE_MISMATCH_SET_AND_MATCH, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INCONSISTENT_CONTAINER_CORRECTED, "WARN"));
|
||||
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_LOAD_COLLECTION, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "ERROR"));
|
||||
|
||||
@@ -967,6 +978,10 @@ class CAFEStatus {
|
||||
strRet.append(csi.message(i));
|
||||
return (std::string) strRet;
|
||||
}
|
||||
|
||||
bool isTimeout(int i) {
|
||||
return csc.isTimeout(i);
|
||||
}
|
||||
|
||||
void report (int i) {
|
||||
std::cout << "------------------" << std::endl;
|
||||
|
||||
@@ -311,6 +311,12 @@ template <class CTYPE> int Transpose<CTYPE>::put(const unsigned int _handle,
|
||||
}//if noStrings>0
|
||||
|
||||
}//if
|
||||
|
||||
|
||||
//cout << "dbrTypeRequest_DataBuffer " << dbrTypeRequest_DataBuffer << endl;
|
||||
//cout << "_dbrType " << _dbrType << endl;
|
||||
|
||||
//cout << "nelem " << nelem << endl;
|
||||
|
||||
switch (dbrTypeRequest_DataBuffer)
|
||||
{
|
||||
@@ -444,9 +450,12 @@ template <class CTYPE> int Transpose<CTYPE>::put(const unsigned int _handle,
|
||||
}
|
||||
break;
|
||||
case DBR_DOUBLE: //6
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
*((dbr_float_t *) (PVDataL) + i ) = (dbr_float_t) val[i] ;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case DBR_STRING: //0
|
||||
status=putString(_handle, (dbr_string_t *) val);
|
||||
@@ -688,7 +697,7 @@ template <class CTYPE> int Transpose<CTYPE>::put(const unsigned int _handle,
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
cout << "status " << status << endl;
|
||||
|
||||
return status;
|
||||
|
||||
|
||||
4
makefile
4
makefile
@@ -227,7 +227,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/cpp/cafe-1.3.0-final-1/lib
|
||||
libdir = /opt/gfa/cafe/cpp/cafe-1.3.0-final-2/lib
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
@@ -236,7 +236,7 @@ mandir = ${datarootdir}/man
|
||||
mkdir_p = /bin/mkdir -p
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.3.0-final-1
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.3.0-final-2
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
|
||||
@@ -618,7 +618,7 @@ int CAFE::get(const char * pv, PVDataHolder & pvd) {
|
||||
int CAFE::get(const unsigned int handle, PVDataHolder & pvd) {
|
||||
#define __METHOD__ "CAFE::get(unsigned int handle, PVDataHolder & pvd)"
|
||||
|
||||
cout << __FILE__ << " " << __LINE__ << " " << __METHOD__ << endl;
|
||||
//cout << __FILE__ << " " << __LINE__ << " " << __METHOD__ << endl;
|
||||
|
||||
status=ICAFE_NORMAL;
|
||||
|
||||
|
||||
121
src/connect.cpp
121
src/connect.cpp
@@ -2298,6 +2298,127 @@ int Connect::monitorStart(vector<unsigned int> handleV, vector<int> &statusV,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief print status information of given pv
|
||||
* \param pv input: pv for which handle is to be matched \n
|
||||
* \param status input: reporting status \n
|
||||
* \return ECA_NORMAL if all OK else ECAFE_INVALID_HANDLE
|
||||
*/
|
||||
int Connect::printStatus(const char *pv, int status) {
|
||||
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
|
||||
if (handle==0) {
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
return Connect::printStatus(handle, status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief print status information of given pv only on error
|
||||
* \param pv input: pv for which handle is to be matched\n
|
||||
* \param status input: reporting status \n
|
||||
* \return ECA_NORMAL if all OK else ECAFE_INVALID_HANDLE
|
||||
*/
|
||||
int Connect::printStatusIfError(const char * pv, int status) {
|
||||
|
||||
if (status==ICAFE_NORMAL) {return ICAFE_NORMAL;};
|
||||
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
|
||||
if (handle==0) {
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
return Connect::printStatus(handle, status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief print status information of given PVs
|
||||
* \param pvV input: vector of pvs for which handles to conduit objects are to be matched\n
|
||||
* \param statusV input: vector of statuses \n
|
||||
* \return ECA_NORMAL if all OK else ECAFE_INVALID_HANDLE (if one or more handles are invalid)
|
||||
*/
|
||||
int Connect::printStatus(vector<string> pvV, vector<int> statusV) {
|
||||
|
||||
int overallStatus=ICAFE_NORMAL; bool isGood=true;
|
||||
int localStatus=ICAFE_NORMAL;
|
||||
for (unsigned int i=0; i < min(pvV.size(),statusV.size()); ++i) {
|
||||
localStatus=Connect::printStatus(pvV[i].c_str(), statusV[i]);
|
||||
if(isGood && localStatus!=ICAFE_NORMAL) {overallStatus=localStatus; isGood=false;}
|
||||
}
|
||||
return overallStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief print status information of given PVs only on error
|
||||
* \param pvV input: vector of PVs for which handles to Conduit objects are to be matched\n
|
||||
* \param statusV input: vector of statuses \n
|
||||
* \return ECA_NORMAL if all OK else ECAFE_INVALID_HANDLE (if one or more handles are invalid)
|
||||
*/
|
||||
int Connect::printStatusIfError(vector<string> pvV, vector<int> statusV) {
|
||||
int overallStatus=ICAFE_NORMAL; bool isGood=true;
|
||||
int localStatus=ICAFE_NORMAL;
|
||||
for (unsigned int i=0; i <min(pvV.size(),statusV.size()); ++i) {
|
||||
if (statusV[i]!=ICAFE_NORMAL) {
|
||||
localStatus=Connect::printStatus(pvV[i].c_str(), statusV[i]);
|
||||
if(isGood && localStatus!=ICAFE_NORMAL) {overallStatus=localStatus; isGood=false;}
|
||||
};
|
||||
}
|
||||
return overallStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief print status information of given PVs
|
||||
* \param pvArray input: array of PVs for which handles to conduit objects are to be matched\n
|
||||
* \param nelem input: size of array of PVs
|
||||
* \param statusArray input: array of statuses \n
|
||||
* \return ECA_NORMAL if all OK else ECAFE_INVALID_HANDLE (if one or more handles are invalid)
|
||||
*/
|
||||
int Connect::printStatus(const char * pvArray, unsigned int nelem, int *statusArray) {
|
||||
int overallStatus=ICAFE_NORMAL; bool isGood=true;
|
||||
int localStatus=ICAFE_NORMAL;
|
||||
for (unsigned int i=0; i <nelem; ++i) {
|
||||
localStatus=Connect::printStatus(pvArray[i], statusArray[i]);
|
||||
if(isGood && localStatus!=ICAFE_NORMAL) {overallStatus=localStatus; isGood=false;}
|
||||
}
|
||||
return overallStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief print status information of given PVs only on error
|
||||
* \param handleArray input: array of Handles to Conduit objects \n
|
||||
* \param nelem input: size of array of handles
|
||||
* \param statusArray input: array of statuses \n
|
||||
* \return ECA_NORMAL if all OK else ECAFE_INVALID_HANDLE (if one or more handles are invalid)
|
||||
*/
|
||||
int Connect::printStatusIfError(const char * pvArray, unsigned int nelem, int *statusArray) {
|
||||
int overallStatus=ICAFE_NORMAL; bool isGood=true;
|
||||
int localStatus=ICAFE_NORMAL;
|
||||
for (unsigned int i=0; i <nelem; ++i) {
|
||||
if (statusArray[i]!=ICAFE_NORMAL) {
|
||||
localStatus=Connect::printStatus(pvArray[i], statusArray[i]);
|
||||
if(isGood && localStatus!=ICAFE_NORMAL) {overallStatus=localStatus; isGood=false;}
|
||||
};
|
||||
}
|
||||
return overallStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Closes all channels within the given context and their respective handles \n
|
||||
* Shuts down the given channel access client context and frees allocated resources \n
|
||||
|
||||
@@ -100,16 +100,19 @@ int HandleHelper::checkConsistency(unsigned int _handle) {
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
std::cout << "Following Corrections Made:" << std::endl;
|
||||
std::cout << message << endl;
|
||||
}
|
||||
//else {
|
||||
// std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
// std::cout << "CA CONSISTENCY VERIFIED " << std::endl;
|
||||
//}
|
||||
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRegalia(chInfo));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRegalia(chInfo));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
return ECAFE_INCONSISTENT_CONTAINER_CORRECTED;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -1312,6 +1315,80 @@ int HandleHelper::getAlarmStatusSeverityAsString(unsigned int _handle, string as
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Rerieves vector of handles for given vector of PVs
|
||||
* \param pvV input: vector of PVS
|
||||
* \retun handleV output: vector of handles
|
||||
*/
|
||||
vector<unsigned int> HandleHelper::getHandlesFromPVs(vector<string> pvV) {
|
||||
|
||||
ca_client_context * ccc = ca_current_context();
|
||||
|
||||
return getHandlesFromPVs(pvV,ccc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Rerieves vector of handles for given vector of PVs
|
||||
* \param pvV input: vector of PVS
|
||||
* \param ccc input: ca_client_context *
|
||||
* \param handleV output: vector of handles
|
||||
* \return ICAFE_NORMAL if all OK else ECAFE_INVALID_HANDLE
|
||||
*/
|
||||
vector<unsigned int> HandleHelper::getHandlesFromPVs(vector<string> pvV, ca_client_context * ccc) {
|
||||
#define __METHOD__ "HandleHelper::getHandlesFromPVs()"
|
||||
|
||||
vector<unsigned int> handleV;
|
||||
|
||||
handleV.reserve(pvV.size());
|
||||
|
||||
|
||||
cafeConduit_set_by_pv & pv_index = cs.get<by_pv> ();
|
||||
cafeConduit_set_by_pv::iterator it_pv;
|
||||
|
||||
for (unsigned int i=0; i<pvV.size(); ++i) {
|
||||
|
||||
|
||||
char pv[PVNAME_SIZE];
|
||||
removeLeadingAndTrailingSpaces(pvV[i].c_str(), pv);
|
||||
|
||||
it_pv = pv_index.find(pv);
|
||||
|
||||
// Possibilities of getting a match!
|
||||
if (it_pv != pv_index.end()) {
|
||||
|
||||
// Examine ca_client_context noting that channels within a group don't count!
|
||||
if (ccc == (*it_pv).getClientContext() && (*it_pv).getGroupHandle()==0 ) {
|
||||
handleV.push_back((*it_pv).handle);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Loop through all elements and search for pv/ca_client_context match
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
if((*itcs).getGroupHandle()>0) {continue;} // Channels within a group don't count!
|
||||
|
||||
if (!strcmp((*itcs).getPV(), pvV[i].c_str()) && (*itcs).getClientContext()== ccc) {
|
||||
|
||||
handleV.push_back((*itcs).handle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
handleV.push_back(0);
|
||||
}
|
||||
} //for
|
||||
|
||||
|
||||
|
||||
return handleV;
|
||||
#undef __METHOD__
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Prints Conduit member values for all given handles
|
||||
* \return ICAFE_NORMAL if all OK else ECAFE_INVALID_HANDLE
|
||||
|
||||
@@ -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/cpp/cafe-1.3.0-final-1/lib
|
||||
libdir = /opt/gfa/cafe/cpp/cafe-1.3.0-final-2/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/cpp/cafe-1.3.0-final-1
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.3.0-final-2
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
|
||||
Reference in New Issue
Block a user