Initial commit
This commit is contained in:
299
include/PVCtrlHolder.h
Normal file
299
include/PVCtrlHolder.h
Normal file
@@ -0,0 +1,299 @@
|
||||
///
|
||||
/// \file PVCtrlHolder.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date November 2014
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef PVCTRLHOLDER_H
|
||||
#define PVCTRLHOLDER_H
|
||||
|
||||
#include <PVHolder.h>
|
||||
|
||||
|
||||
/**
|
||||
* \class PVCtrlHolder
|
||||
* \brief This class is the holder of values associated with the
|
||||
* EPICS DBR_CTRL_(dataType) control structure of a given handle/pv
|
||||
*/
|
||||
class PVCtrlHolder : public PVHolder {
|
||||
|
||||
friend class CAFE;
|
||||
friend class Connect;
|
||||
friend class Conduit;
|
||||
friend struct change_dataBufferPVCtrlHolder;
|
||||
friend struct change_dataBufferSize_CTRL;
|
||||
friend struct change_connectionHandlerArgs;
|
||||
friend struct change_pvAlias;
|
||||
|
||||
private:
|
||||
|
||||
short precision;
|
||||
char units[MAX_UNITS_SIZE];
|
||||
|
||||
CAFE_DATATYPE_UNION RISC_pad;
|
||||
CAFE_DATATYPE_UNION upperDispLimit;
|
||||
CAFE_DATATYPE_UNION lowerDispLimit;
|
||||
CAFE_DATATYPE_UNION upperAlarmLimit;
|
||||
CAFE_DATATYPE_UNION upperWarningLimit;
|
||||
CAFE_DATATYPE_UNION lowerWarningLimit;
|
||||
CAFE_DATATYPE_UNION lowerAlarmLimit;
|
||||
CAFE_DATATYPE_UNION upperCtrlLimit;
|
||||
CAFE_DATATYPE_UNION lowerCtrlLimit;
|
||||
|
||||
Helper helper;
|
||||
|
||||
public:
|
||||
|
||||
PVCtrlHolder(){
|
||||
alarmStatus=0; alarmSeverity=0; precision=0; status=ECA_NORMAL;
|
||||
nelem=1; size=1; rule=true; beamEventNo=0;
|
||||
hasAlarm=true;
|
||||
noStr=0; dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
strcpy(pv,""); strcpy(pvAlias,"");strcpy(device,""); strcpy(attrib,""); strcpy(units,"");
|
||||
|
||||
val.reset( new CAFE_DATATYPE_UNION[nelem] );
|
||||
val[0].d=0.00;
|
||||
};
|
||||
|
||||
PVCtrlHolder(unsigned int _sizeOfArray) {
|
||||
alarmStatus=0; alarmSeverity=0; precision=0; status=ECA_NORMAL;
|
||||
nelem=_sizeOfArray; size=_sizeOfArray; rule=true; beamEventNo=0;
|
||||
hasAlarm=true;
|
||||
noStr=0; dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
strcpy(pv,""); strcpy(pvAlias,"");strcpy(device,""); strcpy(attrib,""); strcpy(units,"");
|
||||
|
||||
val.reset( new CAFE_DATATYPE_UNION[nelem] );
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
val[i].d=0.0;
|
||||
};
|
||||
};
|
||||
|
||||
~PVCtrlHolder() {val.reset();};
|
||||
|
||||
void setHasAlarm(bool a) {
|
||||
hasAlarm=a;
|
||||
return;
|
||||
};
|
||||
|
||||
unsigned int setNelem (unsigned int _nelem) {
|
||||
_nelem>0 ? nelem=_nelem : nelem=1;
|
||||
|
||||
if (_nelem>size) {
|
||||
|
||||
size=_nelem;
|
||||
|
||||
val.reset( new CAFE_DATATYPE_UNION[size] );
|
||||
}
|
||||
|
||||
return nelem;
|
||||
};
|
||||
|
||||
short getPrecision() const {return precision;}
|
||||
|
||||
const char * getUnits() const {return units;}
|
||||
string getUnitsAsString() const {return (string) units;}
|
||||
short getNoEnumStrings () const {return noStr;};
|
||||
char * getEnumString(short indx) const {return (char *) strs[indx];};
|
||||
|
||||
|
||||
vector<std::string> getEnumStrings() const {
|
||||
|
||||
vector<std::string> vEnumStrings;
|
||||
|
||||
vEnumStrings.reserve(noStr>0?noStr:1);
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
vEnumStrings.push_back(strs[i]);
|
||||
}
|
||||
return vEnumStrings;
|
||||
};
|
||||
|
||||
|
||||
short getEnumFromString(string enumString){
|
||||
|
||||
short returnValue=-1;
|
||||
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
if (strcmp(enumString.c_str(), strs[i])==0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char pvStripped[MAX_ENUM_STRING_SIZE];
|
||||
helper.removeLeadingAndTrailingSpaces((char *) enumString.c_str(), pvStripped);
|
||||
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
if (strcmp(pvStripped, strs[i])==0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
cout << "*** WARNING FROM PvCtrlHolder.h ***" << endl;
|
||||
cout << "*** Method getEnumFromString(string enumString) ***" << endl;
|
||||
cout << "The given input string '" << enumString << "' was not recognized! " << endl;
|
||||
cout << "Valid values are: " << endl;
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
cout << i << ":" << strs[i] << endl;
|
||||
}
|
||||
|
||||
|
||||
return returnValue;
|
||||
|
||||
}
|
||||
|
||||
string getStringFromEnum(unsigned short enumValue) const{
|
||||
|
||||
string returnValue="";
|
||||
|
||||
if (enumValue<noStr) {
|
||||
return (string) strs[enumValue];
|
||||
}
|
||||
else {
|
||||
cout << "*** WARNING FROM PvCtrlHolder.h ***" << endl;
|
||||
cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << endl;
|
||||
cout << "The given input index " << enumValue << " exceeds the number of enum states " << noStr << endl;
|
||||
cout << "Valid values are: " << endl;
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
cout << i << ":" << strs[i] << endl;
|
||||
}
|
||||
|
||||
if (enumValue<MAX_ENUM_STATES) {
|
||||
return (string) strs[enumValue];
|
||||
}
|
||||
else {
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
CafeDataTypeHelper getRISC_pad() {CafeDataTypeHelper cdth(RISC_pad, dataType); return cdth;}
|
||||
CafeDataTypeHelper getUpperDispLimit() {CafeDataTypeHelper cdth(upperDispLimit, dataType); return cdth;}
|
||||
CafeDataTypeHelper getLowerDispLimit() {CafeDataTypeHelper cdth(lowerDispLimit, dataType); return cdth;}
|
||||
CafeDataTypeHelper getUpperAlarmLimit() {CafeDataTypeHelper cdth(upperAlarmLimit, dataType); return cdth;}
|
||||
CafeDataTypeHelper getUpperWarningLimit() {CafeDataTypeHelper cdth(upperWarningLimit, dataType); return cdth;}
|
||||
CafeDataTypeHelper getLowerWarningLimit() {CafeDataTypeHelper cdth(lowerWarningLimit, dataType); return cdth;}
|
||||
CafeDataTypeHelper getLowerAlarmLimit() {CafeDataTypeHelper cdth(lowerAlarmLimit, dataType); return cdth;}
|
||||
CafeDataTypeHelper getUpperCtrlLimit() {CafeDataTypeHelper cdth(upperCtrlLimit, dataType); return cdth;}
|
||||
CafeDataTypeHelper getLowerCtrlLimit() {CafeDataTypeHelper cdth(lowerCtrlLimit, dataType); return cdth;}
|
||||
|
||||
|
||||
|
||||
string getUpperDispLimit_AsString() { return getAsString(upperDispLimit); }
|
||||
string getLowerDispLimit_AsString() { return getAsString(lowerDispLimit); }
|
||||
string getUpperAlarmLimit_AsString() { return getAsString(upperAlarmLimit); }
|
||||
string getUpperWarningLimit_AsString() { return getAsString(upperWarningLimit); }
|
||||
string getLowerWarningLimit_AsString() { return getAsString(lowerWarningLimit); }
|
||||
string getLowerAlarmLimit_AsString() { return getAsString(lowerAlarmLimit); }
|
||||
string getUpperCtrlLimit_AsString() { return getAsString(upperCtrlLimit); }
|
||||
string getLowerCtrlLimit_AsString() { return getAsString(lowerCtrlLimit); }
|
||||
|
||||
double getUpperDispLimit_AsDouble() { return getAsDouble(upperDispLimit); }
|
||||
double getLowerDispLimit_AsDouble() { return getAsDouble(lowerDispLimit); }
|
||||
double getUpperAlarmLimit_AsDouble() { return getAsDouble(upperAlarmLimit); }
|
||||
double getUpperWarningLimit_AsDouble() { return getAsDouble(upperWarningLimit); }
|
||||
double getLowerWarningLimit_AsDouble() { return getAsDouble(lowerWarningLimit); }
|
||||
double getLowerAlarmLimit_AsDouble() { return getAsDouble(lowerAlarmLimit); }
|
||||
double getUpperCtrlLimit_AsDouble() { return getAsDouble(upperCtrlLimit); }
|
||||
double getLowerCtrlLimit_AsDouble() { return getAsDouble(lowerCtrlLimit); }
|
||||
|
||||
void print() {
|
||||
print(nelem) ;
|
||||
}
|
||||
|
||||
void print(unsigned int nelemToPrint) {
|
||||
|
||||
nelemToPrint=min(nelemToPrint,nelem);
|
||||
std::cout << "------------------------------------------" << std::endl;
|
||||
std::cout << "PVCtrlHolder:" << std::endl;
|
||||
std::cout << "processVariable= " << pv << std::endl;
|
||||
if (strcmp(pvAlias,pv)) {
|
||||
std::cout << "pvAlias = " << pvAlias << std::endl;
|
||||
}
|
||||
std::cout << "device = " << device << std::endl;
|
||||
std::cout << "attrib = " << attrib << std::endl;
|
||||
std::cout << "dataType = " << cafeDataTypeCode.message(dataType).c_str()
|
||||
<< " (" << dataType << ") " << std::endl;
|
||||
std::cout << "dbrTypeRequest = " << dbr_type_to_text(dbrDataType)<< std::endl;
|
||||
if (dataType!=CAFE_NO_ACCESS || dataType != CAFE_TYPENOTCONN) {
|
||||
std::cout << "nelem = " << nelem << std::endl;
|
||||
|
||||
std::cout << "alarmStatus = " << alarmStatus << std::endl;
|
||||
std::cout << "alarmSeverity = " << alarmSeverity << std::endl;
|
||||
std::cout << "precision = " << precision << std::endl;
|
||||
std::cout << "units = " << units << std::endl;
|
||||
/*
|
||||
if (dataType==CAFE_DOUBLE){
|
||||
std::cout << "RISC_Pad0 = " << (dbr_short_t) RISC_pad.d << std::endl
|
||||
// in dbr_ctrl_double this is a RISC_pad
|
||||
}
|
||||
else if (dataType==CAFE_CHAR) {
|
||||
std::cout << "RISC_Pad = " << (unsigned short) RISC_pad.ch << std::endl;
|
||||
}
|
||||
else if (dataType==CAFE_FLOAT) {
|
||||
std::cout << "RISC_Pad = " << (dbr_short_t) RISC_pad.f << std::endl;
|
||||
}
|
||||
*/
|
||||
if (dataType!=CAFE_ENUM) {
|
||||
std::cout << "upperDispLimit = " << getAsString(upperDispLimit) << std::endl;
|
||||
std::cout << "lowerDispLimit = " << getAsString(lowerDispLimit) << std::endl;
|
||||
std::cout << "upperAlarmLimit= " << getAsString(upperAlarmLimit) << std::endl;
|
||||
std::cout << "upperWarnLimit = " << getAsString(upperWarningLimit) << std::endl;
|
||||
std::cout << "lowerWarnLimit = " << getAsString(lowerWarningLimit) << std::endl;
|
||||
std::cout << "lowerAlarmLimit= " << getAsString(lowerAlarmLimit) << std::endl;
|
||||
if(dbr_type_is_CTRL(dbrDataType)) {
|
||||
std::cout << "upperCtrlLimit = " << getAsString(upperCtrlLimit) << std::endl;
|
||||
std::cout << "lowerCtrlLimit = " << getAsString(lowerCtrlLimit) << std::endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << "NoStr (ENUM) = " << noStr << std::endl;
|
||||
std::cout << "strs (ENUM) = " ;
|
||||
for (short i=0; i< noStr; ++i) {std::cout << "{" << strs[i] << "} " ;}
|
||||
cout <<std::endl;
|
||||
}
|
||||
|
||||
std::cout << "status = " << cafeStatusCode.message(status).c_str() << std::endl;
|
||||
if(nelem>0) {std::cout << "value(s) = " ;}
|
||||
|
||||
switch (dataType) {
|
||||
case CAFE_STRING:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].str << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].s << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].f << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout <<
|
||||
getAsString(i) << " (" << val[i].us << ")" << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << (unsigned short) val[i].ch << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].l << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_DOUBLE:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].d << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_NO_ACCESS:
|
||||
default:
|
||||
std::cout << "DATA_TYPE NOT YET DEFINED " << endl;
|
||||
break;
|
||||
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << "------------------------------------------" << std::endl;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif // PVCTRLHOLDER_H
|
||||
236
include/PVDataHolder.h
Normal file
236
include/PVDataHolder.h
Normal file
@@ -0,0 +1,236 @@
|
||||
///
|
||||
/// \file PVDataHolder.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date November 2014
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef PVDATAHOLDER_H
|
||||
#define PVDATAHOLDER_H
|
||||
|
||||
#include <PVHolder.h>
|
||||
|
||||
/**
|
||||
* \class PVDataHolder
|
||||
* \brief This class is the holder of data values associated with
|
||||
* the EPICS DBR_TIME_(dataType) structure of a given handle/pv
|
||||
*/
|
||||
class PVDataHolder : public PVHolder {
|
||||
|
||||
friend class CAFE;
|
||||
friend class PVGroup;
|
||||
friend class Connect;
|
||||
friend class Conduit;
|
||||
//if HAVE_LIBQTXML
|
||||
friend class loadCollectionXMLParser;
|
||||
friend class restorePVGroupXMLParser;
|
||||
//endif
|
||||
friend struct change_dataBufferPVDataHolder;
|
||||
friend struct change_dataBufferSize_TIME;
|
||||
friend struct change_connectionHandlerArgs;
|
||||
friend struct change_pvAlias;
|
||||
|
||||
//private:
|
||||
//epicsTimeStamp ts;
|
||||
//bool hasTS;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
epicsTimeStamp ts;
|
||||
bool hasTS;
|
||||
|
||||
|
||||
//Derived class does not inherit constructors
|
||||
PVDataHolder(unsigned int _sizeOfArray) {
|
||||
|
||||
alarmStatus=0; alarmSeverity=0; status=ECAFE_NODATA;
|
||||
nelem= _sizeOfArray > 0 ? _sizeOfArray : 1;
|
||||
size = _sizeOfArray > 0 ? _sizeOfArray : 1;
|
||||
|
||||
dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
rule=true; beamEventNo=0; userNo=0; ts.nsec=0; ts.secPastEpoch=0;
|
||||
hasAlarm=true; hasTS=true;
|
||||
strcpy(pv,""); strcpy(pvAlias,""); strcpy(device,""); strcpy(attrib,"");
|
||||
|
||||
val.reset( new CAFE_DATATYPE_UNION[nelem] );
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
val[i].d=0.0;
|
||||
};
|
||||
};
|
||||
|
||||
PVDataHolder(){
|
||||
|
||||
alarmStatus=0; alarmSeverity=0; status=ECAFE_NODATA; nelem=1; size=1;
|
||||
dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
|
||||
rule=true; beamEventNo=0; userNo=0; ts.nsec=0; ts.secPastEpoch =0;
|
||||
hasAlarm=true; hasTS=true;
|
||||
strcpy(pv,""); strcpy(pvAlias,""); strcpy(device,""); strcpy(attrib,"");
|
||||
|
||||
val.reset( new CAFE_DATATYPE_UNION[nelem] );
|
||||
|
||||
val[0].d=0.00;
|
||||
};
|
||||
|
||||
~PVDataHolder() {
|
||||
|
||||
val.reset();
|
||||
};
|
||||
|
||||
void valReset() {
|
||||
|
||||
val.reset();
|
||||
}
|
||||
|
||||
|
||||
void setHasAlarm(bool a) {
|
||||
hasAlarm=a;
|
||||
return;
|
||||
};
|
||||
|
||||
void setHasTS(bool t){
|
||||
hasTS=t;
|
||||
if (t) {hasAlarm=t;} //TS will also retrieve alarmStatus
|
||||
return;
|
||||
}
|
||||
|
||||
bool getHasTS(){
|
||||
return hasTS;
|
||||
}
|
||||
|
||||
unsigned int setNelem (unsigned int _nelem) {
|
||||
|
||||
_nelem>0 ? nelem=_nelem : nelem=1;
|
||||
|
||||
if (nelem>size) {
|
||||
size=nelem;
|
||||
val.reset( new CAFE_DATATYPE_UNION[size] );
|
||||
}
|
||||
|
||||
return nelem;
|
||||
};
|
||||
|
||||
epicsTimeStamp getEpicsTimeStamp() const {return ts;};
|
||||
|
||||
struct etsNorm{ unsigned int secPastEpoch; unsigned int nsec;} _etsNorm;
|
||||
struct etsDate{ unsigned short year; unsigned short mon; unsigned short day;
|
||||
unsigned short hour; unsigned short min; unsigned short sec; unsigned int nsec;} _etsDate ;
|
||||
|
||||
etsNorm getEpicsTimeStampAsUInt32() {
|
||||
_etsNorm.secPastEpoch=ts.secPastEpoch;
|
||||
_etsNorm.nsec=(unsigned long) ts.nsec;
|
||||
return _etsNorm;};
|
||||
|
||||
etsDate getEpicsTimeStampAsDate() {
|
||||
|
||||
ts.nsec=(unsigned int) ts.nsec;
|
||||
|
||||
//This may happen in timeouts; epicsTime convertor will report overflow error
|
||||
//However this possibility is now captured in conduitFriend.h and other
|
||||
if(ts.nsec >= 1000000000) {
|
||||
cout << "OVERFLOW IN gets.nsec CORRECTED for epicsTime converter " << endl; ts.nsec=0;
|
||||
}
|
||||
|
||||
epicsTime time(ts);
|
||||
|
||||
local_tm_nano_sec local = (local_tm_nano_sec) time;
|
||||
_etsDate.year = local.ansi_tm.tm_year + 1900;
|
||||
_etsDate.mon = local.ansi_tm.tm_mon + 1;
|
||||
_etsDate.day = local.ansi_tm.tm_mday;
|
||||
_etsDate.hour = local.ansi_tm.tm_hour;
|
||||
_etsDate.min = local.ansi_tm.tm_min;
|
||||
_etsDate.sec = local.ansi_tm.tm_sec;
|
||||
_etsDate.nsec = (unsigned long) ts.nsec;
|
||||
return _etsDate;
|
||||
}
|
||||
|
||||
void print() {
|
||||
print(nelem) ;
|
||||
}
|
||||
|
||||
void print(unsigned int nelemToPrint) {
|
||||
nelemToPrint=min(nelemToPrint,nelem);
|
||||
if (pv==NULL) {
|
||||
std::cout << "Process Variable NOT ASSIGNED!" << std::endl;
|
||||
std::cout << "Variable has not been applied to a get operation!" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::cout << "------------------------------------------" << std::endl;
|
||||
//std::cout << "PVDataHolder:" << std::endl;
|
||||
|
||||
|
||||
std::cout << "processVariable= " << pv << std::endl;
|
||||
if (strcmp(pvAlias,pv) && strcmp(pvAlias,"")) {
|
||||
std::cout << "pvAlias = " << pvAlias << std::endl;
|
||||
}
|
||||
std::cout << "device = " << device << std::endl;
|
||||
std::cout << "attrib = " << attrib << std::endl;
|
||||
std::cout << "dataType = " << cafeDataTypeCode.message(dataType).c_str()
|
||||
<< " (" << dataType << ") " << std::endl;
|
||||
std::cout << "dbrTypeRequest = " << dbr_type_to_text(dbrDataType)<< std::endl;
|
||||
|
||||
//std::cout << "dataType = " << CAFEDataTypeCode.message(dataType).c_str() << std::endl;
|
||||
|
||||
if (dataType != CAFE_NO_ACCESS && dataType != CAFE_TYPENOTCONN) {
|
||||
std::cout << "nelem = ";
|
||||
}
|
||||
else {
|
||||
std::cout << "nelem = ";
|
||||
}
|
||||
std::cout << nelem; std::cout << std::endl;
|
||||
if(!rule) {
|
||||
std::cout << "rule (0=false) = " << rule <<std::endl;
|
||||
}
|
||||
|
||||
if (dbr_type_is_STS(dbrDataType) || dbr_type_is_TIME(dbrDataType) ) {
|
||||
std::cout << "alarmStatus = " << alarmStatus << std::endl;
|
||||
std::cout << "alarmSeverity = " << alarmSeverity << std::endl;
|
||||
|
||||
if (dbr_type_is_TIME(dbrDataType)) {
|
||||
std::cout << "epicsTimeStamp = " << ts.secPastEpoch << " sec. and " << ts.nsec << " nsec" << std::endl;
|
||||
}
|
||||
}
|
||||
if(beamEventNo!=0) {std::cout << "beamEventNo = " << beamEventNo << std::endl;};
|
||||
std::cout << "status = " << cafeStatusCode.message(status).c_str() << std::endl;
|
||||
std::cout << "value(s) = " ;
|
||||
|
||||
switch (dataType) {
|
||||
case CAFE_STRING:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].str << " [" << i << "] " ;
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].s << " [" << i << "] " ;
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].f << " [" << i << "] " ;
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) { std::cout <<
|
||||
getAsString(i) << " (" << val[i].us << ")" << " [" << i << "] " ;}
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << (unsigned short) val[i].ch << " [" << i << "] " ;
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].l << " [" << i << "] " ;
|
||||
break;
|
||||
case CAFE_DOUBLE:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].d << " [" << i << "] " ;
|
||||
break;
|
||||
case CAFE_NO_ACCESS:
|
||||
std::cout << "DATA_TYPE NOT YET DEFINED " << endl;
|
||||
default:
|
||||
break;
|
||||
|
||||
};
|
||||
std::cout << std::endl;
|
||||
std::cout << "------------------------------------------" << std::endl;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif //PVDATAHOLDER_H
|
||||
196
include/PVGroup.h
Normal file
196
include/PVGroup.h
Normal file
@@ -0,0 +1,196 @@
|
||||
///
|
||||
/// \file PVGroup.h
|
||||
///
|
||||
/// \author Jan Chrin
|
||||
/// \date November 2014
|
||||
///
|
||||
|
||||
#ifndef PVGROUP_H
|
||||
#define PVGROUP_H
|
||||
|
||||
|
||||
#include <PVDataHolder.h>
|
||||
|
||||
|
||||
/**
|
||||
* class MemberMap
|
||||
* maps string to index
|
||||
*/
|
||||
class MemberMap {
|
||||
typedef std::map<long, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapNameIndex;
|
||||
mapLongString::iterator pos;
|
||||
Helper helper;
|
||||
|
||||
public:
|
||||
MemberMap(){};
|
||||
~MemberMap(){};
|
||||
|
||||
void insert(int a, std::string _Name) {
|
||||
mapNameIndex.insert(std::make_pair(a, _Name));
|
||||
};
|
||||
|
||||
std::string getPV (int i) {
|
||||
|
||||
pos = mapNameIndex.find(i);
|
||||
if (pos != mapNameIndex.end()) return pos->second;
|
||||
cout << "Index " << i << " not found! Size of group vector is " << mapNameIndex.size() << endl;
|
||||
return "";
|
||||
};
|
||||
|
||||
int getIndex (std::string _Name) {
|
||||
char pvStripped[PVNAME_SIZE];
|
||||
helper.removeLeadingAndTrailingSpaces(_Name.c_str(), pvStripped);
|
||||
string Name=pvStripped;
|
||||
|
||||
for (pos=mapNameIndex.begin(); pos != mapNameIndex.end(); ++pos) {
|
||||
|
||||
if (pos->second==Name) {return pos->first;}
|
||||
// String searches such as s.find(s1) return string::npos on failure
|
||||
//else if ( (pos->second).find(Name) != std::string::npos) return pos->first;
|
||||
}
|
||||
cout << "PV: " << Name << " IS NOT A MEMBER OF THIS LIST " << endl;
|
||||
return -1;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* class PVGroup
|
||||
* This class is the holder of PVDataHolder objects associated with
|
||||
* of group of handles
|
||||
*/
|
||||
class PVGroup {
|
||||
friend class Connect;
|
||||
friend class CAFE;
|
||||
//if HAVE_LIBQTXML
|
||||
friend class restorePVGroupXMLParser;
|
||||
//endif
|
||||
private:
|
||||
PVDataHolder * pvdata;
|
||||
unsigned int npv;
|
||||
char name [PVGROUP_PSEUDO_SIZE];
|
||||
int statusGroup;
|
||||
unsigned int groupHandle;
|
||||
bool isIndexOutOfRange (unsigned int idx) {
|
||||
return (idx >= npv) ? true:false;
|
||||
};
|
||||
MemberMap memberMap;
|
||||
|
||||
public:
|
||||
//Initialize 1st two to avoid compiler warning messages
|
||||
PVGroup(){npv=0; pvdata=NULL; statusGroup=ICAFE_NORMAL; groupHandle=0; strcpy(name,"");};
|
||||
~PVGroup(){};
|
||||
MemberMap getMemberMap() const {return memberMap;};
|
||||
PVDataHolder * getPVData() const {return pvdata;};
|
||||
PVDataHolder getPVData(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx <<
|
||||
" to PVGroup.pvdata() is out of range. Valid range is from 0 to " << npv-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return pvdata[idx];
|
||||
};
|
||||
void setHasAlarm(bool h){ for (unsigned int i=0; i<npv; ++i) {pvdata[i].setHasAlarm(h);} }
|
||||
void setHasTS(bool h){ for (unsigned int i=0; i<npv; ++i) {pvdata[i].setHasTS(h);} }
|
||||
|
||||
unsigned int getNPV() const {return npv;};
|
||||
string getNameAsString() const {return name;};
|
||||
const char * getName() const {return (const char *) name;};
|
||||
int getStatusGroup() const {return statusGroup;};
|
||||
int getGroupStatus() const {return statusGroup;};
|
||||
unsigned int getGroupHandle() const {return groupHandle;};
|
||||
|
||||
int PV2Index(std::string _pv) const {return getMemberMap().getIndex(_pv);}
|
||||
string Index2PV(unsigned int _idx) const {return getMemberMap().getPV(_idx);}
|
||||
|
||||
void setPVData(PVDataHolder * _pvdata) {
|
||||
|
||||
//We do not need to make a deep copy
|
||||
/*
|
||||
for (unsigned int i=0; i<npv; ++i) {
|
||||
pvdata[i].alarmStatus=_pvdata[i].alarmStatus;
|
||||
pvdata[i].alarmSeverity=_pvdata[i].alarmSeverity;
|
||||
pvdata[i].status=_pvdata[i].status;
|
||||
pvdata[i].nelem=_pvdata[i].nelem;
|
||||
pvdata[i].size=_pvdata[i].size;
|
||||
pvdata[i].dataType=_pvdata[i].dataType;
|
||||
pvdata[i].dataTypeNative=_pvdata[i].dataTypeNative;
|
||||
pvdata[i].rule=_pvdata[i].rule;
|
||||
pvdata[i].beamEventNo=_pvdata[i].beamEventNo;
|
||||
pvdata[i].userNo=_pvdata[i].userNo;
|
||||
pvdata[i].ts.nsec=_pvdata[i].ts.nsec;
|
||||
pvdata[i].ts.secPastEpoch=_pvdata[i].ts.secPastEpoch;
|
||||
strcpy(pvdata[i].pv,_pvdata[i].pv);
|
||||
strcpy(pvdata[i].pvAlias,_pvdata[i].pvAlias);
|
||||
strcpy(pvdata[i].device,_pvdata[i].device);
|
||||
strcpy(pvdata[i].attrib,_pvdata[i].attrib);
|
||||
}
|
||||
*/
|
||||
|
||||
//Shallow copy will do
|
||||
pvdata=_pvdata;
|
||||
};
|
||||
|
||||
void set(unsigned int _npv) {npv=_npv;};
|
||||
void setName(const char * _name) {strcpy(name, _name);};
|
||||
void setName(string _name) {strcpy(name,_name.c_str());};
|
||||
void setStatusGroup(int _sg) {statusGroup=_sg;}
|
||||
|
||||
|
||||
void show() {print(npv) ;}
|
||||
void showMax(unsigned int npvToPrint){print(npvToPrint);}
|
||||
void showMaxMax(unsigned int npvToPrint, unsigned int maxNelemWF){
|
||||
print(npvToPrint, maxNelemWF);}
|
||||
|
||||
void print() {print(npv) ;}
|
||||
void print(unsigned int npvToPrint) {
|
||||
npvToPrint=min(npvToPrint,npv);
|
||||
std::cout << "------------ PVGroup Handle = " << groupHandle << " ------------ "<< std::endl;
|
||||
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
|
||||
std::cout << "PRINTING THE REQUESTED " << npvToPrint << " MEMBERS " << std::endl;
|
||||
std::cout << "OVERALL STATUS OF GROUP REPORTS " << statusGroup << std::endl;
|
||||
if (statusGroup!=ICAFE_NORMAL) {
|
||||
CAFEStatus cstat; cstat.report(statusGroup);
|
||||
}
|
||||
for (unsigned int i=0; i<npvToPrint; ++i) {
|
||||
pvdata[i].print();
|
||||
}
|
||||
}
|
||||
void print(unsigned int npvToPrint, unsigned int maxNelemWF) {
|
||||
npvToPrint=min(npvToPrint,npv);
|
||||
std::cout << "------------ PVGroup Handle = " << groupHandle << " ------------ "<< std::endl;
|
||||
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
|
||||
std::cout << "PRINTING THE REQUESTED " << npvToPrint << " MEMBERS " << std::endl;
|
||||
std::cout << "OVERALL STATUS OF GROUP REPORTS " << statusGroup << std::endl;
|
||||
if (statusGroup!=ICAFE_NORMAL) {
|
||||
CAFEStatus cstat; cstat.report(statusGroup);
|
||||
}
|
||||
for (unsigned int i=0; i<npvToPrint; ++i) {
|
||||
pvdata[i].print(min(maxNelemWF,pvdata[i].getNelem()));
|
||||
}
|
||||
}
|
||||
|
||||
void printIfError() {
|
||||
unsigned int npvToPrint=npv;
|
||||
bool iErrorFound=false;
|
||||
for (unsigned int i=0; i<npvToPrint; ++i) {
|
||||
if (pvdata[i].getStatus() != ICAFE_NORMAL) {
|
||||
if(!iErrorFound) {
|
||||
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
|
||||
std::cout << "PRINTING PV TRANSACTIONS WITH ERRORS " << std::endl;
|
||||
iErrorFound=true;
|
||||
}
|
||||
cout << "------------------------------------------------------------" << endl;
|
||||
cout << "Element [" << i << "] of " << npv << " in group: " << name << endl;
|
||||
pvdata[i].print();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //PVGROUP_H
|
||||
889
include/PVHolder.h
Normal file
889
include/PVHolder.h
Normal file
@@ -0,0 +1,889 @@
|
||||
///
|
||||
/// \file PVHolder.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef PVHOLDER_H
|
||||
#define PVHOLDER_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <cafeConvert.h>
|
||||
#include <statusCodes.h>
|
||||
#include <helper.h>
|
||||
#include <defines.h>
|
||||
#include <cafeDataTypeHelper.h>
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
//include <boost/smart_ptr/make_unique.hpp> boost 1.57
|
||||
//include <boost/interprocess/smart_ptr/unique_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
/**
|
||||
* \class PVHolder
|
||||
* \brief The base class from which the PVDataHolder and PVCtrlHolder
|
||||
* classes are derived
|
||||
*/
|
||||
class PVHolder {
|
||||
|
||||
protected:
|
||||
char pv [PVNAME_SIZE];
|
||||
char pvAlias[PVNAME_SIZE];
|
||||
char device [PVNAME_SIZE];
|
||||
char attrib [PVNAME_SIZE];
|
||||
|
||||
CAFE_DATATYPE dataTypeNative; //enum
|
||||
CAFE_DATATYPE dataType; //enum
|
||||
CAFEDataTypeCode cafeDataTypeCode; //class enum<->string mapping
|
||||
CAFEStatusCode cafeStatusCode;
|
||||
|
||||
chtype dbrDataType; //dbrTypeRequest_DataBuffer;
|
||||
|
||||
unsigned int size;
|
||||
unsigned int nelem;
|
||||
//unsigned int nelemNative;
|
||||
short alarmStatus; //alarm.h 0-22 0=NO_ALARM
|
||||
short alarmSeverity; //alarm.h 0=NO_ALARM 1=MINOR 2=MAJOR 3=INVALID
|
||||
|
||||
unsigned int userNo; //e.g. add handle
|
||||
|
||||
unsigned int beamEventNo;
|
||||
//rule is used for synchronous groups only
|
||||
bool rule; // to set/get or not to set/get channel; default: true (i.e. set)
|
||||
bool hasAlarm;
|
||||
int status;
|
||||
|
||||
short noStr; // for enum
|
||||
char strs [MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];
|
||||
|
||||
CAFEConvert<double> renderDouble;
|
||||
CAFEConvert<float> renderFloat;
|
||||
CAFEConvert<short> renderShort;
|
||||
CAFEConvert<int> renderLong;
|
||||
CAFEConvert<unsigned short> renderEnum;
|
||||
CAFEConvert<unsigned char> renderUChar;
|
||||
CAFEConvert<dbr_string_t> renderString;
|
||||
|
||||
CAFEConvert<char> renderChar;
|
||||
CAFEConvert<unsigned int> renderULong;
|
||||
CAFEConvert<long long> renderLongLong;
|
||||
CAFEConvert<unsigned long long> renderULongLong;
|
||||
|
||||
CAFEConvert<int> renderInt;
|
||||
CAFEConvert<unsigned int> renderUInt;
|
||||
|
||||
|
||||
void verifyIndex(unsigned int idx) {
|
||||
if(idx >= size) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
};
|
||||
|
||||
bool isIndexOutOfRange (unsigned int idx) {
|
||||
return (idx >= size) ? true:false;
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef boost::shared_ptr<CAFE_DATATYPE_UNION []> ValPtr;
|
||||
|
||||
ValPtr val;
|
||||
|
||||
boost::shared_ptr<vector<double> > ValVD_ptr;
|
||||
boost::shared_ptr<vector<float> > ValVF_ptr;
|
||||
//boost::shared_ptr<vector<short> > ValVS_ptr;
|
||||
boost::shared_ptr<vector<int> > ValVI_ptr;
|
||||
//boost::shared_ptr<vector<unsigned char> > ValVC_ptr;
|
||||
//boost::shared_ptr<vector<unsigned short> > ValVUS_ptr;
|
||||
boost::shared_ptr<vector<string> > ValVStr_ptr;
|
||||
|
||||
typedef boost::shared_ptr<double []> ValDPtr;
|
||||
typedef boost::shared_ptr<float []> ValFPtr;
|
||||
typedef boost::shared_ptr<short []> ValSPtr;
|
||||
typedef boost::shared_ptr<int []> ValIPtr;
|
||||
typedef boost::shared_ptr<unsigned char []> ValChPtr;
|
||||
typedef boost::shared_ptr<unsigned short []> ValUSPtr;
|
||||
typedef boost::shared_ptr<dbr_string_t []> ValStrPtr;
|
||||
|
||||
ValDPtr ValD_ptr;
|
||||
ValFPtr ValF_ptr;
|
||||
ValSPtr ValS_ptr;
|
||||
ValIPtr ValI_ptr;
|
||||
ValChPtr ValCh_ptr;
|
||||
ValUSPtr ValUS_ptr;
|
||||
ValStrPtr ValStr_ptr;
|
||||
|
||||
void setUserNo(unsigned int un) {
|
||||
userNo=un;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int getUserNo() {
|
||||
return userNo;
|
||||
}
|
||||
|
||||
|
||||
void setRule(bool r) {
|
||||
rule=r;
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const char * getPV() const {return pv;};
|
||||
const char * getPVName() const {return pv;};
|
||||
const char * getPVAlias() const {return pvAlias;};
|
||||
const char * getDevice() const {return device;};
|
||||
const char * getAttribute() const {return attrib;};
|
||||
unsigned int getNelem() const {return nelem;};
|
||||
//unsigned int getNelemNative() const {return nelemNative;};
|
||||
const unsigned int getSize() const {return size;};
|
||||
CAFE_DATATYPE_UNION_SEQ getVal() const {return val.get();};
|
||||
|
||||
|
||||
short getAlarmStatus() const {return alarmStatus;};
|
||||
short getAlarmSeverity() const {return alarmSeverity;};
|
||||
|
||||
unsigned int getBeamEventNo() const {return beamEventNo;};
|
||||
bool getRule() const {return rule;};
|
||||
bool getHasAlarm() const{return hasAlarm;};
|
||||
int getStatus() const {return status;};
|
||||
CAFE_DATATYPE getDataTypeClient() const {return dataType;};
|
||||
CAFE_DATATYPE getDataType() const {return dataType;};
|
||||
|
||||
CAFEStatusCode getStatusCode() const {return cafeStatusCode;};
|
||||
|
||||
short getNoEnumStrings () const {return noStr;};
|
||||
char * getEnumString(short indx) const {return (char *) strs[indx]; }
|
||||
|
||||
void setDataType(CAFE_DATATYPE cdt){
|
||||
if (cdt > CAFE_DOUBLE || cdt < CAFE_STRING) {
|
||||
cout << "WARNING: INPUT VALUE NOT A VALID CAFE DATATYPE " << endl;
|
||||
return;
|
||||
} else {dataType=cdt; return;}};
|
||||
|
||||
void set(double d) {val[0].d=d; dataType=CAFE_DOUBLE;};
|
||||
void set(float f) {val[0].f=f; dataType=CAFE_FLOAT;};
|
||||
void set(short s) {val[0].s=s; dataType=CAFE_SHORT;};
|
||||
void set(long long l) {
|
||||
if (l > std::numeric_limits<dbr_long_t>::max()) {
|
||||
cout << "WARNING: INPUT VALUE GREATER THAN MAX LIMIT OF dbr_long_t " << endl;
|
||||
cout << "TYPE CASTING TO DOUBLE! " << endl;
|
||||
val[0].d= (double) l; dataType=CAFE_DOUBLE;}
|
||||
else {
|
||||
val[0].l= (int) l; dataType=CAFE_LONG;};
|
||||
}
|
||||
void set(int l) {val[0].l=l; dataType=CAFE_LONG;};
|
||||
void set(unsigned long long l) {
|
||||
if (l > (unsigned long long) std::numeric_limits<dbr_long_t>::max()) {
|
||||
cout << "WARNING: INPUT VALUE GREATER THAN MAX LIMIT OF dbr_long_t " << endl;
|
||||
cout << "TYPE CASTING TO DOUBLE! " << endl;
|
||||
val[0].d= (double) l; dataType=CAFE_DOUBLE;}
|
||||
else {
|
||||
val[0].l= (int) l; dataType=CAFE_LONG;};
|
||||
}
|
||||
|
||||
//For Cython
|
||||
void setString(std::string str) {strcpy(val[0].str,str.c_str()); dataType=CAFE_STRING;};
|
||||
void setDouble(double d) {val[0].d=d; dataType=CAFE_DOUBLE;};
|
||||
void setInt(int l) {val[0].l=l; dataType=CAFE_LONG;};
|
||||
void setVString(vector<std::string> Vstr) {
|
||||
if(Vstr.size()!=nelem) {nelem=Vstr.size();}
|
||||
for (unsigned int i=0; i<nelem; ++ i) {
|
||||
strcpy(val[i].str,Vstr[i].c_str());} dataType=CAFE_STRING;};
|
||||
void setVDouble(vector<double> Vd) {
|
||||
if(Vd.size()!=nelem) {nelem=Vd.size();}
|
||||
for (unsigned int i=0; i<nelem; ++ i) {
|
||||
val[i].d=Vd[i];} dataType=CAFE_DOUBLE;};
|
||||
void setVInt (vector<int> Vl) {
|
||||
if(Vl.size()!=nelem) {nelem=Vl.size();}
|
||||
for (unsigned int i=0; i<nelem; ++ i) {
|
||||
val[i].l=Vl[i];} dataType=CAFE_LONG;};
|
||||
|
||||
void set(unsigned int l) {val[0].l= (int) l; dataType=CAFE_LONG;};
|
||||
void set(unsigned short us) {val[0].us=us; dataType=CAFE_ENUM;};
|
||||
void set(unsigned char ch) {val[0].ch=ch; dataType=CAFE_CHAR;};
|
||||
void set(dbr_string_t str) {strcpy(val[0].str,str); dataType=CAFE_STRING;};
|
||||
void set(std::string str) {strcpy(val[0].str,str.c_str()); dataType=CAFE_STRING;};
|
||||
|
||||
|
||||
void set(double * d) {for (unsigned int i=0; i<nelem; ++ i) {val[i].d=d[i];} dataType=CAFE_DOUBLE;};
|
||||
void set(float * f) {for (unsigned int i=0; i<nelem; ++ i) {val[i].f=f[i];} dataType=CAFE_FLOAT;};
|
||||
void set(short * s) {for (unsigned int i=0; i<nelem; ++ i) {val[i].s=s[i];} dataType=CAFE_SHORT;};
|
||||
//Examine this!
|
||||
void set(long long * l) {
|
||||
for (unsigned int i=0; i<nelem; ++ i) {val[i].l=(int)l[i];} dataType=CAFE_LONG;
|
||||
};
|
||||
|
||||
void set(int * l) {for (unsigned int i=0; i<nelem; ++ i) {val[i].l=l[i];} dataType=CAFE_LONG;};
|
||||
void set(unsigned int * l) {for (unsigned int i=0; i<nelem; ++ i)
|
||||
{val[i].l= (int) l[i];} dataType=CAFE_LONG;};
|
||||
void set(unsigned short * us) {for (unsigned int i=0; i<nelem; ++ i)
|
||||
{val[i].us=us[i];} dataType=CAFE_ENUM;};
|
||||
void set(unsigned char * ch) {for (unsigned int i=0; i<nelem; ++ i)
|
||||
{val[i].ch=ch[i];} dataType=CAFE_CHAR;};
|
||||
void set(dbr_string_t * str) {for (unsigned int i=0; i<nelem; ++ i)
|
||||
{strcpy(val[i].str,str[i]);} dataType=CAFE_STRING;};
|
||||
void set(std::string * str) {for (unsigned int i=0; i<nelem; ++ i)
|
||||
{strcpy(val[i].str,str[i].c_str());} dataType=CAFE_STRING;};
|
||||
|
||||
std::string concatToString(){
|
||||
std::string psWF = "";
|
||||
if (dataTypeNative==CAFE_CHAR) {
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
if (val[i].ch != '\0') {
|
||||
psWF.append(1, (dbr_char_t) val[i].ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
return psWF;
|
||||
}
|
||||
|
||||
std::string getWFAsString(){
|
||||
std::string psWF = "";
|
||||
if (dataTypeNative==CAFE_CHAR) {
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
if (val[i].ch != '\0') {
|
||||
psWF.append(1, (dbr_char_t) val[i].ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
return psWF;
|
||||
}
|
||||
|
||||
|
||||
double getDouble(unsigned int idx) {return (double) val[idx].d;}
|
||||
float getFloat (unsigned int idx) {return (float) val[idx].f;}
|
||||
short getShort (unsigned int idx) {return (short) val[idx].s;}
|
||||
int getInt (unsigned int idx) {return (int) val[idx].l;}
|
||||
int getLong (unsigned int idx) {return (int) val[idx].l;}
|
||||
unsigned short getEnum (unsigned int idx) {return (unsigned short) val[idx].us;}
|
||||
unsigned short getUShort(unsigned int idx) {return (unsigned short) val[idx].us;}
|
||||
unsigned char getChar (unsigned int idx) {return (unsigned char ) val[idx].ch;}
|
||||
|
||||
|
||||
|
||||
dbr_string_t * getString(unsigned int idx) {
|
||||
#define __METHOD__ "PVHolder::getString "
|
||||
if (dataType!=CAFE_STRING) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getString method is invalid! " << endl;
|
||||
cout << "Use getAsString method if you wish to retrieve the data as a string! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
//strcpy(val[idx].str, "");
|
||||
return (dbr_string_t *) "";
|
||||
}
|
||||
return (dbr_string_t *) val[idx].str;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
boost::shared_ptr<vector<double> > getAsVDouble(){
|
||||
#define __METHOD__ "PVHolder::getVDouble "
|
||||
|
||||
ValVD_ptr.reset(new vector<double>());
|
||||
|
||||
switch (dataType)
|
||||
{
|
||||
case CAFE_DOUBLE:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].d);}
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].f);}
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].l);}
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].s);}
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].us);}
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].ch);}
|
||||
break;
|
||||
case CAFE_STRING:
|
||||
default:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back( getAsDouble(i));}
|
||||
break;
|
||||
}
|
||||
|
||||
return ValVD_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
boost::shared_ptr<vector<float> > getAsVFloat(){
|
||||
#define __METHOD__ "PVHolder::getVFloat "
|
||||
|
||||
ValVF_ptr.reset(new vector<float>());
|
||||
|
||||
switch (dataType)
|
||||
{
|
||||
case CAFE_DOUBLE:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back((float) val[i].d);}
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].f);}
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].l);}
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].s);}
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].us);}
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].ch);}
|
||||
break;
|
||||
case CAFE_STRING:
|
||||
default:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back( getAsFloat(i));}
|
||||
break;
|
||||
}
|
||||
|
||||
//How to index shared pointer for <vector<float> >
|
||||
//vector<float> * vf= ValVF_ptr.get();
|
||||
//cout << "size/// " << vf[0].size() << endl;
|
||||
//cout << vf[0][0] << " val " << val[0].f << endl;
|
||||
//cout << vf[0][1] << " val " << val[1].f << endl;
|
||||
|
||||
return ValVF_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
boost::shared_ptr<vector<int> > getAsVInt(){
|
||||
#define __METHOD__ "PVHolder::getVInt "
|
||||
|
||||
ValVI_ptr.reset(new vector<int>());
|
||||
|
||||
switch (dataType)
|
||||
{
|
||||
case CAFE_DOUBLE:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back((int) val[i].d);}
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back((int) val[i].f);}
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].l);}
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].s);}
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].us);}
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].ch);}
|
||||
break;
|
||||
case CAFE_STRING:
|
||||
default:
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back( getAsInt(i));}
|
||||
break;
|
||||
}
|
||||
|
||||
return ValVI_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
boost::shared_ptr<vector<string> > getAsVString(){
|
||||
#define __METHOD__ "PVHolder::getVString "
|
||||
|
||||
ValVStr_ptr.reset(new vector<string>());
|
||||
for (unsigned i=0; i<nelem; ++i) {ValVStr_ptr->push_back( getAsString(i));}
|
||||
|
||||
return ValVStr_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValDPtr getDouble(){
|
||||
#define __METHOD__ "PVHolder::getDouble "
|
||||
if (dataType!=CAFE_DOUBLE) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getDouble method is invalid! " << endl;
|
||||
cout << "Use getAsDouble method if you wish to retrieve the data as a double! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
|
||||
ValD_ptr.reset(new double[nelem]);
|
||||
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValD_ptr[i] = val[i].d;
|
||||
}
|
||||
|
||||
return ValD_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValFPtr getFloat() {
|
||||
#define __METHOD__ "PVHolder::getFloat "
|
||||
if (dataType!=CAFE_FLOAT) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getFloat method is invalid! " << endl;
|
||||
cout << "Use getAsFloat method if you wish to retrieve the data as a float! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
ValF_ptr.reset(new float[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValF_ptr[i] = val[i].f;
|
||||
}
|
||||
return ValF_ptr;
|
||||
//return (float *) val.get();
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValSPtr getShort() {
|
||||
#define __METHOD__ "PVHolder::getShort "
|
||||
if (dataType==CAFE_SHORT) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getShort method is invalid! " << endl;
|
||||
cout << "Use getAsShort method if you wish to retrieve the data as a short! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
ValS_ptr.reset(new short[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValS_ptr[i] = val[i].s;
|
||||
}
|
||||
return ValS_ptr;
|
||||
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValIPtr getInt(){
|
||||
#define __METHOD__ "PVHolder::getInt (meaning dbr_long_t) "
|
||||
if (dataType!=CAFE_LONG) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getInt method is invalid! " << endl;
|
||||
cout << "Use getAsInt method if you wish to retrieve the data as a int! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
ValI_ptr.reset(new int[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValI_ptr[i] = val[i].l;
|
||||
}
|
||||
return ValI_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValIPtr getLong(){
|
||||
#define __METHOD__ "PVHolder::getLong (meaning dbr_long_t) "
|
||||
if (dataType!=CAFE_LONG) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getLong method is invalid! " << endl;
|
||||
cout << "Use getAsLong method if you wish to retrieve the data as a dbr_long_t! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
ValI_ptr.reset(new int[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValI_ptr[i] = val[i].l;
|
||||
}
|
||||
return ValI_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValUSPtr getEnum(){
|
||||
#define __METHOD__ "PVHolder::getEnum "
|
||||
if (dataType!=CAFE_ENUM) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getEnum method is invalid! " << endl;
|
||||
cout << "Use getAsEnum method if you wish to retrieve the data as an enum (unsigned short)! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
ValUS_ptr.reset(new unsigned short[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValUS_ptr[i] = val[i].us;
|
||||
}
|
||||
return ValUS_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValUSPtr getUShort(){
|
||||
#define __METHOD__ "PVHolder::getUShort "
|
||||
if (dataType!=CAFE_USHORT) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getUShort method is invalid! " << endl;
|
||||
cout << "Use getAsUSHort method if you wish to retrieve the data as an unsigned short! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
ValUS_ptr.reset(new unsigned short[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValUS_ptr[i] = val[i].us;
|
||||
}
|
||||
return ValUS_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValChPtr getChar(){
|
||||
#define __METHOD__ "PVHolder::getChar "
|
||||
if (dataType!=CAFE_CHAR) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getChar method is invalid! " << endl;
|
||||
cout << "Use getAsChar method if you wish to retrieve the data as a char! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
ValCh_ptr.reset(new unsigned char[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
ValCh_ptr[i] = val[i].ch;
|
||||
}
|
||||
return ValCh_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
ValStrPtr getString() {
|
||||
#define __METHOD__ "PVHolder::getString "
|
||||
if (dataType!=CAFE_STRING) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getString method is invalid! " << endl;
|
||||
cout << "Use getAsString method if you wish to retrieve the data as a string! " << endl;
|
||||
cout << "**********************" << endl;
|
||||
//return (dbr_string_t *) "";
|
||||
}
|
||||
ValStr_ptr.reset(new dbr_string_t[nelem]);
|
||||
for (unsigned i=0; i<nelem; ++i) {
|
||||
strcpy(ValStr_ptr[i] , val[i].str);
|
||||
}
|
||||
return ValStr_ptr;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
double getAsDouble () {
|
||||
return (double) renderDouble.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
double getAsDouble(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (double) renderDouble.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
float getAsFloat () {
|
||||
return (float) renderFloat.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
float getAsFloat(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (float) renderFloat.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
short getAsShort () {
|
||||
return (short) renderShort.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
short getAsShort(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (short) renderShort.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
int getAsLong () {
|
||||
return (int) renderLong.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
int getAsLong(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (int) renderLong.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned short getAsEnum () {
|
||||
return (unsigned short) renderEnum.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned short getAsEnum(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (unsigned short) renderEnum.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned short getAsUShort () {
|
||||
return (unsigned short) renderEnum.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned short getAsUShort(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (unsigned short) renderEnum.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned char getAsChar () {
|
||||
return (char) renderChar.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned char getAsChar(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (char) renderChar.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned char getAsUChar () {
|
||||
return (unsigned char) renderUChar.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned char getAsUChar(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (unsigned char) renderUChar.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned int getAsULong () {
|
||||
return (unsigned int) renderULong.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned int getAsULong(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (unsigned int) renderULong.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
long long getAsLongLong () {
|
||||
return (long long) renderLongLong.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
long long getAsLongLong(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (long long) renderLongLong.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned long long getAsULongLong () {
|
||||
return (unsigned long long) renderULongLong.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned long long getAsULongLong(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (unsigned long long) renderULongLong.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
int getAsInt () {
|
||||
return (int) renderInt.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
int getAsInt(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (int) renderInt.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned int getAsUInt () {
|
||||
return (unsigned int) renderInt.get(0, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
unsigned int getAsUInt(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
return (unsigned int) renderInt.get(idx, dataType, val.get())[0];
|
||||
}
|
||||
|
||||
//getEnumAsNumberedString
|
||||
string getEnumIntegerValueAsString() {
|
||||
#define __METHOD__ "PVHolder::getEnumIntegerValueAsString"
|
||||
if (dataType!=CAFE_ENUM) {
|
||||
cout << "******* WARNING *******" << endl;
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
|
||||
" hence getEnumIntegerValueAsString method is invalid! " << endl;
|
||||
cout << "Use getAsString method if you want the string equilavent of the ENUM value!" << endl;
|
||||
cout << "**********************" << endl;
|
||||
}
|
||||
return (string) renderString.getString(0, dataType, val.get())[0];
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
string getAsString() {
|
||||
if(dataTypeNative==DBR_ENUM && dataType==DBR_ENUM) {
|
||||
|
||||
return (string) renderString.getStringFromEnum(0, noStr, val.get(), strs)[0];
|
||||
}
|
||||
else {
|
||||
return (string) renderString.getString(0, dataType, val.get())[0];
|
||||
}
|
||||
}
|
||||
|
||||
string getAsString(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
|
||||
return (string) renderString.getStringFromEnum(idx, noStr, val.get(), strs)[0];
|
||||
}
|
||||
else {
|
||||
return (string) renderString.getString(idx, dataType, val.get())[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char * getAsDbr_string_t() {
|
||||
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
|
||||
return (char *) renderString.getStringFromEnum(0, noStr, val.get(), strs)[0];
|
||||
|
||||
}
|
||||
else {
|
||||
return (char *) renderString.getString(0, dataType, val.get())[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char * getAsDbr_string_t(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
|
||||
return (char *) renderString.getStringFromEnum(idx, noStr, val.get(), strs)[0];
|
||||
}
|
||||
else {
|
||||
return (char *) renderString.getString(idx, dataType, val.get())[0];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
dbr_string_t * getAsDbr_string_t(unsigned int idx) throw(std::out_of_range){
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Exception! Index " << idx
|
||||
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
|
||||
throw std::out_of_range(oss.str());
|
||||
}
|
||||
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
|
||||
return (dbr_string_t *) renderString.getStringFromEnum(idx, val.get(), strs);
|
||||
}
|
||||
else {
|
||||
return (dbr_string_t *) renderString.getString(idx, dataType, val.get());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//used by PVCtrlHolder
|
||||
double getAsDouble(CAFE_DATATYPE_UNION cdu) {
|
||||
return (double) renderDouble.get(0, dataType, &cdu)[0];
|
||||
}
|
||||
|
||||
float getAsFloat(CAFE_DATATYPE_UNION cdu) {
|
||||
return (float) renderFloat.get(0, dataType, &cdu)[0];
|
||||
}
|
||||
|
||||
short getAsShort(CAFE_DATATYPE_UNION cdu) {
|
||||
return (short) renderShort.get(0, dataType, &cdu)[0];
|
||||
}
|
||||
|
||||
int getAsLong(CAFE_DATATYPE_UNION cdu) {
|
||||
return (int) renderLong.get(0, dataType, &cdu)[0];
|
||||
}
|
||||
|
||||
unsigned short getAsEnum(CAFE_DATATYPE_UNION cdu) {
|
||||
return (unsigned short) renderEnum.get(0, dataType, &cdu)[0];
|
||||
}
|
||||
|
||||
unsigned short getAsUShort(CAFE_DATATYPE_UNION cdu) {
|
||||
return (unsigned short) renderEnum.get(0, dataType, &cdu)[0];
|
||||
}
|
||||
|
||||
char getAsChar(CAFE_DATATYPE_UNION cdu) {
|
||||
char * ans = renderChar.get(0, dataType, &cdu);
|
||||
return (char ) ans[0];
|
||||
}
|
||||
unsigned char getAsUChar(CAFE_DATATYPE_UNION cdu) {
|
||||
unsigned char * ans = renderUChar.get(0, dataType, &cdu);
|
||||
return (unsigned char ) ans[0];
|
||||
}
|
||||
|
||||
string getAsString(CAFE_DATATYPE_UNION cdu) {
|
||||
return (string) renderString.getString(dataType, cdu)[0];
|
||||
}
|
||||
|
||||
char * getAsDbr_string_t(CAFE_DATATYPE_UNION cdu) {
|
||||
return (char *) renderString.getString(0, dataType, &cdu)[0];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif //PVHOLDER_H
|
||||
32
include/PyCafe.h
Normal file
32
include/PyCafe.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef __PYX_HAVE__PyCafe
|
||||
#define __PYX_HAVE__PyCafe
|
||||
|
||||
|
||||
#ifndef __PYX_HAVE_API__PyCafe
|
||||
|
||||
#ifndef __PYX_EXTERN_C
|
||||
#ifdef __cplusplus
|
||||
#define __PYX_EXTERN_C extern "C"
|
||||
#else
|
||||
#define __PYX_EXTERN_C extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DL_IMPORT
|
||||
#define DL_IMPORT(_T) _T
|
||||
#endif
|
||||
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_wrapper(PVDataHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_monid_wrapper(unsigned int, unsigned long);
|
||||
|
||||
#endif /* !__PYX_HAVE_API__PyCafe */
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyMODINIT_FUNC initPyCafe(void);
|
||||
#else
|
||||
PyMODINIT_FUNC PyInit_PyCafe(void);
|
||||
#endif
|
||||
|
||||
#endif /* !__PYX_HAVE__PyCafe */
|
||||
115
include/PyCafe3_api.h
Normal file
115
include/PyCafe3_api.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/* Generated by Cython 0.23.4 */
|
||||
|
||||
#ifndef __PYX_HAVE_API__PyCafe
|
||||
#define __PYX_HAVE_API__PyCafe
|
||||
#include "Python.h"
|
||||
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_wrapper)(PVDataHolder, unsigned int, std::string) = 0;
|
||||
#define py_cb_wrapper __pyx_api_f_6PyCafe_py_cb_wrapper
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_ctrl_wrapper)(PVCtrlHolder, unsigned int, std::string) = 0;
|
||||
#define py_cb_ctrl_wrapper __pyx_api_f_6PyCafe_py_cb_ctrl_wrapper
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_handle_wrapper)(unsigned int) = 0;
|
||||
#define py_cb_handle_wrapper __pyx_api_f_6PyCafe_py_cb_handle_wrapper
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper)(unsigned int, unsigned long) = 0;
|
||||
#define py_cb_handle_monid_wrapper __pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper)(unsigned int) = 0;
|
||||
#define py_cb_handle_get_wrapper __pyx_api_f_6PyCafe_py_cb_handle_get_wrapper
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper)(unsigned int) = 0;
|
||||
#define py_cb_handle_put_wrapper __pyx_api_f_6PyCafe_py_cb_handle_put_wrapper
|
||||
#if !defined(__Pyx_PyIdentifier_FromString)
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
|
||||
#else
|
||||
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __PYX_HAVE_RT_ImportModule
|
||||
#define __PYX_HAVE_RT_ImportModule
|
||||
static PyObject *__Pyx_ImportModule(const char *name) {
|
||||
PyObject *py_name = 0;
|
||||
PyObject *py_module = 0;
|
||||
py_name = __Pyx_PyIdentifier_FromString(name);
|
||||
if (!py_name)
|
||||
goto bad;
|
||||
py_module = PyImport_Import(py_name);
|
||||
Py_DECREF(py_name);
|
||||
return py_module;
|
||||
bad:
|
||||
Py_XDECREF(py_name);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __PYX_HAVE_RT_ImportFunction
|
||||
#define __PYX_HAVE_RT_ImportFunction
|
||||
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
|
||||
PyObject *d = 0;
|
||||
PyObject *cobj = 0;
|
||||
union {
|
||||
void (*fp)(void);
|
||||
void *p;
|
||||
} tmp;
|
||||
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
|
||||
if (!d)
|
||||
goto bad;
|
||||
cobj = PyDict_GetItemString(d, funcname);
|
||||
if (!cobj) {
|
||||
PyErr_Format(PyExc_ImportError,
|
||||
"%.200s does not export expected C function %.200s",
|
||||
PyModule_GetName(module), funcname);
|
||||
goto bad;
|
||||
}
|
||||
#if PY_VERSION_HEX >= 0x02070000
|
||||
if (!PyCapsule_IsValid(cobj, sig)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
|
||||
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
|
||||
goto bad;
|
||||
}
|
||||
tmp.p = PyCapsule_GetPointer(cobj, sig);
|
||||
#else
|
||||
{const char *desc, *s1, *s2;
|
||||
desc = (const char *)PyCObject_GetDesc(cobj);
|
||||
if (!desc)
|
||||
goto bad;
|
||||
s1 = desc; s2 = sig;
|
||||
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
|
||||
if (*s1 != *s2) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
|
||||
PyModule_GetName(module), funcname, sig, desc);
|
||||
goto bad;
|
||||
}
|
||||
tmp.p = PyCObject_AsVoidPtr(cobj);}
|
||||
#endif
|
||||
*f = tmp.fp;
|
||||
if (!(*f))
|
||||
goto bad;
|
||||
Py_DECREF(d);
|
||||
return 0;
|
||||
bad:
|
||||
Py_XDECREF(d);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int import_PyCafe(void) {
|
||||
PyObject *module = 0;
|
||||
module = __Pyx_ImportModule("PyCafe");
|
||||
if (!module) goto bad;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_wrapper, "void (PVDataHolder, unsigned int, std::string)") < 0) goto bad;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_ctrl_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_ctrl_wrapper, "void (PVCtrlHolder, unsigned int, std::string)") < 0) goto bad;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_handle_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_wrapper, "void (unsigned int)") < 0) goto bad;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_handle_monid_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper, "void (unsigned int, unsigned long)") < 0) goto bad;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_handle_get_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper, "void (unsigned int)") < 0) goto bad;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_handle_put_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper, "void (unsigned int)") < 0) goto bad;
|
||||
Py_DECREF(module); module = 0;
|
||||
return 0;
|
||||
bad:
|
||||
Py_XDECREF(module);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* !__PYX_HAVE_API__PyCafe */
|
||||
1
include/PyCafe_api.h
Symbolic link
1
include/PyCafe_api.h
Symbolic link
@@ -0,0 +1 @@
|
||||
PyCafe3_api.h
|
||||
1033
include/cafe.h
Normal file
1033
include/cafe.h
Normal file
File diff suppressed because it is too large
Load Diff
615
include/cafeCache.h
Normal file
615
include/cafeCache.h
Normal file
@@ -0,0 +1,615 @@
|
||||
///
|
||||
/// \file cafeCache.h
|
||||
/// \brief CAFE methods retrieving data from cache. (Belongs to cafe.h)
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFECACHE_H
|
||||
#define CAFECACHE_H
|
||||
|
||||
int getPulseID(unsigned int * handle, unsigned int nelem, unsigned int * pulseID) {
|
||||
int status=ICAFE_NORMAL; int statusLocal=ICAFE_NORMAL;
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
statusLocal=handleHelper.getPulseID(handle[i], pulseID[i]);
|
||||
if (statusLocal!=ICAFE_NORMAL && status==ICAFE_NORMAL) {
|
||||
status=statusLocal;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int getPulseID(unsigned int handle, unsigned int &pulseID) {
|
||||
pulseID=0;
|
||||
return handleHelper.getPulseID(handle, pulseID);
|
||||
}
|
||||
|
||||
int getPulseID(char * pv, unsigned int &pulseID) {
|
||||
pulseID=0;
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return handleHelper.getPulseID(handle, pulseID);
|
||||
}
|
||||
|
||||
unsigned int getPulseIDFromTS(epicsTimeStamp ts) {
|
||||
return handleHelper.getPulseIDFromTS(ts);
|
||||
}
|
||||
|
||||
vector<unsigned int>getPulseIDFromTS(PVDataHolder * pvd, unsigned int nelem) {
|
||||
vector<unsigned int> vui;
|
||||
vui.clear();
|
||||
vui.reserve(nelem);
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
|
||||
}
|
||||
return vui;
|
||||
}
|
||||
|
||||
vector<unsigned int>getPulseIDFromTS(PVGroup pvg) {
|
||||
vector<unsigned int> vui;
|
||||
vui.clear();
|
||||
vui.reserve(pvg.getNPV());
|
||||
PVDataHolder * pvd=pvg.getPVData();
|
||||
for (unsigned int i=0; i<pvg.getNPV(); ++i) {
|
||||
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
|
||||
}
|
||||
return vui;
|
||||
}
|
||||
|
||||
/*
|
||||
int getCachePVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
unsigned int * handleArray = new unsigned int [handleV.size()];
|
||||
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
|
||||
status=getCache(handleArray, (unsigned int) handleV.size(), pvd);
|
||||
delete [] handleArray; return status;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
int getCachePVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
return getCache(&handleV[0], (unsigned int) handleV.size(), pvd);
|
||||
};
|
||||
|
||||
int getCachePVArrayNoWait (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
|
||||
int overallStatus=ICAFE_NORMAL;
|
||||
for (size_t i=0; i< (size_t) handleV.size(); ++i) {
|
||||
status=getCacheNoWait(handleV[i], pvd[i]);
|
||||
//cout << "handle= " << handleV[i] << " pvFromHandle= " << CAFE::getPVFromHandle(handleV[i]) << " status= " << pvd[i].getStatus() << " val= " << pvd[i].getAsString() << endl;
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
resetCallbackGet(handleV[i]);
|
||||
if(overallStatus==ICAFE_NORMAL) {overallStatus=status;}
|
||||
}
|
||||
if (pvd[i].getStatus() !=ICAFE_NORMAL) {
|
||||
if(overallStatus==ICAFE_NORMAL) {overallStatus=pvd[i].getStatus();}
|
||||
}
|
||||
}
|
||||
return overallStatus;
|
||||
};
|
||||
|
||||
/*
|
||||
int getCachePVArrayNoWait (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
unsigned int * handleArray = new unsigned int [handleV.size()];
|
||||
int overallStatus=ICAFE_NORMAL;
|
||||
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];
|
||||
status=getCacheNoWait(handleArray[i], pvd[i]);
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
resetCallbackGet(handleArray[i]);
|
||||
if(overallStatus==ICAFE_NORMAL) {overallStatus=status;}
|
||||
}
|
||||
}
|
||||
delete [] handleArray; return status;
|
||||
};
|
||||
*/
|
||||
|
||||
int resetCallbackGet(const unsigned int handle);
|
||||
int resetCallbackPut(const unsigned int handle);
|
||||
|
||||
int getCacheNoWait(const unsigned int handle, PVDataHolder & pvd);
|
||||
|
||||
int getCache (const unsigned int handle, PVDataHolder & pvd);
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, PVDataHolder * pvd);
|
||||
|
||||
int getCtrlCache (const unsigned int handle, PVCtrlHolder & pvc);
|
||||
int getCtrlCache (const unsigned int *handleArray, unsigned int nelem, PVCtrlHolder * pvc);
|
||||
|
||||
int getCache (const char * pv, PVDataHolder & pvd) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCache(handle, pvd);}
|
||||
int getCtrlCache (const char * pv, PVCtrlHolder & pvc) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCtrlCache(handle, pvc);}
|
||||
|
||||
//6
|
||||
int getCacheDoubleArray(const unsigned int handle, dbr_double_t * _val) {
|
||||
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_double_t * _val) {
|
||||
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//5+ long long
|
||||
int getCache(const unsigned int handle, long long * _val);
|
||||
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);
|
||||
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
|
||||
|
||||
//5
|
||||
int getCacheLongArray(const unsigned int handle, dbr_long_t * _val) {
|
||||
return cafeLatte.getCache(handle, DBR_LONG, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_long_t * _val) {
|
||||
return cafeLatte.getCache(handle, DBR_LONG, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//4
|
||||
int getCache(const unsigned int handle, dbr_char_t * _val) {
|
||||
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//3
|
||||
int getCache(const unsigned int handle, dbr_enum_t * _val) {
|
||||
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//2
|
||||
int getCacheFloatArray(const unsigned int handle, dbr_float_t * _val) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_float_t * _val) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//1
|
||||
int getCacheShortArray(const unsigned int handle, dbr_short_t * _val) {
|
||||
return cafeSchale.getCache(handle, DBR_SHORT, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_short_t * _val) {
|
||||
return cafeSchale.getCache(handle, DBR_SHORT, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCacheDbrStringArray(const unsigned int handle, dbr_string_t * _val){
|
||||
return cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
};
|
||||
|
||||
//0
|
||||
int getCache(const unsigned int handle, dbr_string_t * _val) {
|
||||
return cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
//0+
|
||||
int getCacheStringArray(const unsigned int handle, string * valStr) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const unsigned int handle, string * valStr) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
}
|
||||
//Single value
|
||||
//0+
|
||||
int getCacheString(const unsigned int handle, string & valStr){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, val);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
|
||||
int getCache(const unsigned int handle, string & valStr){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, val);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
int getCache(const unsigned int handle, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
int getCache(const unsigned int handle, string & valStr,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
int getCache(const unsigned int handle, dbr_string_t & val); //0
|
||||
int getCache(const unsigned int handle, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
|
||||
int getCache(const unsigned int handle, dbr_string_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
|
||||
int getCache(const unsigned int handle, dbr_short_t & val); //1
|
||||
int getCache(const unsigned int handle, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
|
||||
int getCache(const unsigned int handle, dbr_short_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
|
||||
int getCache(const unsigned int handle, dbr_float_t & val); //2
|
||||
int getCache(const unsigned int handle, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
|
||||
int getCache(const unsigned int handle, dbr_float_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
|
||||
int getCache(const unsigned int handle, dbr_enum_t & val); //3
|
||||
int getCache(const unsigned int handle, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
|
||||
int getCache(const unsigned int handle, dbr_enum_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
|
||||
int getCache(const unsigned int handle, dbr_char_t & val); //4
|
||||
int getCache(const unsigned int handle, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
|
||||
int getCache(const unsigned int handle, dbr_char_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
|
||||
|
||||
int getCacheLong(const unsigned int handle, dbr_long_t & val) { return getCache(handle, val);}
|
||||
|
||||
int getCache(const unsigned int handle, dbr_long_t & val); //5
|
||||
int getCache(const unsigned int handle, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
|
||||
int getCache(const unsigned int handle, dbr_long_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
|
||||
int getCache(const unsigned int handle, long long & val); //5+
|
||||
int getCache(const unsigned int handle, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5+
|
||||
int getCache(const unsigned int handle, long long & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5+
|
||||
int getCacheDouble(const unsigned int handle, dbr_double_t & val) {
|
||||
return getCache(handle, val);
|
||||
}
|
||||
|
||||
int getCache(const unsigned int handle, dbr_double_t & val); //6
|
||||
int getCache(const unsigned int handle, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
|
||||
int getCache(const unsigned int handle, dbr_double_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
|
||||
|
||||
|
||||
//getCache by array of handles
|
||||
//0+
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
dbr_string_t * val = new dbr_string_t[nelem];
|
||||
status=cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
|
||||
delete [] val; return status;
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
dbr_string_t * val = new dbr_string_t[nelem];
|
||||
status=cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
|
||||
delete [] val; return status;
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray) {
|
||||
dbr_string_t * val = new dbr_string_t[nelem];
|
||||
status=cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
|
||||
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
|
||||
delete [] val; return status;
|
||||
}
|
||||
//0
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray) {
|
||||
return cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
|
||||
}
|
||||
//1
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeSchale.getCache(handleArray, nelem, DBR_TIME_SHORT, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeSchale.getCache(handleArray, nelem, DBR_STS_SHORT, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray) {
|
||||
return cafeSchale.getCache(handleArray, nelem, DBR_SHORT, val, statusArray);
|
||||
}
|
||||
//2
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeFrappuccino.getCache(handleArray, nelem, DBR_TIME_FLOAT, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeFrappuccino.getCache(handleArray, nelem, DBR_STS_FLOAT, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray) {
|
||||
return cafeFrappuccino.getCache(handleArray, nelem, DBR_FLOAT, val, statusArray);
|
||||
}
|
||||
//3
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeEspresso.getCache(handleArray, nelem, DBR_TIME_ENUM, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeEspresso.getCache(handleArray, nelem, DBR_STS_ENUM, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray) {
|
||||
return cafeEspresso.getCache(handleArray, nelem, DBR_ENUM, val, statusArray);
|
||||
}
|
||||
//4
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeCappuccino.getCache(handleArray, nelem, DBR_TIME_CHAR, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeCappuccino.getCache(handleArray, nelem, DBR_STS_CHAR, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray) {
|
||||
return cafeCappuccino.getCache(handleArray, nelem, DBR_CHAR, val, statusArray);
|
||||
}
|
||||
//5
|
||||
int getCache(unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeLatte.getCache(handleArray, nelem, DBR_TIME_LONG, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeLatte.getCache(handleArray, nelem, DBR_STS_LONG, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray) {
|
||||
return cafeLatte.getCache(handleArray, nelem, DBR_LONG, val, statusArray);
|
||||
}
|
||||
//5+ long long
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
|
||||
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity);
|
||||
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray);
|
||||
//6
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeDoppio.getCache(handleArray, nelem, DBR_TIME_DOUBLE, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeDoppio.getCache(handleArray, nelem, DBR_STS_DOUBLE, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray) {
|
||||
return cafeDoppio.getCache(handleArray, nelem, DBR_DOUBLE, val, statusArray);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////// by PV name ///////////////////////////////////
|
||||
|
||||
int getCache(const char * pv, string & valStr); //0+
|
||||
int getCache(const char * pv, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0+
|
||||
int getCache(const char * pv, string & valStr,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0+
|
||||
int getCache(const char * pv, dbr_string_t & val); //0
|
||||
int getCache(const char * pv, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
|
||||
int getCache(const char * pv, dbr_string_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
|
||||
int getCache(const char * pv, dbr_short_t & val); //1
|
||||
int getCache(const char * pv, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
|
||||
int getCache(const char * pv, dbr_short_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
|
||||
int getCache(const char * pv, dbr_float_t & val); //2
|
||||
int getCache(const char * pv, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
|
||||
int getCache(const char * pv, dbr_float_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
|
||||
int getCache(const char * pv, dbr_enum_t & val); //3
|
||||
int getCache(const char * pv, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
|
||||
int getCache(const char * pv, dbr_enum_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
|
||||
int getCache(const char * pv, dbr_char_t & val); //4
|
||||
int getCache(const char * pv, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
|
||||
int getCache(const char * pv, dbr_char_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
|
||||
int getCache(const char * pv, dbr_long_t & val); //5
|
||||
int getCache(const char * pv, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
|
||||
int getCache(const char * pv, dbr_long_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
|
||||
int getCache(const char * pv, long long & val){ //5+
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, val);
|
||||
}
|
||||
int getCache(const char * pv, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //5+
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity);
|
||||
}
|
||||
int getCache(const char * pv, long long & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //5+
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
int getCache(const char * pv, dbr_double_t & val); //6
|
||||
int getCache(const char * pv, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
|
||||
int getCache(const char * pv, dbr_double_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
|
||||
|
||||
|
||||
//6
|
||||
int getCache(const char * pv, dbr_double_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
//5+
|
||||
int getCache(const char * pv, long long * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, _val);
|
||||
};
|
||||
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
//5
|
||||
int getCache(const char * pv, dbr_long_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeLatte.getCache(handle, DBR_LONG, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//4
|
||||
int getCache(const char * pv, dbr_char_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//3
|
||||
int getCache(const char * pv, dbr_enum_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//2
|
||||
int getCache(const char * pv, dbr_float_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//1
|
||||
int getCache(const char * pv, dbr_short_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSchale.getCache(handle, DBR_SHORT, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//0
|
||||
int getCache(const char * pv, dbr_string_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
//0+
|
||||
int getCache(const char * pv, string * valStr) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
}
|
||||
|
||||
#endif // CAFECACHE_H
|
||||
591
include/cafeCache_backup.h
Normal file
591
include/cafeCache_backup.h
Normal file
@@ -0,0 +1,591 @@
|
||||
///
|
||||
/// \file cafeCache.h
|
||||
/// \brief CAFE methods retrieving data from cache. (Belongs to cafe.h)
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFECACHE_H
|
||||
#define CAFECACHE_H
|
||||
|
||||
int getPulseID(unsigned int * handle, unsigned int nelem, unsigned int * pulseID) {
|
||||
int status=ICAFE_NORMAL; int statusLocal=ICAFE_NORMAL;
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
statusLocal=handleHelper.getPulseID(handle[i], pulseID[i]);
|
||||
if (statusLocal!=ICAFE_NORMAL && status==ICAFE_NORMAL) {
|
||||
status=statusLocal;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int getPulseID(unsigned int handle, unsigned int &pulseID) {
|
||||
pulseID=0;
|
||||
return handleHelper.getPulseID(handle, pulseID);
|
||||
}
|
||||
|
||||
int getPulseID(char * pv, unsigned int &pulseID) {
|
||||
pulseID=0;
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return handleHelper.getPulseID(handle, pulseID);
|
||||
}
|
||||
|
||||
unsigned int getPulseIDFromTS(epicsTimeStamp ts) {
|
||||
return handleHelper.getPulseIDFromTS(ts);
|
||||
}
|
||||
|
||||
vector<unsigned int>getPulseIDFromTS(PVDataHolder * pvd, unsigned int nelem) {
|
||||
vector<unsigned int> vui;
|
||||
vui.clear();
|
||||
vui.reserve(nelem);
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
|
||||
}
|
||||
return vui;
|
||||
}
|
||||
|
||||
vector<unsigned int>getPulseIDFromTS(PVGroup pvg) {
|
||||
vector<unsigned int> vui;
|
||||
vui.clear();
|
||||
vui.reserve(pvg.getNPV());
|
||||
PVDataHolder * pvd=pvg.getPVData();
|
||||
for (unsigned int i=0; i<pvg.getNPV(); ++i) {
|
||||
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
|
||||
}
|
||||
return vui;
|
||||
}
|
||||
|
||||
int getCachePVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
unsigned int * handleArray = new unsigned int [handleV.size()];
|
||||
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
|
||||
status=getCache(handleArray, (unsigned int) handleV.size(), pvd);
|
||||
delete [] handleArray; return status;
|
||||
};
|
||||
|
||||
int getCachePVArrayNoWait (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
unsigned int * handleArray = new unsigned int [handleV.size()];
|
||||
int overallStatus=ICAFE_NORMAL;
|
||||
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];
|
||||
status=getCacheNoWait(handleArray[i], pvd[i]);
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
resetCallbackGet(handleArray[i]);
|
||||
if(overallStatus==ICAFE_NORMAL) {overallStatus=status;}
|
||||
}
|
||||
}
|
||||
delete [] handleArray; return status;
|
||||
};
|
||||
|
||||
int resetCallbackGet(const unsigned int handle);
|
||||
int resetCallbackPut(const unsigned int handle);
|
||||
|
||||
int getCacheNoWait(const unsigned int handle, PVDataHolder & pvd);
|
||||
|
||||
int getCache (const unsigned int handle, PVDataHolder & pvd);
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, PVDataHolder * pvd);
|
||||
|
||||
int getCtrlCache (const unsigned int handle, PVCtrlHolder & pvc);
|
||||
int getCtrlCache (const unsigned int *handleArray, unsigned int nelem, PVCtrlHolder * pvc);
|
||||
|
||||
int getCache (const char * pv, PVDataHolder & pvd) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCache(handle, pvd);}
|
||||
int getCtrlCache (const char * pv, PVCtrlHolder & pvc) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCtrlCache(handle, pvc);}
|
||||
|
||||
//6
|
||||
int getCacheDoubleArray(const unsigned int handle, dbr_double_t * _val) {
|
||||
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_double_t * _val) {
|
||||
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//5+ long long
|
||||
int getCache(const unsigned int handle, long long * _val);
|
||||
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);
|
||||
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
|
||||
|
||||
//5
|
||||
int getCacheLongArray(const unsigned int handle, dbr_long_t * _val) {
|
||||
return cafeLatte.getCache(handle, DBR_LONG, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_long_t * _val) {
|
||||
return cafeLatte.getCache(handle, DBR_LONG, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//4
|
||||
int getCache(const unsigned int handle, dbr_char_t * _val) {
|
||||
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//3
|
||||
int getCache(const unsigned int handle, dbr_enum_t * _val) {
|
||||
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//2
|
||||
int getCacheFloatArray(const unsigned int handle, dbr_float_t * _val) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_float_t * _val) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//1
|
||||
int getCache(const unsigned int handle, dbr_short_t * _val) {
|
||||
return cafeSchale.getCache(handle, DBR_SHORT, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
|
||||
int getCacheDbrStringArray(const unsigned int handle, dbr_string_t * _val){
|
||||
return cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
};
|
||||
|
||||
//0
|
||||
int getCache(const unsigned int handle, dbr_string_t * _val) {
|
||||
return cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
//0+
|
||||
int getCacheStringArray(const unsigned int handle, string * valStr) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const unsigned int handle, string * valStr) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
}
|
||||
//Single value
|
||||
//0+
|
||||
|
||||
int getCacheString(const unsigned int handle, string & valStr){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, val);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
|
||||
int getCache(const unsigned int handle, string & valStr){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, val);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
int getCache(const unsigned int handle, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
int getCache(const unsigned int handle, string & valStr,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //0
|
||||
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
|
||||
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
return status;
|
||||
}
|
||||
int getCache(const unsigned int handle, dbr_string_t & val); //0
|
||||
int getCache(const unsigned int handle, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
|
||||
int getCache(const unsigned int handle, dbr_string_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
|
||||
int getCache(const unsigned int handle, dbr_short_t & val); //1
|
||||
int getCache(const unsigned int handle, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
|
||||
int getCache(const unsigned int handle, dbr_short_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
|
||||
int getCache(const unsigned int handle, dbr_float_t & val); //2
|
||||
int getCache(const unsigned int handle, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
|
||||
int getCache(const unsigned int handle, dbr_float_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
|
||||
int getCache(const unsigned int handle, dbr_enum_t & val); //3
|
||||
int getCache(const unsigned int handle, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
|
||||
int getCache(const unsigned int handle, dbr_enum_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
|
||||
int getCache(const unsigned int handle, dbr_char_t & val); //4
|
||||
int getCache(const unsigned int handle, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
|
||||
int getCache(const unsigned int handle, dbr_char_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
|
||||
|
||||
int getCacheLong(const unsigned int handle, dbr_long_t & val) {
|
||||
return getCache(handle, val);
|
||||
}
|
||||
|
||||
int getCache(const unsigned int handle, dbr_long_t & val); //5
|
||||
int getCache(const unsigned int handle, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
|
||||
int getCache(const unsigned int handle, dbr_long_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
|
||||
int getCache(const unsigned int handle, long long & val); //5+
|
||||
int getCache(const unsigned int handle, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5+
|
||||
int getCache(const unsigned int handle, long long & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5+
|
||||
int getCacheDouble(const unsigned int handle, dbr_double_t & val) {
|
||||
return getCache(handle, val);
|
||||
}
|
||||
|
||||
int getCache(const unsigned int handle, dbr_double_t & val); //6
|
||||
int getCache(const unsigned int handle, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
|
||||
int getCache(const unsigned int handle, dbr_double_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
|
||||
|
||||
|
||||
//getCache by array of handles
|
||||
//0+
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
dbr_string_t * val = new dbr_string_t[nelem];
|
||||
status=cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
|
||||
delete [] val; return status;
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
dbr_string_t * val = new dbr_string_t[nelem];
|
||||
status=cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
|
||||
delete [] val; return status;
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray) {
|
||||
dbr_string_t * val = new dbr_string_t[nelem];
|
||||
status=cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
|
||||
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
|
||||
delete [] val; return status;
|
||||
}
|
||||
//0
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray) {
|
||||
return cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
|
||||
}
|
||||
//1
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeSchale.getCache(handleArray, nelem, DBR_TIME_SHORT, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeSchale.getCache(handleArray, nelem, DBR_STS_SHORT, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray) {
|
||||
return cafeSchale.getCache(handleArray, nelem, DBR_SHORT, val, statusArray);
|
||||
}
|
||||
//2
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeFrappuccino.getCache(handleArray, nelem, DBR_TIME_FLOAT, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeFrappuccino.getCache(handleArray, nelem, DBR_STS_FLOAT, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray) {
|
||||
return cafeFrappuccino.getCache(handleArray, nelem, DBR_FLOAT, val, statusArray);
|
||||
}
|
||||
//3
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeEspresso.getCache(handleArray, nelem, DBR_TIME_ENUM, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeEspresso.getCache(handleArray, nelem, DBR_STS_ENUM, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray) {
|
||||
return cafeEspresso.getCache(handleArray, nelem, DBR_ENUM, val, statusArray);
|
||||
}
|
||||
//4
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeCappuccino.getCache(handleArray, nelem, DBR_TIME_CHAR, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeCappuccino.getCache(handleArray, nelem, DBR_STS_CHAR, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray) {
|
||||
return cafeCappuccino.getCache(handleArray, nelem, DBR_CHAR, val, statusArray);
|
||||
}
|
||||
//5
|
||||
int getCache(unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeLatte.getCache(handleArray, nelem, DBR_TIME_LONG, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeLatte.getCache(handleArray, nelem, DBR_STS_LONG, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray) {
|
||||
return cafeLatte.getCache(handleArray, nelem, DBR_LONG, val, statusArray);
|
||||
}
|
||||
//5+ long long
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
|
||||
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity);
|
||||
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray);
|
||||
//6
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
|
||||
return cafeDoppio.getCache(handleArray, nelem, DBR_TIME_DOUBLE, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
|
||||
return cafeDoppio.getCache(handleArray, nelem, DBR_STS_DOUBLE, val, statusArray,
|
||||
alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray) {
|
||||
return cafeDoppio.getCache(handleArray, nelem, DBR_DOUBLE, val, statusArray);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////// by PV name ///////////////////////////////////
|
||||
|
||||
int getCache(const char * pv, string & valStr); //0+
|
||||
int getCache(const char * pv, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0+
|
||||
int getCache(const char * pv, string & valStr,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0+
|
||||
int getCache(const char * pv, dbr_string_t & val); //0
|
||||
int getCache(const char * pv, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
|
||||
int getCache(const char * pv, dbr_string_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
|
||||
int getCache(const char * pv, dbr_short_t & val); //1
|
||||
int getCache(const char * pv, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
|
||||
int getCache(const char * pv, dbr_short_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
|
||||
int getCache(const char * pv, dbr_float_t & val); //2
|
||||
int getCache(const char * pv, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
|
||||
int getCache(const char * pv, dbr_float_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
|
||||
int getCache(const char * pv, dbr_enum_t & val); //3
|
||||
int getCache(const char * pv, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
|
||||
int getCache(const char * pv, dbr_enum_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
|
||||
int getCache(const char * pv, dbr_char_t & val); //4
|
||||
int getCache(const char * pv, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
|
||||
int getCache(const char * pv, dbr_char_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
|
||||
int getCache(const char * pv, dbr_long_t & val); //5
|
||||
int getCache(const char * pv, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
|
||||
int getCache(const char * pv, dbr_long_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
|
||||
int getCache(const char * pv, long long & val){ //5+
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, val);
|
||||
}
|
||||
int getCache(const char * pv, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //5+
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity);
|
||||
}
|
||||
int getCache(const char * pv, long long & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //5+
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
int getCache(const char * pv, dbr_double_t & val); //6
|
||||
int getCache(const char * pv, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
|
||||
int getCache(const char * pv, dbr_double_t & val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
|
||||
|
||||
|
||||
//6
|
||||
int getCache(const char * pv, dbr_double_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
//5+
|
||||
int getCache(const char * pv, long long * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, _val);
|
||||
};
|
||||
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
//5
|
||||
int getCache(const char * pv, dbr_long_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeLatte.getCache(handle, DBR_LONG, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//4
|
||||
int getCache(const char * pv, dbr_char_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//3
|
||||
int getCache(const char * pv, dbr_enum_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//2
|
||||
int getCache(const char * pv, dbr_float_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//1
|
||||
int getCache(const char * pv, dbr_short_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSchale.getCache(handle, DBR_SHORT, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
//0
|
||||
int getCache(const char * pv, dbr_string_t * _val) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
};
|
||||
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
};
|
||||
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
//0+
|
||||
int getCache(const char * pv, string * valStr) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
};
|
||||
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
|
||||
unsigned int handle=handleHelper.getHandleFromPV(pv);
|
||||
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
|
||||
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
|
||||
delete [] _val; return status;
|
||||
}
|
||||
|
||||
#endif // CAFECACHE_H
|
||||
396
include/cafeConvert.h
Normal file
396
include/cafeConvert.h
Normal file
@@ -0,0 +1,396 @@
|
||||
///
|
||||
/// \file cafeConvert.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFECONVERT_H
|
||||
#define CAFECONVERT_H
|
||||
|
||||
#include <cafeDataType.h>
|
||||
#include <cstdlib> // g++ 4.4.4
|
||||
#include <cstdio>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/**
|
||||
* CAFEConvert Template \n
|
||||
* CTYPE is the input data type \n
|
||||
* PVDataHolder methods use CAFEConvert as follows: \n
|
||||
* method getAsDouble() converts CTYPE to double \n
|
||||
* method getAsFloat () converts CTYPE to float \n
|
||||
* method getAsShort () converts CTYPE to short \n
|
||||
* method getAsEnum () converts CTYPE to enum \n
|
||||
* method getAsChar () converts CTYPE to char \n
|
||||
* method getAsLong () converts CTYPE to int \n
|
||||
* method getAsString() converts CTYPE to string \n
|
||||
*
|
||||
*/
|
||||
template <class CTYPE> class CAFEConvert {
|
||||
private:
|
||||
CTYPE returnVal[1];
|
||||
public:
|
||||
CAFEConvert (unsigned int nelem){};
|
||||
CAFEConvert (){};
|
||||
~CAFEConvert (){};
|
||||
CTYPE * get(unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val);
|
||||
CTYPE * getString(unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val);
|
||||
CTYPE * getStringFromEnum(unsigned int index, unsigned int noStr, CAFE_DATATYPE_UNION_SEQ val, char stig[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]);
|
||||
CTYPE * get(CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val);
|
||||
CTYPE * getString(CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Converts from native type to CTYPE
|
||||
* \param dt input: CAFE_DATATYPE
|
||||
* \param val input: CAFE_DATATYPE_UNION
|
||||
* \return CTYPE
|
||||
*/
|
||||
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val)
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::get(dt, val)"
|
||||
|
||||
// (boost::math::isnan) calls the Boost version of the isnan macro
|
||||
// Valid for all types that have numeric_limits support
|
||||
// (brackets required) to avoid compiler error should isnan also be a native macro
|
||||
|
||||
switch (dt) {
|
||||
case CAFE_DOUBLE:
|
||||
if ( (boost::math::isnan)((CTYPE) val.d) ) {
|
||||
returnVal[0]= (CTYPE) val.d;
|
||||
}
|
||||
else {
|
||||
returnVal[0]= (CTYPE) 0;
|
||||
}
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
if ( (boost::math::isnan)((CTYPE) val.f) ) {
|
||||
returnVal[0]= (CTYPE) val.f;
|
||||
} else {
|
||||
returnVal[0]= 0;
|
||||
}
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
returnVal[0]= (CTYPE) val.l;
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
returnVal[0]= (CTYPE) val.s;
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
returnVal[0]= (CTYPE) val.us;
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
returnVal[0]= (CTYPE) val.ch;
|
||||
break;
|
||||
case CAFE_STRING:
|
||||
returnVal[0]= (CTYPE) strtod( val.str, NULL);
|
||||
break;
|
||||
case CAFE_TYPENOTCONN:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_NO_ACCESS:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_INVALID_DATATYPE:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_NOT_REQUESTED:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_NOT_SHOWN:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
default:
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
<< " CAFE INTERNAL ERROR: Unknown dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
}
|
||||
|
||||
return (CTYPE *) returnVal;
|
||||
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts from native type to CTYPE
|
||||
* \param index input: index to val array
|
||||
* \param dt input: CAFE_DATATYPE
|
||||
* \param val input: CAFE_DATATYPE_UNION_SEQ
|
||||
* \return CTYPE
|
||||
*/
|
||||
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val)
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::get(index, dt, val[])"
|
||||
|
||||
switch (dt) {
|
||||
case CAFE_DOUBLE:
|
||||
returnVal[0]= (CTYPE) val[index].d;
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
returnVal[0]= (CTYPE) val[index].f;
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
returnVal[0]= (CTYPE) val[index].l;
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
returnVal[0]= (CTYPE) val[index].s;
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
returnVal[0]= (CTYPE) val[index].us;
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
returnVal[0]= (CTYPE) val[index].ch;
|
||||
break;
|
||||
case CAFE_STRING:
|
||||
returnVal[0]= (CTYPE) strtod( val[index].str, NULL);
|
||||
break;
|
||||
case CAFE_TYPENOTCONN:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_NO_ACCESS:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_INVALID_DATATYPE:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_NOT_REQUESTED:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
case CAFE_NOT_SHOWN:
|
||||
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
default:
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
<< " CAFE INTERNAL ERROR: Unknown dataType: " << dt << " " << endl;
|
||||
returnVal[0]=0;
|
||||
break;
|
||||
}
|
||||
|
||||
return (CTYPE *) returnVal;
|
||||
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Converts from DBR_ENUM type to CTYPE=STRING
|
||||
* \param index input: index to val array
|
||||
* \param noStr input: number of enumerations
|
||||
* \param val input: CAFE_DATATYPE_UNION_SEQ
|
||||
* \param stig input: stig[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE] an array of enum choices
|
||||
* \return CTYPE
|
||||
*/
|
||||
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getStringFromEnum (unsigned int index, unsigned int noStr, CAFE_DATATYPE_UNION_SEQ val,
|
||||
char stig[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE])
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::getStringFromEnum(indx, noStr, val, stig)"
|
||||
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStr; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
|
||||
if (noStr==noEmptyStrings) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
|
||||
cout << "BADLY CONFIGURED EPICS RECORD. " << endl;
|
||||
}
|
||||
|
||||
|
||||
if (index < noStr && noStr!=noEmptyStrings) {
|
||||
sprintf(returnVal[0], "%s", stig[val[index].us] );
|
||||
}
|
||||
else {
|
||||
sprintf(returnVal[0], "%d", val[index].us );
|
||||
if ( val[index].us>= noStr) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
|
||||
cout << "VALUE (unsigned short) = " << val[index].us << endl;
|
||||
cout << "NO OF ENUMERATED STRINGS = " << noStr << " WITH VALUES: " << endl;
|
||||
for (unsigned int j=0; j<noStr; ++j) {
|
||||
cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return (CTYPE *) returnVal;
|
||||
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts from native type to CTYPE=STRING
|
||||
* \param index input: index to val array
|
||||
* \param dt input: CAFE_DATATYPE
|
||||
* \param val input: CAFE_DATATYPE_UNION_SEQ
|
||||
* \return CTYPE
|
||||
*/
|
||||
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val)
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::getString(nelem, dt, val[])"
|
||||
|
||||
switch (dt) {
|
||||
case CAFE_STRING:
|
||||
sprintf(returnVal[0], "%s", val[index].str);
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
sprintf(returnVal[0], "%u", val[index].ch);
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
sprintf(returnVal[0], "%f", val[index].f); //floats offer a precision of 6
|
||||
break;
|
||||
case CAFE_DOUBLE:
|
||||
sprintf(returnVal[0], "%.15f", val[index].d); //double offer a precicion of 15
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
sprintf(returnVal[0], "%d", val[index].s);
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
sprintf(returnVal[0], "%d", val[index].l);
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
sprintf(returnVal[0], "%u", val[index].us);
|
||||
break;
|
||||
case CAFE_TYPENOTCONN:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout << " ERROR CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //CAFE_TYPENOTCONN");
|
||||
break;
|
||||
case CAFE_NO_ACCESS:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //"CAFE_NO_ACCESS");
|
||||
break;
|
||||
case CAFE_INVALID_DATATYPE:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //"CAFE_INVALID_DATATYPE");
|
||||
break;
|
||||
case CAFE_NOT_REQUESTED:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //"");
|
||||
break;
|
||||
case CAFE_NOT_SHOWN:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE_NOT_SHOWN: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); // "CAFE_NOT_SHOWN");
|
||||
break;
|
||||
default:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE INTERNAL ERROR: Unknown dataType: "<< dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0");// "Unknown dataType");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return (CTYPE *) returnVal;
|
||||
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts from native type to CTYPE=STRING
|
||||
* \param dt input: CAFE_DATATYPE
|
||||
* \param val CAFE_DATATYPE_UNION input
|
||||
* \return CTYPE
|
||||
*/
|
||||
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val)
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::getString(dt, val[])"
|
||||
|
||||
switch (dt) {
|
||||
case CAFE_STRING:
|
||||
sprintf(returnVal[0], "%s", val.str);
|
||||
break;
|
||||
case CAFE_CHAR:
|
||||
sprintf(returnVal[0], "%u", val.ch);
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
sprintf(returnVal[0], "%f", val.f); //floats offer a precision of 6
|
||||
break;
|
||||
case CAFE_DOUBLE:
|
||||
sprintf(returnVal[0], "%.15f", val.d); //double offer a precicion of 15
|
||||
break;
|
||||
case CAFE_SHORT:
|
||||
sprintf(returnVal[0], "%d", val.s);
|
||||
break;
|
||||
case CAFE_LONG:
|
||||
sprintf(returnVal[0], "%d", val.l);
|
||||
break;
|
||||
case CAFE_ENUM:
|
||||
sprintf(returnVal[0], "%u", val.us);
|
||||
break;
|
||||
case CAFE_TYPENOTCONN:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout << " ERROR CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //CAFE_TYPENOTCONN");
|
||||
break;
|
||||
case CAFE_NO_ACCESS:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //"CAFE_NO_ACCESS");
|
||||
break;
|
||||
case CAFE_INVALID_DATATYPE:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //"CAFE_INVALID_DATATYPE");
|
||||
break;
|
||||
case CAFE_NOT_REQUESTED:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); //"");
|
||||
break;
|
||||
case CAFE_NOT_SHOWN:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE_NOT_SHOWN: dataType: " << dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0"); // "CAFE_NOT_SHOWN");
|
||||
break;
|
||||
default:
|
||||
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
//cout<< " CAFE INTERNAL ERROR: Unknown dataType: "<< dt << " " << endl;
|
||||
sprintf(returnVal[0], "%s", "0");// "Unknown dataType");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return (CTYPE *) returnVal;
|
||||
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
118
include/cafeDataType.h
Normal file
118
include/cafeDataType.h
Normal file
@@ -0,0 +1,118 @@
|
||||
///
|
||||
/// \file cafeDataType.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFEDATATYPE_H
|
||||
#define CAFEDATATYPE_H
|
||||
|
||||
#include <cadef.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
enum CAFE_DATATYPE {
|
||||
CAFE_TYPENOTCONN = TYPENOTCONN, // -1 val returned by ca_field_type when channel not connected
|
||||
CAFE_STRING = DBF_STRING, // 0
|
||||
CAFE_SHORT = DBF_SHORT, // 1
|
||||
CAFE_INT = DBF_INT, // 1
|
||||
CAFE_FLOAT = DBF_FLOAT, // 2
|
||||
CAFE_ENUM = DBF_ENUM, // 3
|
||||
CAFE_USHORT = DBF_ENUM, // 3
|
||||
CAFE_CHAR = DBF_CHAR, // 4
|
||||
CAFE_LONG = DBF_LONG, // 5
|
||||
CAFE_DOUBLE = DBF_DOUBLE, // 6
|
||||
CAFE_NO_ACCESS = DBF_NO_ACCESS, //7
|
||||
CAFE_INVALID_DATATYPE = 8,
|
||||
CAFE_NOT_REQUESTED = 100,
|
||||
CAFE_NOT_SHOWN = 101 // (in stop monitor)
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides methods to convert between
|
||||
* the CAFE_DATATYPES and text equivalent
|
||||
*/
|
||||
class CAFEDataTypeCode {
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapDataType;
|
||||
mapLongString::iterator pos;
|
||||
public:
|
||||
CAFEDataTypeCode() {
|
||||
mapDataType.insert(std::make_pair((int) CAFE_TYPENOTCONN, "CAFE_TYPENOTCONN" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_STRING, "DBF_STRING" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_SHORT, "DBF_SHORT" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_INT, "DBF_SHORT" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_FLOAT, "DBF_FLOAT" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_ENUM, "DBF_ENUM" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_CHAR, "DBF_CHAR" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_LONG, "DBF_LONG" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_DOUBLE, "DBF_DOUBLE" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_NO_ACCESS, "DBF_NO_ACCESS" ));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_INVALID_DATATYPE, "CAFE_INVALID_DATATYPE"));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_NOT_REQUESTED, "CAFE_NOT_REQUESTED"));
|
||||
mapDataType.insert(std::make_pair((int) CAFE_NOT_SHOWN, "CAFE_NOT_SHOWN (IN STOP MONITOR)"));
|
||||
};
|
||||
|
||||
~CAFEDataTypeCode() {};
|
||||
|
||||
std::string message (int i) {
|
||||
pos = mapDataType.find(i);
|
||||
if (pos != mapDataType.end()) return pos->second;
|
||||
return "CAFE_DATATYPE_UNKNOWN";
|
||||
};
|
||||
|
||||
|
||||
std::string asString (int i) {
|
||||
pos = mapDataType.find(i);
|
||||
if (pos != mapDataType.end()) return pos->second;
|
||||
return "CAFE_DATATYPE_UNKNOWN";
|
||||
};
|
||||
|
||||
int enumIs (std::string message) {
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
|
||||
if (pos->second==message) return pos->first;
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
||||
int asEnum (std::string message) {
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
|
||||
if (pos->second==message) return pos->first;
|
||||
return -1;
|
||||
};
|
||||
|
||||
void show() {print();}
|
||||
|
||||
void print ( ) {
|
||||
std::cout << "------------------" << std::endl;
|
||||
std::cout << "CAFE_DATATYPE LIST" << std::endl;
|
||||
std::cout << "-----------------" << std::endl;
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "-----------------" << std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* A union of CAFE primitive datatypes
|
||||
*/
|
||||
union CAFE_DATATYPE_UNION {
|
||||
dbr_string_t str;
|
||||
dbr_short_t s;
|
||||
dbr_float_t f;
|
||||
dbr_enum_t us; //unsigned short us;
|
||||
dbr_char_t ch; //unsigned char ch;
|
||||
dbr_long_t l; //int l;
|
||||
dbr_double_t d;
|
||||
};
|
||||
|
||||
typedef CAFE_DATATYPE_UNION * CAFE_DATATYPE_UNION_SEQ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
65
include/cafeDataTypeHelper.h
Normal file
65
include/cafeDataTypeHelper.h
Normal file
@@ -0,0 +1,65 @@
|
||||
///
|
||||
/// \file cafeDataTypeHelper.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFEDATATYPEHELPER_H
|
||||
#define CAFEDATATYPEHELP_H
|
||||
|
||||
#include <cadef.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <cafeDataType.h>
|
||||
|
||||
class CafeDataTypeHelper{
|
||||
private:
|
||||
CAFE_DATATYPE_UNION cdu;
|
||||
CAFE_DATATYPE dataType;
|
||||
|
||||
public:
|
||||
CafeDataTypeHelper(CAFE_DATATYPE_UNION _cdu, CAFE_DATATYPE _dataType){
|
||||
cdu=_cdu;
|
||||
dataType=_dataType;
|
||||
};
|
||||
|
||||
~CafeDataTypeHelper(){};
|
||||
|
||||
CAFEConvert<double> renderDouble;
|
||||
CAFEConvert<float> renderFloat;
|
||||
CAFEConvert<short> renderShort;
|
||||
//CAFEConvert<int> renderLong;
|
||||
CAFEConvert<unsigned short> renderEnum;
|
||||
CAFEConvert<unsigned char> renderUChar;
|
||||
CAFEConvert<dbr_string_t> renderString;
|
||||
|
||||
CAFEConvert<char> renderChar;
|
||||
//CAFEConvert<unsigned int> renderULong;
|
||||
CAFEConvert<long long> renderLongLong;
|
||||
CAFEConvert<unsigned long long> renderULongLong;
|
||||
|
||||
CAFEConvert<int> renderInt;
|
||||
CAFEConvert<unsigned int> renderUInt;
|
||||
|
||||
std::string getAsString(){
|
||||
return (std::string) renderString.getString(dataType, cdu)[0];
|
||||
};
|
||||
dbr_string_t * getAsDbr_string_t(){
|
||||
return (dbr_string_t *) (renderString.getString(dataType, cdu)[0]);
|
||||
};
|
||||
double getAsDouble(){return (double) renderDouble.get(dataType, cdu)[0];};
|
||||
float getAsFloat() {return (float) renderFloat.get (dataType, cdu)[0];};
|
||||
short getAsShort() {return (short) renderShort.get(dataType, cdu)[0];};
|
||||
dbr_enum_t getAsEnum(){return (dbr_enum_t) renderEnum.get(dataType, cdu)[0];};
|
||||
unsigned short getAsUShort(){return (unsigned short) renderEnum.get(dataType, cdu)[0];};
|
||||
int getAsInt() {return (int) renderInt.get(dataType, cdu)[0];};
|
||||
unsigned int getAsUInt() {return (int) renderUInt.get(dataType, cdu)[0];};
|
||||
char getAsChar() {return (char) renderChar.get(dataType, cdu)[0];};
|
||||
unsigned char getAsUChar(){return (unsigned char) renderUChar.get(dataType, cdu)[0];};
|
||||
long long getAsLongLong() {return (long long) renderLongLong.get(dataType, cdu)[0];};
|
||||
unsigned int getAsULongLong() {return (unsigned long long) renderULongLong.get(dataType, cdu)[0];};
|
||||
};
|
||||
|
||||
#endif
|
||||
152
include/cafeEnum.h
Normal file
152
include/cafeEnum.h
Normal file
@@ -0,0 +1,152 @@
|
||||
///
|
||||
/// \file cafeEnum.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFEENUM_H
|
||||
#define CAFEENUM_H
|
||||
|
||||
#include <cadef.h>
|
||||
|
||||
namespace CAFENUM {
|
||||
|
||||
/**
|
||||
* Data request buffer types \n
|
||||
* i.e. whether PRIMITIVE, STS, TIME, GR or CTRL
|
||||
*/
|
||||
enum DBR_TYPE {
|
||||
DBR_PRIMITIVE,
|
||||
DBR_PLAIN=DBR_PRIMITIVE,
|
||||
DBR_STS,
|
||||
DBR_TIME,
|
||||
DBR_GR,
|
||||
DBR_CTRL,
|
||||
DBR_PUT, //DBR_PUT_ACKT and DBR_PUT_ACKS Write only - used from global alarm acknowledge.
|
||||
DBR_STSACK, // is DBR_STSACK_STRING
|
||||
DBR_CLASS, // is DBR_CLASS_NAME,
|
||||
DBR_NONE // should not occur, but used internally within cafeVectors.h
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Define enum type to flush io after creating channels
|
||||
*/
|
||||
enum ChannelFlushSendBufferPolicyKind {
|
||||
WITH_FLUSH_IO,
|
||||
WITH_PEND_IO, // needs timeout duration
|
||||
WITH_PEND_EVENT, // needs timeout duration
|
||||
WITH_POLL
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Define enum type defining when to flush io after creating channels
|
||||
*/
|
||||
enum ChannelWhenToFlushSendBufferPolicyKind {
|
||||
FLUSH_AUTOMATIC=0,
|
||||
FLUSH_NOW=FLUSH_AUTOMATIC,
|
||||
FLUSH_AFTER_EACH_CHANNEL_CREATION=FLUSH_NOW, // instantly
|
||||
FLUSH_AFTER_EACH_CHANNEL_SUBSCRIPTION=FLUSH_NOW,
|
||||
FLUSH_AFTER_EACH_MESSAGE=FLUSH_NOW,
|
||||
FLUSH_AFTER_EACH_GROUP_CREATION=FLUSH_NOW,
|
||||
FLUSH_DESIGNATED_TO_CLIENT //
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum type defining ca server dispatch priority
|
||||
* Note that specifying different priorities within the same program
|
||||
* can increase resource consumption in thw client and server because
|
||||
* an independent virtual circuit, and associated data structures, is
|
||||
* created for each priority that is used on a particular server
|
||||
*/
|
||||
enum ChannelServerDispatchPriority {
|
||||
CA_SERVER_DISPATCH_PRIORITY_MIN =CA_PRIORITY_MIN, //0
|
||||
CA_SERVER_DISPATCH_PRIORITY_VERYLOW =CA_PRIORITY_MIN+1,
|
||||
CA_SERVER_DISPATCH_PRIORITY_DEFAULT =CA_PRIORITY_MAX, //CA_SERVER_DISPATCH_PRIORITY_VERYLOW, //1
|
||||
CA_SERVER_DISPATCH_PRIORITY_LOW =CA_PRIORITY_MIN+25,
|
||||
CA_SERVER_DISPATCH_PRIORITY_MED =CA_PRIORITY_MIN+50,
|
||||
CA_SERVER_DISPATCH_PRIORITY_HIGH =CA_PRIORITY_MIN+75,
|
||||
CA_SERVER_DISPATCH_PRIORITY_VERYHIGH=CA_PRIORITY_MIN+98,
|
||||
CA_SERVER_DISPATCH_PRIORITY_MAX =CA_PRIORITY_MAX
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enum type defining the wait/nowait modes for cache operations.
|
||||
* Meant for use within callbacks to ensure that cache operations
|
||||
* are never blocked
|
||||
*/
|
||||
enum ChannelGetCacheWaitPolicyKind {
|
||||
GET_CACHE_NO_CHECK=0,
|
||||
GET_CACHE_NO_WAIT,
|
||||
GET_CACHE_NOW =GET_CACHE_NO_WAIT,
|
||||
GET_CACHE_WAIT
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enum type defining the modes for get operations when a
|
||||
* monitor is in place
|
||||
*
|
||||
*/
|
||||
enum ChannelGetActionWhenMonitorPolicyKind {
|
||||
GET_FROM_CACHE,
|
||||
GET_FROM_IOC
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum type defining the blocking modes for ca operations.
|
||||
* Blocking can be achieved with or without callback.
|
||||
* Callback can further be supplied by the user
|
||||
*/
|
||||
enum ChannelRequestPolicyKind {
|
||||
WITHOUT_CALLBACK,
|
||||
WITH_CALLBACK_DEFAULT,
|
||||
WITH_CALLBACK_USER_SUPPLIED
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enum type defining level of datatype conversion at the IOC
|
||||
*
|
||||
*/
|
||||
enum ChannelRequestDataTypePolicyKind {
|
||||
NATIVE_DATATYPE,
|
||||
LOWEST_DATATYPE // The smaller in byte size of type requested and native datatype
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enum type defining whether to wait for a response
|
||||
* from a message sent with a callback, whether it be
|
||||
* user supplied or the CAFE default.
|
||||
*/
|
||||
enum ChannelWaitForResponsePolicyKind {
|
||||
BLOCKING=0,
|
||||
WAIT=BLOCKING,
|
||||
NON_BLOCKING=1,
|
||||
NO_WAIT=NON_BLOCKING
|
||||
};
|
||||
|
||||
|
||||
enum StatusMessageKind {
|
||||
NO_MESSAGE,
|
||||
PRE_REQUEST,
|
||||
FROM_REQUEST,
|
||||
FROM_PEND,
|
||||
FROM_CALLBACK,
|
||||
FROM_MESSAGE
|
||||
};
|
||||
|
||||
enum CallbackProgressKind {
|
||||
NOT_INITIATED,
|
||||
PENDING,
|
||||
COMPLETE
|
||||
};
|
||||
|
||||
}; //namespace CAFENUM
|
||||
|
||||
#endif // CAFEENUM_H
|
||||
44
include/cafeEnumStrings.h
Normal file
44
include/cafeEnumStrings.h
Normal file
@@ -0,0 +1,44 @@
|
||||
///
|
||||
/// \file cafeEnumStrings.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
|
||||
#ifndef CAFEENUMSTRINGS_H
|
||||
#define CAFEENUMSTRINGS_H
|
||||
|
||||
|
||||
#include "cafeEnum.h"
|
||||
#include "enumStrings.h"
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelWaitForResponsePolicyKind>::data[]
|
||||
= {"CAFENUM::WAIT", "CAFENUM::NO_WAIT"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelRequestDataTypePolicyKind>::data[]
|
||||
= {"CAFENUM::NATIVE_DATATYPE", "CAFENUM::LOWEST_DATATYPE"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelFlushSendBufferPolicyKind>::data[]
|
||||
= {"CAFENUM::WITH_FLUSH_IO","CAFENUM::WITH_PEND_IO","CAFENUM::WITH_PEND_EVENT", "CAFENUM::WITH_POLL"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelWhenToFlushSendBufferPolicyKind>::data[]
|
||||
= {"CAFENUM::FLUSH_AFTER_EACH_MESSAGE","CAFENUM::FLUSH_DESIGNATED_TO_CLIENT"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelRequestPolicyKind>::data[]
|
||||
= {"CAFENUM::WITHOUT_CALLBACK","CAFENUM::WITH_CALLBACK_DEFAULT","CAFENUM::WITH_CALLBACK_USER_SUPPLIED"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::DBR_TYPE>::data[]
|
||||
= {"CAFENUM::DBR_PRIMITIVE","CAFENUM::DBR_STS","CAFENUM::DBR_TIME", "CAFENUM::DBR_GR",
|
||||
"CAFENUM::DBR_CTRL","CAFENUM::DBR_PUT", "CAFENUM::DBR_STSACK","CAFENUM::DBR_CLASS",
|
||||
"CAFENUM::DBR_OTHER"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::StatusMessageKind>::data[]
|
||||
= {"CAFENUM::NO_MESSAGE","CAFENUM::PRE_REQUEST","CAFENUM::FROM_REQUEST","CAFENUM::FROM_PEND",
|
||||
"CAFENUM::FROM_CALLBACK"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::CallbackProgressKind>::data[]
|
||||
= {"CAFENUM::NOT_INITIATED","CAFENUM::PENDING","CAFENUM::COMPLETE"};
|
||||
|
||||
|
||||
#endif // CAFEENUMSTRINGS_H
|
||||
505
include/cafeRoast.h
Normal file
505
include/cafeRoast.h
Normal file
@@ -0,0 +1,505 @@
|
||||
///
|
||||
/// \file cafeRoast.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: January 2016
|
||||
/// \version CAFE 1.3.0
|
||||
///
|
||||
/// Add Match methods
|
||||
///
|
||||
|
||||
#ifndef CAFEROAST_H
|
||||
#define CAFEROAST_H
|
||||
|
||||
|
||||
int setAndGet (const unsigned int handleSet, dbr_double_t valSet, dbr_double_t &valGet) {
|
||||
status=cafeDoppio.setAndGet((unsigned int) handleSet, DBR_DOUBLE, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, dbr_float_t valSet, dbr_float_t &valGet) {
|
||||
status=cafeFrappuccino.setAndGet((unsigned int) handleSet, DBR_FLOAT, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, dbr_char_t valSet, dbr_char_t &valGet) {
|
||||
status=cafeCappuccino.setAndGet((unsigned int) handleSet, DBR_CHAR, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, dbr_enum_t valSet, dbr_enum_t &valGet) {
|
||||
status=cafeEspresso.setAndGet((unsigned int) handleSet, DBR_ENUM, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, dbr_short_t valSet, dbr_short_t &valGet) {
|
||||
status=cafeSchale.setAndGet((unsigned int) handleSet, DBR_SHORT, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, dbr_long_t valSet, dbr_long_t &valGet) {
|
||||
status=cafeLatte.setAndGet((unsigned int) handleSet, DBR_LONG, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, long long valSet, long long &valGet) {
|
||||
double valSetD=valSet; double valGetD=0;
|
||||
status=cafeDoppio.setAndGet((unsigned int) handleSet, DBR_DOUBLE, valSetD, valGetD);
|
||||
valGet=(long long) valGetD;
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, dbr_string_t valSet, dbr_string_t &valGet) {
|
||||
status=cafeSoluble.setAndGetDbrString((unsigned int) handleSet, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
int setAndGet (const unsigned int handleSet, string valSet, string &valGet) {
|
||||
status=cafeSoluble.setAndGetString((unsigned int) handleSet, valSet, valGet);
|
||||
return status;
|
||||
}
|
||||
|
||||
//
|
||||
int match(dbr_double_t valSet, unsigned int handleMatch,
|
||||
dbr_double_t tolerance, double timeout, bool printFlag){
|
||||
return cafeDoppio.match(DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int match(dbr_float_t valSet, unsigned int handleMatch,
|
||||
dbr_float_t tolerance, double timeout, bool printFlag){
|
||||
return cafeFrappuccino.match(DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int match(dbr_char_t valSet, unsigned int handleMatch,
|
||||
dbr_char_t tolerance, double timeout, bool printFlag){
|
||||
return cafeCappuccino.match(DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int match(dbr_enum_t valSet, unsigned int handleMatch,
|
||||
dbr_enum_t tolerance, double timeout, bool printFlag){
|
||||
return cafeEspresso.match(DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int match(dbr_short_t valSet, unsigned int handleMatch,
|
||||
dbr_short_t tolerance, double timeout, bool printFlag){
|
||||
return cafeSchale.match(DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int match(dbr_long_t valSet, unsigned int handleMatch,
|
||||
dbr_long_t tolerance, double timeout, bool printFlag){
|
||||
return cafeLatte.match(DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int match(long long valSet, unsigned int handleMatch,
|
||||
long long tolerance, double timeout, bool printFlag){
|
||||
dbr_double_t valSetDouble=valSet;
|
||||
dbr_double_t toleranceDouble = tolerance;
|
||||
return cafeDoppio.match(DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
}
|
||||
|
||||
int match(string valSet, unsigned int handleMatch,
|
||||
string tolerance, double timeout, bool printFlag){
|
||||
#define __METHOD__ "match (string valSet, unsigned int handleMatch,\
|
||||
string tolerance, double timeout, bool printFlag)"
|
||||
|
||||
istringstream ss;
|
||||
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
|
||||
ss.clear();
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << valSet;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << tolerance;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
|
||||
return cafeDoppio.match(DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
|
||||
int match(dbr_string_t valSet, unsigned int handleMatch,
|
||||
dbr_string_t tolerance, double timeout, bool printFlag){
|
||||
#define __METHOD__ "match (dbr_string_t valSet, unsigned int handleMatch,\
|
||||
dbr_string_t tolerance, double timeout, bool printFlag)"
|
||||
istringstream ss;
|
||||
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
|
||||
ss.clear();
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << valSet;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << tolerance;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
|
||||
return cafeDoppio.match(DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
//
|
||||
int matchMany(vector<dbr_double_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_double_t tolerance, double timeout, bool printFlag){
|
||||
return cafeDoppio.matchMany(DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int matchMany(vector<dbr_float_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_float_t tolerance, double timeout, bool printFlag){
|
||||
return cafeFrappuccino.matchMany(DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int matchMany(vector<dbr_char_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_char_t tolerance, double timeout, bool printFlag){
|
||||
return cafeCappuccino.matchMany(DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int matchMany(vector<dbr_enum_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_enum_t tolerance, double timeout, bool printFlag){
|
||||
return cafeEspresso.matchMany(DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int matchMany(vector<dbr_short_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_short_t tolerance, double timeout, bool printFlag){
|
||||
return cafeSchale.matchMany(DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int matchMany(vector<dbr_long_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_long_t tolerance, double timeout, bool printFlag){
|
||||
return cafeLatte.matchMany(DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int matchMany(vector<long long> valSet, vector<unsigned int> handleMatch,
|
||||
long long tolerance, double timeout, bool printFlag){
|
||||
|
||||
vector<dbr_double_t> valSetDoubleV;
|
||||
valSetDoubleV.reserve(valSet.size());
|
||||
|
||||
std::copy(valSet.begin(), valSet.end(),
|
||||
std::back_inserter(valSetDoubleV));
|
||||
|
||||
dbr_double_t toleranceDouble = tolerance;
|
||||
|
||||
return cafeDoppio.matchMany(DBR_DOUBLE, valSetDoubleV, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
}
|
||||
|
||||
int matchMany(vector<string> valSetV, vector<unsigned int> handleMatchV,
|
||||
string tolerance, double timeout, bool printFlag){
|
||||
#define __METHOD__ "matchMany (vector<string> valSetV, vector<unsigned int> handleMatchV, \
|
||||
string tolerance, double timeout, bool printFlag)"
|
||||
|
||||
vector<dbr_double_t> valSetDoubleV;
|
||||
|
||||
istringstream ss;
|
||||
dbr_double_t d=0; dbr_double_t toleranceDouble = 0;
|
||||
for (size_t i=0; i< valSetV.size(); ++i) {
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(valSetV[i]);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
valSetDoubleV.push_back(d);
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << valSetV[i];
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
}
|
||||
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << tolerance;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
|
||||
return cafeDoppio.matchMany(DBR_DOUBLE, valSetDoubleV, handleMatchV, toleranceDouble, timeout, printFlag);
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_double_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_double_t tolerance, double timeout, bool printFlag){
|
||||
return cafeDoppio.setAndMatchMany(handleSet, DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_float_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_float_t tolerance, double timeout, bool printFlag){
|
||||
return cafeFrappuccino.setAndMatchMany(handleSet, DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_char_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_char_t tolerance, double timeout, bool printFlag){
|
||||
return cafeCappuccino.setAndMatchMany(handleSet, DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_enum_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_enum_t tolerance, double timeout, bool printFlag){
|
||||
return cafeEspresso.setAndMatchMany(handleSet, DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_short_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_short_t tolerance, double timeout, bool printFlag){
|
||||
return cafeSchale.setAndMatchMany(handleSet, DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_long_t> valSet, vector<unsigned int> handleMatch,
|
||||
dbr_long_t tolerance, double timeout, bool printFlag){
|
||||
return cafeLatte.setAndMatchMany(handleSet, DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSet, vector<long long> valSet, vector<unsigned int> handleMatch,
|
||||
long long tolerance, double timeout, bool printFlag){
|
||||
|
||||
vector<dbr_double_t> valSetDoubleV;
|
||||
valSetDoubleV.reserve(valSet.size());
|
||||
|
||||
std::copy(valSet.begin(), valSet.end(),
|
||||
std::back_inserter(valSetDoubleV));
|
||||
|
||||
dbr_double_t toleranceDouble = tolerance;
|
||||
|
||||
return cafeDoppio.setAndMatchMany(handleSet, DBR_DOUBLE, valSetDoubleV, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSetV, vector<string> valSetV, vector<unsigned int> handleMatchV,
|
||||
string tolerance, double timeout, bool printFlag){
|
||||
#define __METHOD__ "setAndMatchMany (vector<unsigned int> handleSetV, vector<string> valSetV, vector<unsigned int> handleMatchV, \
|
||||
string tolerance, double timeout, bool printFlag)"
|
||||
|
||||
vector<dbr_double_t> valSetDoubleV;
|
||||
|
||||
istringstream ss;
|
||||
dbr_double_t d=0; dbr_double_t toleranceDouble = 0;
|
||||
for (size_t i=0; i< valSetV.size(); ++i) {
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(valSetV[i]);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
valSetDoubleV.push_back(d);
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << valSetV[i];
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
}
|
||||
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << tolerance;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
|
||||
return cafeDoppio.setAndMatchMany(handleSetV, DBR_DOUBLE, valSetDoubleV, handleMatchV, toleranceDouble, timeout, printFlag);
|
||||
#undef __METHOD__
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, dbr_double_t valSet, const unsigned int handleMatch,
|
||||
dbr_double_t tolerance, double timeout, bool printFlag){
|
||||
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, dbr_float_t valSet, const unsigned int handleMatch,
|
||||
dbr_float_t tolerance, double timeout, bool printFlag){
|
||||
return cafeFrappuccino.setAndMatch(handleSet, DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, dbr_char_t valSet, const unsigned int handleMatch,
|
||||
dbr_char_t tolerance, double timeout, bool printFlag){
|
||||
return cafeCappuccino.setAndMatch(handleSet, DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, dbr_enum_t valSet, const unsigned int handleMatch,
|
||||
dbr_enum_t tolerance, double timeout, bool printFlag){
|
||||
return cafeEspresso.setAndMatch(handleSet, DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, dbr_short_t valSet, const unsigned int handleMatch,
|
||||
dbr_short_t tolerance, double timeout, bool printFlag){
|
||||
return cafeSchale.setAndMatch(handleSet, DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, dbr_long_t valSet, const unsigned int handleMatch,
|
||||
dbr_long_t tolerance, double timeout, bool printFlag){
|
||||
return cafeLatte.setAndMatch(handleSet, DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
|
||||
}
|
||||
int setAndMatch(const unsigned int handleSet, long long valSet, const unsigned int handleMatch,
|
||||
long long tolerance, double timeout, bool printFlag){
|
||||
dbr_double_t valSetDouble=valSet;
|
||||
dbr_double_t toleranceDouble = tolerance;
|
||||
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
}
|
||||
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, dbr_string_t valSet, const unsigned int handleMatch,
|
||||
dbr_string_t tolerance, double timeout, bool printFlag){
|
||||
#define __METHOD__ "setAndMatch (dbr_string_t input)"
|
||||
istringstream ss;
|
||||
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
|
||||
ss.clear();
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << valSet;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << tolerance;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
|
||||
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
int setAndMatch(const unsigned int handleSet, string valSet, const unsigned int handleMatch,
|
||||
string tolerance, double timeout, bool printFlag){
|
||||
#define __METHOD__ "setAndMatch (string input)"
|
||||
istringstream ss;
|
||||
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
|
||||
ss.clear();
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << valSet;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
cout << __METHOD__ << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << tolerance;
|
||||
cout << " TO DOUBLE!" << endl;
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
|
||||
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
#endif // CAFEROAST_H
|
||||
640
include/cafeService.h
Normal file
640
include/cafeService.h
Normal file
@@ -0,0 +1,640 @@
|
||||
///
|
||||
/// \file cafeService.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release July: 2017
|
||||
/// \version CAFE 1.3.0
|
||||
///
|
||||
|
||||
#ifndef CAFE_SERVICE_H
|
||||
#define CAFE_SERVICE_H
|
||||
|
||||
#include <config.h>
|
||||
#include <vector>
|
||||
#include <PVDataHolder.h>
|
||||
#include <statusCodes.h>
|
||||
#include <global.h>
|
||||
|
||||
|
||||
#if HAVE_ZEROMQ
|
||||
//include <zhelpers.h>
|
||||
#include <zmq.h>
|
||||
#if HAVE_JSON
|
||||
#include <json/json.h>
|
||||
#endif
|
||||
#if HAVE_CURL
|
||||
#include <curl/curl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
class BSData{
|
||||
friend class CAFE;
|
||||
private:
|
||||
double val;
|
||||
epicsTimeStamp ets;
|
||||
int status;
|
||||
public:
|
||||
double getValue() {return val;}
|
||||
epicsTimeStamp getEpicsTimeStamp() {return ets;}
|
||||
int getStatus() { return status;}
|
||||
|
||||
BSData(){};
|
||||
};
|
||||
|
||||
|
||||
class RFData{
|
||||
friend class CAFE;
|
||||
private:
|
||||
std::vector<BSData> phase;
|
||||
std::vector<BSData> amplitude;
|
||||
|
||||
|
||||
std::vector<std::string> pv;
|
||||
std::vector<unsigned int> handle;
|
||||
std::vector<std::string> device;
|
||||
std::vector<float> s;
|
||||
|
||||
size_t nDevice;
|
||||
size_t nPV;
|
||||
}
|
||||
*/
|
||||
|
||||
class DBPMData{
|
||||
friend class CAFE;
|
||||
private:
|
||||
double val;
|
||||
epicsTimeStamp ets;
|
||||
int status;
|
||||
public:
|
||||
double getValue() {return val;}
|
||||
epicsTimeStamp getEpicsTimeStamp() {return ets;}
|
||||
int getStatus() { return status;}
|
||||
|
||||
DBPMData(){
|
||||
//status=ECAFE_BPM_DATA_IS_INVALID;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class DBPMKeeper
|
||||
{
|
||||
friend class CAFE;
|
||||
private:
|
||||
std::vector<DBPMData> x;
|
||||
std::vector<DBPMData> y;
|
||||
std::vector<DBPMData> q;
|
||||
std::vector<DBPMData> energy;
|
||||
|
||||
std::vector<double> offs_x;
|
||||
std::vector<double> offs_y;
|
||||
|
||||
bool isAllXOK;
|
||||
bool isAllYOK;
|
||||
bool isAllQOK;
|
||||
bool isAllEOK;
|
||||
bool isAllOK;
|
||||
|
||||
std::vector<std::string> pv;
|
||||
std::vector<unsigned int> handle;
|
||||
std::vector<std::string> device;
|
||||
std::vector<float> s;
|
||||
|
||||
size_t nDBPM;
|
||||
size_t nPV;
|
||||
|
||||
|
||||
|
||||
bool isBS;
|
||||
bool BSInitialized;
|
||||
void *context;
|
||||
|
||||
void *receiver;
|
||||
int rc;
|
||||
#if HAVE_JSON
|
||||
Json::Value parsedFromString;
|
||||
Json::Reader reader;
|
||||
bool parsingSuccessful;
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
|
||||
std::vector<DBPMData> getX() { return x;}
|
||||
std::vector<DBPMData> getY() { return y;}
|
||||
std::vector<DBPMData> getQ() { return q;}
|
||||
std::vector<DBPMData> getEnergy() { return energy;}
|
||||
|
||||
|
||||
std::vector<double> getOffsetX() { return offs_x;}
|
||||
std::vector<double> getOffsetY() { return offs_y;}
|
||||
|
||||
bool getIsAllXOK() {return isAllXOK;}
|
||||
bool getIsAllYOK() {return isAllYOK;}
|
||||
bool getIsAllQOK() {return isAllQOK;}
|
||||
bool getIsAllEOK() {return isAllEOK;}
|
||||
bool getIsAllOK() {return isAllOK;}
|
||||
|
||||
std::vector<std::string> getPV(){ return pv;}
|
||||
std::vector<unsigned int> getHandle() { return handle;}
|
||||
std::vector<std::string> getDevice() { return device;}
|
||||
std::vector<float> getS() { return s;}
|
||||
size_t getNDBPM() {return nDBPM;}
|
||||
size_t getNPV() {return nPV;}
|
||||
int getStatus() {return status;}
|
||||
|
||||
|
||||
int getPVIdx(string _pv) {
|
||||
|
||||
for (size_t i=0; i< pv.size(); ++i) {
|
||||
|
||||
if ( pv[i].compare(_pv) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
PVDataHolder * pvd;
|
||||
int status;
|
||||
|
||||
size_t xIdx;
|
||||
size_t yIdx;
|
||||
size_t qIdx;
|
||||
size_t xValidIdx;
|
||||
size_t yValidIdx;
|
||||
size_t qValidIdx;
|
||||
size_t energyIdx;
|
||||
size_t endIdx;
|
||||
|
||||
void *subscriber;
|
||||
|
||||
//struct MemoryStruct {
|
||||
// char *memory;
|
||||
// size_t size;
|
||||
//};
|
||||
|
||||
static size_t RecvResponseCallback(char * contents, size_t size, size_t nmemb, void * up) {
|
||||
|
||||
++nCBs;
|
||||
cout << "Callback called: " << nCBs << endl;
|
||||
|
||||
///Json::Value parsedFromString;
|
||||
///Json::Reader reader;
|
||||
///bool parsingSuccessful;
|
||||
|
||||
///Json::FastWriter fastWriter;
|
||||
|
||||
cout << "SIZE No. of Bytes " << size*nmemb << endl;
|
||||
|
||||
string sLocal=contents;
|
||||
|
||||
std::size_t found = sLocal.find('\n');
|
||||
|
||||
if (found != std::string::npos) {
|
||||
|
||||
sLocal=sLocal.substr(0, found);
|
||||
}
|
||||
|
||||
contentsS=contentsS+sLocal;
|
||||
|
||||
|
||||
|
||||
//if (nCBs%3==1) {
|
||||
// return size*nmemb;
|
||||
//}
|
||||
|
||||
|
||||
//printf("value= %s\n", contents);
|
||||
/*
|
||||
if (contents != NULL) {
|
||||
parsingSuccessful=reader.parse(contentsS.c_str(), parsedFromString);
|
||||
if (parsingSuccessful) {
|
||||
//Json::StyledWriter styledWriter;
|
||||
cout << "STYLED: --------------------------------" << endl;
|
||||
//cout << styledWriter.write(parsedFromString) << endl;
|
||||
//cout << "----------------------------------" << endl;
|
||||
cout << parsedFromString["stream"] << endl;
|
||||
|
||||
cout << "----------------------------------" << endl;
|
||||
globalZmqStream = fastWriter.write(parsedFromString["stream"]).c_str();
|
||||
cout << globalZmqStream << endl;
|
||||
|
||||
if ( parsedFromString["stream"].isNull() ) {
|
||||
globalZmqStream.clear();
|
||||
}
|
||||
}
|
||||
else {
|
||||
cout << "PARSING IN CURL CALLBACK FUNCTION WAS UNSUCCESSFUL !!!" << endl;
|
||||
|
||||
cout << reader.getFormattedErrorMessages() << endl;
|
||||
}
|
||||
}
|
||||
contentsS="";
|
||||
*/
|
||||
|
||||
/*
|
||||
size_t realsize = size * nmemb;
|
||||
struct MemoryStruct *mem = (struct MemoryStruct *)data;
|
||||
|
||||
mem->memory = (char *) realloc(mem->memory, (mem->size + realsize + 1));
|
||||
|
||||
if(mem->memory == NULL) {
|
||||
|
||||
printf("not enough memory (realloc returned NULL)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(&(mem->memory[mem->size]), contents, realsize);
|
||||
mem->size += realsize;
|
||||
mem->memory[mem->size] = 0;
|
||||
|
||||
//return realsize;
|
||||
|
||||
printf("value= %s\n",mem->memory);
|
||||
if (mem->memory != NULL) {
|
||||
parsingSuccessful=reader.parse(mem->memory, parsedFromString);
|
||||
if (parsingSuccessful) {
|
||||
Json::StyledWriter styledWriter;
|
||||
cout << "STYLED: --------------------------------" << endl;
|
||||
cout << styledWriter.write(parsedFromString) << endl;
|
||||
cout << "----------------------------------" << endl;
|
||||
cout << parsedFromString["stream"] << endl;
|
||||
|
||||
cout << "----------------------------------" << endl;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return (size_t) size * nmemb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
bool resetBS() {
|
||||
closeBS();
|
||||
return setBS(true);
|
||||
}
|
||||
|
||||
|
||||
bool setBS(bool BSFlag) {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
|
||||
|
||||
if (BSFlag) {
|
||||
#if HAVE_CURL
|
||||
/*
|
||||
//Complete all or complete latest
|
||||
//const char * data="{\"channels\":[{\"name\":\"S10BC01-DBPM010:X1\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0}, \
|
||||
{\"name\":\"S10BC01-DBPM010:X1-VALID\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0} \
|
||||
],\"mapping\":{\"incomplete\":\"fill-null\"},\"channelValidation\":{\"inconsistency\":\"adjust-global\"},\"sendBehaviour\":{\"strategy\":\"complete-all\"}}";
|
||||
*/
|
||||
string dataChannels=string("{\"channels\":[");
|
||||
|
||||
vector<string> pvNew=pv;
|
||||
#if HAVE_ZEROMQ
|
||||
if (!BSInitialized) {
|
||||
//pvNew.push_back("SINEG01-DBPM340:X1") ;
|
||||
//pvNew.push_back("SINSB01-DBPM150:X1") ;
|
||||
//pvNew.push_back("SINSB02-DBPM150:X1") ;
|
||||
//pvNew.push_back("SINLH01-DBPM060:X1") ;
|
||||
//pvNew.push_back("SINLH02-DBPM210:X1") ;
|
||||
//pvNew.push_back("SINLH02-DBPM240:X1") ;
|
||||
//pvNew.push_back("SINLH03-DBPM010:X1") ;
|
||||
//pvNew.push_back("SINLH03-DBPM050:X1") ;
|
||||
//pvNew.push_back("SINLH03-DBPM090:X1") ;
|
||||
//pvNew.push_back("SINSB03-DBPM120:X1") ;
|
||||
//pvNew.push_back("SINSB03-DBPM220:X1") ;
|
||||
//pvNew.push_back("SINSB04-DBPM120:X1") ;
|
||||
//pvNew.push_back("SINSB04-DBPM220:X1") ;
|
||||
|
||||
//pvNew.push_back("SINEG01-DBPM340:X1-VALID") ;
|
||||
//pvNew.push_back("SINSB01-DBPM150:X1-VALID") ;
|
||||
//pvNew.push_back("SINSB02-DBPM150:X1-VALID") ;
|
||||
//pvNew.push_back("SINLH01-DBPM060:X1-VALID") ;
|
||||
//pvNew.push_back("SINLH02-DBPM210:X1-VALID") ;
|
||||
//pvNew.push_back("SINLH02-DBPM240:X1-VALID") ;
|
||||
//pvNew.push_back("SINLH03-DBPM010:X1-VALID") ;
|
||||
//pvNew.push_back("SINLH03-DBPM050:X1-VALID") ;
|
||||
//pvNew.push_back("SINLH03-DBPM090:X1-VALID") ;
|
||||
//pvNew.push_back("SINSB03-DBPM120:X1-VALID") ;
|
||||
//pvNew.push_back("SINSB03-DBPM220:X1-VALID") ;
|
||||
//pvNew.push_back("SINSB04-DBPM120:X1-VALID") ;
|
||||
//pvNew.push_back("SINSB04-DBPM220:X1-VALID") ;
|
||||
size_t found;
|
||||
dataChannels= dataChannels + string("{\"name\":\"");
|
||||
dataChannels= dataChannels + pvNew[0];
|
||||
//dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\"}" );
|
||||
dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0}" );
|
||||
|
||||
|
||||
for (size_t i=1; i < pvNew.size(); ++i) {
|
||||
|
||||
|
||||
found = pvNew[i].find("SARUN08-DBPM210");
|
||||
if (found != std::string::npos) continue;
|
||||
found = pvNew[i].find("SARUN08-DBPM410");
|
||||
if (found != std::string::npos) continue;
|
||||
//found = pvNew[i].find("Y1");
|
||||
//if (found != std::string::npos) continue;
|
||||
//found = pvNew[i].find("X1");
|
||||
//if (found != std::string::npos) continue;
|
||||
found = pvNew[i].find("ENERGY");
|
||||
if (found != std::string::npos) continue;
|
||||
|
||||
|
||||
dataChannels= dataChannels + string(",{\"name\":\"");
|
||||
dataChannels= dataChannels + pvNew[i];
|
||||
|
||||
//found = pv[i+1].find("ENERGY");
|
||||
//if (found != std::string::npos) break;
|
||||
//dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\"}");
|
||||
dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0}");
|
||||
|
||||
}
|
||||
//dataChannels= dataChannels + string("{\"name\":\"");
|
||||
//dataChannels= dataChannels + pv[pv.size()-1];
|
||||
//dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\"}],");
|
||||
dataChannels= dataChannels + string("],");
|
||||
dataChannels= dataChannels + "\"mapping\":{\"incomplete\":\"fill-null\"},\"channelValidation\":{\"inconsistency\":\"keep-as-is\"},\"sendBehaviour\":{\"strategy\":\"complete-all\"}}";
|
||||
|
||||
cout << dataChannels << endl;
|
||||
|
||||
//sleep(1);
|
||||
const char * data = dataChannels.c_str();
|
||||
|
||||
|
||||
|
||||
///cout << "SIZE OF DATA --------------->" << sizeof(data) << endl;
|
||||
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
struct curl_slist * slist;
|
||||
slist = NULL;
|
||||
|
||||
slist = curl_slist_append(slist, "Content-Type: application/json");
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
|
||||
curl = curl_easy_init();
|
||||
|
||||
|
||||
|
||||
if (curl) {
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://dispatcher-api.psi.ch/sf/stream");
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); //"-F file=@./request.json"); //data); //
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
|
||||
cout << "WAITING FOR CALLBACK " << endl;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &RecvResponseCallback);
|
||||
|
||||
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
if (res != CURLE_OK) {
|
||||
cout << "curl_easy_perform failed " << curl_easy_strerror(res) << endl;
|
||||
}
|
||||
else {
|
||||
cout << " CALLBACK DONE" << endl;
|
||||
|
||||
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
curl=NULL;
|
||||
|
||||
curl_slist_free_all(slist);
|
||||
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
slist=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
curl_global_cleanup();
|
||||
|
||||
#endif
|
||||
|
||||
//cout << " //1// SHOW contentS " << endl;
|
||||
//cout << contentsS.c_str() << endl;
|
||||
|
||||
|
||||
//sleep(1);
|
||||
|
||||
Json::Value parsedFromString;
|
||||
Json::Reader reader;
|
||||
bool parsingSuccessful;
|
||||
|
||||
Json::FastWriter fastWriter;
|
||||
|
||||
//printf("value= %s\n", contentsS.c_str());
|
||||
|
||||
|
||||
if (contentsS.size() > 2) {
|
||||
parsingSuccessful=reader.parse(contentsS.c_str(), parsedFromString);
|
||||
if (parsingSuccessful) {
|
||||
//Json::StyledWriter styledWriter;
|
||||
cout << "STYLED: --------------------------------" << endl;
|
||||
//cout << styledWriter.write(parsedFromString) << endl;
|
||||
//cout << "----------------------------------" << endl;
|
||||
cout << parsedFromString["stream"] << endl;
|
||||
|
||||
cout << "----------------------------------" << endl;
|
||||
globalZmqStream = fastWriter.write(parsedFromString["stream"]).c_str();
|
||||
cout << globalZmqStream << endl;
|
||||
|
||||
if ( parsedFromString["stream"].isNull() ) {
|
||||
globalZmqStream.clear();
|
||||
}
|
||||
}
|
||||
else {
|
||||
cout << "PARSING IN CURL CALLBACK FUNCTION WAS UNSUCCESSFUL !!!" << endl;
|
||||
cout << contentsS.c_str() << endl;
|
||||
cout << reader.getFormattedErrorMessages() << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
//#if HAVE_ZEROMQ
|
||||
//if (!BSInitialized) {
|
||||
|
||||
|
||||
cout << "TESTING STREAM... " << endl;
|
||||
|
||||
|
||||
if (globalZmqStream.empty()) {
|
||||
cout << "BS Data is not available " << endl;
|
||||
return isBS=false;
|
||||
}
|
||||
// else {
|
||||
// cout << globalZmqStream.c_str() << " is not empty " << endl;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
context = zmq_ctx_new ();
|
||||
|
||||
/// receiver = zmq_socket (context, ZMQ_PULL);
|
||||
//HWM has no effect for PULL
|
||||
//See documentation on zmq-socket
|
||||
//WHEN PUSH Sender reachers HWM, then it blocks
|
||||
/// int nhwm=10;
|
||||
/// zmq_setsockopt (receiver,ZMQ_RCVHWM ,&nhwm, sizeof(int));
|
||||
//rc = zmq_bind (receiver, "tcp://129.129.145.206:5558"); //ZMQ_PULL
|
||||
/// rc = zmq_bind (receiver, "tcp://SIN-CVME-DBPM0421:9000");
|
||||
/// assert (rc == 0);
|
||||
|
||||
|
||||
subscriber = zmq_socket (context, ZMQ_SUB);
|
||||
//rc = zmq_connect (subscriber, "tcp://129.129.145.206:5556");
|
||||
//rc = zmq_connect (subscriber, "tcp://SIN-CVME-DBPM0421:9000");
|
||||
|
||||
|
||||
|
||||
globalZmqStream=globalZmqStream.substr(1,globalZmqStream.size()-3);
|
||||
//cout << " globalZmqStream.c_str() " << globalZmqStream.c_str() << endl;
|
||||
//sleep(1);
|
||||
|
||||
|
||||
|
||||
rc = zmq_connect (subscriber, (const char *) globalZmqStream.c_str()); // "tcp://sf-daqbuf-28.psi.ch:42465"); // //"tcp://sf-daqbuf-30.psi.ch:39927");
|
||||
|
||||
if (rc != 0 ) {
|
||||
cout << " Error is " << zmq_errno() << " " << zmq_strerror(zmq_errno()) << endl;
|
||||
}
|
||||
|
||||
//rc = zmq_connect (subscriber, "tcp://*:9999");
|
||||
assert (rc == 0);
|
||||
|
||||
int nhwm=1;
|
||||
int timeoutMS=400; //10; //-1 Wait for Ever
|
||||
|
||||
rc=zmq_setsockopt (subscriber,ZMQ_RCVHWM ,&nhwm, sizeof(int));
|
||||
assert (rc == 0);
|
||||
|
||||
rc=zmq_setsockopt (subscriber,ZMQ_RCVTIMEO ,&timeoutMS, sizeof(int));
|
||||
assert (rc == 0);
|
||||
|
||||
rc=zmq_setsockopt (subscriber,ZMQ_SUBSCRIBE,"",0);
|
||||
assert (rc == 0);
|
||||
|
||||
BSInitialized=true;
|
||||
}
|
||||
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
return isBS=BSFlag;
|
||||
#else
|
||||
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
return isBS=false;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
return isBS=BSFlag;
|
||||
}
|
||||
|
||||
bool setCA(bool CAFlag) {
|
||||
return CAFlag;
|
||||
}
|
||||
|
||||
void closeBS() {
|
||||
if (BSInitialized && isBS) {
|
||||
#if HAVE_ZEROMQ
|
||||
zmq_close (subscriber);
|
||||
zmq_ctx_destroy (context);
|
||||
#endif
|
||||
}
|
||||
BSInitialized=false;
|
||||
isBS=false;
|
||||
}
|
||||
|
||||
bool getIsBS() { return isBS;}
|
||||
|
||||
|
||||
DBPMKeeper() {};
|
||||
|
||||
DBPMKeeper(std::vector<string> _pv, std::vector<unsigned int> _handle, std::map<float, std::string> posDev):isBS(false),BSInitialized(false)
|
||||
{
|
||||
|
||||
pv.assign (_pv.begin(), _pv.end());
|
||||
handle.assign(_handle.begin(),_handle.end());
|
||||
|
||||
|
||||
//fMap posDev;
|
||||
std::map<float, std::string>::iterator pos;
|
||||
for (pos =posDev.begin(); pos != posDev.end(); ++pos) {
|
||||
s.push_back(pos->first); device.push_back(pos->second);
|
||||
}
|
||||
|
||||
pvd = new PVDataHolder[handle.size()];
|
||||
|
||||
//for (int i=0; i< handle.size(); ++i) {
|
||||
// pvd[i].setNelem(1);
|
||||
//}
|
||||
|
||||
nDBPM=device.size();
|
||||
nPV=_pv.size();
|
||||
status=ICAFE_NORMAL;
|
||||
|
||||
xIdx = 0;
|
||||
yIdx = nDBPM;
|
||||
qIdx =2*nDBPM;
|
||||
xValidIdx=3*nDBPM;
|
||||
yValidIdx=4*nDBPM;
|
||||
qValidIdx=5*nDBPM;
|
||||
energyIdx=6*nDBPM;
|
||||
endIdx =7*nDBPM;
|
||||
}
|
||||
|
||||
|
||||
DBPMKeeper(std::vector<string> _pv, std::vector<unsigned int> _handle, std::vector<std::string> _dev, std::vector<float> _pos):isBS(false),BSInitialized(false)
|
||||
{
|
||||
|
||||
pv.assign (_pv.begin(), _pv.end());
|
||||
handle.assign(_handle.begin(),_handle.end());
|
||||
|
||||
device.assign(_dev.begin(), _dev.end());
|
||||
s.assign(_pos.begin(), _pos.end());
|
||||
|
||||
pvd = new PVDataHolder[handle.size()];
|
||||
|
||||
//for (int i=0; i< handle.size(); ++i) {
|
||||
// pvd[i].setNelem(1);
|
||||
//}
|
||||
|
||||
nDBPM=device.size();
|
||||
nPV=_pv.size();
|
||||
status=ICAFE_NORMAL;
|
||||
|
||||
xIdx = 0;
|
||||
yIdx = nDBPM;
|
||||
qIdx =2*nDBPM;
|
||||
xValidIdx=3*nDBPM;
|
||||
yValidIdx=4*nDBPM;
|
||||
qValidIdx=5*nDBPM;
|
||||
energyIdx=6*nDBPM;
|
||||
endIdx =7*nDBPM;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //CAFE_SERVICE_H
|
||||
298
include/cafeVectors.h
Normal file
298
include/cafeVectors.h
Normal file
@@ -0,0 +1,298 @@
|
||||
///
|
||||
/// \file cafeVectors.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFEVECTORS_H
|
||||
#define CAFEVECTORS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
int get(const unsigned int _handle, vector<string> & V); //0
|
||||
int get(const unsigned int _handle, vector<short> & V); //1
|
||||
int get(const unsigned int _handle, vector<float> & V); //2
|
||||
int get(const unsigned int _handle, vector<unsigned short> & V); //3
|
||||
int get(const unsigned int _handle, vector<unsigned char> & V); //4
|
||||
int get(const unsigned int _handle, vector<dbr_long_t> & V); //5
|
||||
int get(const unsigned int _handle, vector<long long> & V); //5
|
||||
int get(const unsigned int _handle, vector<double> & V); //6
|
||||
int get(const unsigned int _handle, vector<string> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//0
|
||||
int get(const unsigned int _handle, vector<short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//1
|
||||
int get(const unsigned int _handle, vector<float> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//2
|
||||
int get(const unsigned int _handle, vector<unsigned short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//3
|
||||
int get(const unsigned int _handle, vector<unsigned char> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//4
|
||||
int get(const unsigned int _handle, vector<dbr_long_t> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
|
||||
int get(const unsigned int _handle, vector<long long> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
|
||||
int get(const unsigned int _handle, vector<double> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//6
|
||||
int get(const unsigned int _handle, vector<string> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//0
|
||||
int get(const unsigned int _handle, vector<short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//1
|
||||
int get(const unsigned int _handle, vector<float> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//2
|
||||
int get(const unsigned int _handle, vector<unsigned short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//3
|
||||
int get(const unsigned int _handle, vector<unsigned char> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//4
|
||||
int get(const unsigned int _handle, vector<dbr_long_t> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
|
||||
int get(const unsigned int _handle, vector<long long> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
|
||||
int get(const unsigned int _handle, vector<double> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//
|
||||
|
||||
int getCache(const unsigned int _handle, vector<string> & V); //0
|
||||
int getCache(const unsigned int _handle, vector<short> & V); //1
|
||||
int getCache(const unsigned int _handle, vector<float> & V); //2
|
||||
int getCache(const unsigned int _handle, vector<unsigned short> & V);//3
|
||||
int getCache(const unsigned int _handle, vector<unsigned char> & V);//4
|
||||
int getCache(const unsigned int _handle, vector<dbr_long_t> & V); //5
|
||||
int getCache(const unsigned int _handle, vector<long long> & V); //5
|
||||
int getCache(const unsigned int _handle, vector<double> & V); //6
|
||||
int getCache(const unsigned int _handle, vector<string> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//0
|
||||
int getCache(const unsigned int _handle, vector<short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//1
|
||||
int getCache(const unsigned int _handle, vector<float> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//2
|
||||
int getCache(const unsigned int _handle, vector<unsigned short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//3
|
||||
int getCache(const unsigned int _handle, vector<unsigned char> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//4
|
||||
int getCache(const unsigned int _handle, vector<dbr_long_t> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
|
||||
int getCache(const unsigned int _handle, vector<long long> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
|
||||
int getCache(const unsigned int _handle, vector<double> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//6
|
||||
|
||||
|
||||
int getCache(const unsigned int _handle, vector<string> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//0
|
||||
int getCache(const unsigned int _handle, vector<short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//1
|
||||
int getCache(const unsigned int _handle, vector<float> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//2
|
||||
int getCache(const unsigned int _handle, vector<unsigned short> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//3
|
||||
int getCache(const unsigned int _handle, vector<unsigned char> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//4
|
||||
int getCache(const unsigned int _handle, vector<dbr_long_t> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
|
||||
int getCache(const unsigned int _handle, vector<long long> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
|
||||
int getCache(const unsigned int _handle, vector<double> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//6
|
||||
|
||||
|
||||
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!
|
||||
return status;}
|
||||
|
||||
int getScalars(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV){ //0
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
return CAFE::getCache(handleV, V, statusV);
|
||||
}
|
||||
int getScalars(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV){ //1
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
return CAFE::getCache(handleV, V, statusV);
|
||||
}
|
||||
int getScalars(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV){ //2
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
return CAFE::getCache(handleV, V, statusV);
|
||||
}
|
||||
int getScalars(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV){ //3
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
return CAFE::getCache(handleV, V, statusV);
|
||||
}
|
||||
int getScalars(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV){ //4
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
return CAFE::getCache(handleV, V, statusV);
|
||||
}
|
||||
int getScalars(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV){ //5
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
return CAFE::getCache(handleV, V, statusV);
|
||||
}
|
||||
int getScalars(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV) { //5
|
||||
CAFE::get(handleV, statusV);
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
return CAFE::getCache(handleV, V, statusV);
|
||||
}
|
||||
int getScalars(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV) { //6
|
||||
CAFE::get(handleV, statusV);
|
||||
//for (size_t i=0; i< handleV.size(); ++i) { cout << "/Asyn/h=" << handleV[i] << "s=" << statusV[i] << " [" << i << "] " << endl;}
|
||||
CAFE::waitForBundledEvents(handleV, statusV);
|
||||
//for (size_t i=0; i< handleV.size(); ++i) { cout << "/Wait/h=" << handleV[i] << "s=" << statusV[i] << " [" << i << "] " << endl;}
|
||||
status=CAFE::getCache(handleV, V, statusV);
|
||||
//for (size_t i=0; i< handleV.size(); ++i) { cout << "/Cach/h=" << handleV[i] << "s=" << statusV[i] << " [" << i << "] " << endl;}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int getCacheVStr(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV){
|
||||
return getCache(handleV, V, statusV);}
|
||||
int getCacheVLong(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV){
|
||||
return getCache(handleV, V, statusV);}
|
||||
int getCacheVDouble(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV){
|
||||
return getCache(handleV, V, statusV);}
|
||||
|
||||
|
||||
int getCache(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV); //0
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV); //1
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV); //2
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV); //3
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV); //4
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV); //5
|
||||
int getCache(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV); //5
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV); //6
|
||||
|
||||
int getCache(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //0
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //1
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //2
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //3
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //4
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //5
|
||||
int getCache(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //5
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //6
|
||||
|
||||
//0
|
||||
int getCache(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
//1
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
//2
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
//3
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
//4
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
//5
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
int getCache(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
//6
|
||||
int getCache(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV,
|
||||
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
|
||||
vector<epicsTimeStamp> &tsV);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int set(const unsigned int handle, vector<string> V); //0
|
||||
int set(const unsigned int handle, vector<dbr_short_t> V); //1
|
||||
int set(const unsigned int handle, vector<dbr_float_t> V); //2
|
||||
int set(const unsigned int handle, vector<dbr_enum_t> V);//3
|
||||
int set(const unsigned int handle, vector<dbr_char_t> V);//4
|
||||
int set(const unsigned int handle, vector<dbr_long_t> V); //5
|
||||
int set(const unsigned int handle, vector<long long> V); //5+
|
||||
int set(const unsigned int handle, vector<dbr_double_t> V); //6
|
||||
|
||||
int set(vector<unsigned int> handleV, vector<string> V, vector<int> &statusV); //0
|
||||
int set(vector<unsigned int> handleV, vector<dbr_short_t> V, vector<int> &statusV); //1
|
||||
int set(vector<unsigned int> handleV, vector<dbr_float_t> V, vector<int> &statusV); //2
|
||||
int set(vector<unsigned int> handleV, vector<dbr_enum_t> V, vector<int> &statusV); //3
|
||||
int set(vector<unsigned int> handleV, vector<dbr_char_t> V, vector<int> &statusV); //4
|
||||
int set(vector<unsigned int> handleV, vector<dbr_long_t> V, vector<int> &statusV); //5
|
||||
int set(vector<unsigned int> handleV, vector<long long> V, vector<int> &statusV); //5+
|
||||
int set(vector<unsigned int> handleV, vector<dbr_double_t> V, vector<int> &statusV); //6
|
||||
|
||||
|
||||
|
||||
int get (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
|
||||
return get(&handleV[0], (unsigned int) handleV.size(), pvd);
|
||||
|
||||
};
|
||||
|
||||
|
||||
int getCache (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
|
||||
return getCache(&handleV[0], (unsigned int) handleV.size(), pvd);
|
||||
};
|
||||
|
||||
|
||||
int getPVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
//unsigned int * handleArray = new unsigned int [handleV.size()];
|
||||
//for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
|
||||
//status=get(handleArray, (unsigned int) handleV.size(), pvd);
|
||||
//delete [] handleArray; return status;
|
||||
return get(&handleV[0], (unsigned int) handleV.size(), pvd);
|
||||
};
|
||||
|
||||
/*
|
||||
int getPVArrayCache (vector<unsigned int> handleV, PVDataHolder * pvd){
|
||||
//unsigned int * handleArray = new unsigned int [handleV.size()];
|
||||
//for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
|
||||
//status=getCache(handleArray, (unsigned int) handleV.size(), pvd);
|
||||
//delete [] handleArray; return status;
|
||||
return getCache(&handleV[0], (unsigned int) handleV.size(), pvd);
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
//setPVArray is in cafeVectors.h and .cc
|
||||
//For Cython
|
||||
int setPVArray(vector<unsigned int> handleV, PVDataHolder * pvd);
|
||||
|
||||
int setVVString(vector<unsigned int> handleV, vector<string> V, vector<int> &statusV) {
|
||||
return set(handleV, V, statusV);};
|
||||
int setVVChar(vector<unsigned int> handleV, vector<dbr_char_t> V, vector<int> &statusV){
|
||||
return set(handleV, V, statusV);};
|
||||
int setVVLong(vector<unsigned int> handleV, vector<dbr_long_t> V, vector<int> &statusV){
|
||||
return set(handleV, V, statusV);};
|
||||
int setVVDouble(vector<unsigned int> handleV, vector<dbr_double_t> V, vector<int> &statusV){
|
||||
return set(handleV, V, statusV);};
|
||||
|
||||
int setVString(const unsigned int handle, vector<string> V) {return set(handle, V);};
|
||||
|
||||
int setVChar (const unsigned int handle, vector<dbr_char_t> V) {return set(handle, V);};
|
||||
int setVLong (const unsigned int handle, vector<dbr_long_t> V) {return set(handle, V);};
|
||||
int setVShort (const unsigned int handle, vector<dbr_short_t> V) {return set(handle, V);};
|
||||
int setVUShort(const unsigned int handle, vector<dbr_enum_t> V) {return set(handle, V);};
|
||||
int setVFloat (const unsigned int handle, vector<dbr_float_t> V) {return set(handle, V);};
|
||||
int setVDouble(const unsigned int handle, vector<dbr_double_t> V) {return set(handle, V);};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // CAFEVECTORS_H
|
||||
24
include/cafeXML.h
Normal file
24
include/cafeXML.h
Normal file
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// \file cafeXML.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAFEXML_H
|
||||
#define CAFEXML_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
int loadCollectionsFromXML(const char * collectionsFile);
|
||||
int loadGroupsFromXML (const char * groupsFile);
|
||||
int restoreFromXML(const char * snapshotFile);
|
||||
#endif
|
||||
|
||||
int snapshot2XML (PVGroup pg);
|
||||
void openGroupXMLFile(string fileName);
|
||||
void closeGroupXMLFile(string fileName);
|
||||
int group2XML (const char * grpName, string fileName);
|
||||
|
||||
#endif // CAFEXML_H
|
||||
67
include/caopCodes.h
Normal file
67
include/caopCodes.h
Normal file
@@ -0,0 +1,67 @@
|
||||
///
|
||||
/// \file caopCodes.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: April 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CAOPCODES_H
|
||||
#define CAOPCODES_H
|
||||
|
||||
#include <cadef.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
* Provides methods to convert between
|
||||
* the CA_OP_xx and text equivalent
|
||||
*/
|
||||
class CAOPCodes {
|
||||
typedef std::map<int, std::string> mapIntString;
|
||||
private:
|
||||
mapIntString mapDataType;
|
||||
mapIntString::iterator pos;
|
||||
public:
|
||||
CAOPCodes() {
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_GET, "CA_OP_GET" ));
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_PUT, "CA_OP_PUT" ));
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_CREATE_CHANNEL, "CA_OP_CREATE_CHANNEL" ));
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_ADD_EVENT, "CA_OP_ADD_EVENT" ));
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_CLEAR_EVENT, "CA_OP_CLEAR_EVENT" ));
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_OTHER, "CA_OP_OTHER" ));
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_CONN_UP, "CA_OP_CONN_UP" ));
|
||||
mapDataType.insert(std::make_pair((int) CA_OP_CONN_DOWN, "CA_OP_CONN_DOWN" ));
|
||||
};
|
||||
|
||||
~CAOPCodes() {};
|
||||
|
||||
std::string message (int i) {
|
||||
|
||||
pos = mapDataType.find(i);
|
||||
if (pos != mapDataType.end()) return pos->second;
|
||||
return "CAFE_DATATYPE_UNKNOWN";
|
||||
};
|
||||
|
||||
int enumIs (std::string message) {
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
|
||||
if (pos->second==message) return pos->first;
|
||||
return -1;
|
||||
};
|
||||
|
||||
void show() {print();}
|
||||
|
||||
void print ( ) {
|
||||
std::cout << "------------------" << std::endl;
|
||||
std::cout << "CA_OP_LIST" << std::endl;
|
||||
std::cout << "-----------------" << std::endl;
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "-----------------" << std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
316
include/channelRegalia.h
Normal file
316
include/channelRegalia.h
Normal file
@@ -0,0 +1,316 @@
|
||||
///
|
||||
/// \file channelRegalia.h
|
||||
///
|
||||
/// Classes are:
|
||||
/// ChannelRegalia
|
||||
/// ChannelRequestMetaData
|
||||
/// ChannelRequestMetaDataClient
|
||||
/// ChannelRequestMetaDataRepository
|
||||
/// ChannelRequestStatus
|
||||
///
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CHANNELINFO_H
|
||||
#define CHANNELINFO_H
|
||||
|
||||
#include <cstring>
|
||||
#include <statusCodes.h>
|
||||
#include <defines.h>
|
||||
#include <cafeEnum.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Struct defining channel properties and connection status for use in Conduit container
|
||||
*
|
||||
*/
|
||||
class ChannelRegalia{
|
||||
private:
|
||||
CAFEStatus cafeStatus;
|
||||
public:
|
||||
friend struct change_accessRightsHandlerArgs;
|
||||
friend struct change_accessRead;
|
||||
friend struct change_accessWrite;
|
||||
friend struct change_channelID;
|
||||
friend struct change_connectionHandlerArgs;
|
||||
friend struct change_eventHandlerArgs;
|
||||
//friend struct change_channelRegalia;
|
||||
//friend class Connect;
|
||||
friend class HandleHelper;
|
||||
friend class Conduit;
|
||||
friend class ConduitGroup;
|
||||
protected:
|
||||
chid channelID; //
|
||||
bool connectFlag;
|
||||
const char * hostName;
|
||||
unsigned int nelem; //native
|
||||
chtype dataType; //native
|
||||
unsigned short accessRead; //0 or 1
|
||||
unsigned short accessWrite; //0 or 1
|
||||
dbr_class_name_t className; //dbr_string_t
|
||||
//connectionState as given by connection_handler args: CA_OP_CONN_UP or CA_OP_CONN_DOWN
|
||||
int connectionState; //as given by CA_OP_
|
||||
int cafeConnectionState; //as given by cafe_cs_state in statusCodes
|
||||
|
||||
//void setChannelID (chid id) {channelID=id;};
|
||||
void setConnectFlag (bool c) {connectFlag=c;};
|
||||
void setHostName (const char * h) {hostName=h;};
|
||||
void setDataType (chtype d) {dataType=d;};
|
||||
void setAccessRead (unsigned short r){accessRead=r;};
|
||||
void setAccessWrite(unsigned short w){accessWrite=w;};
|
||||
void setReadAccess (unsigned short r){accessRead=r;};
|
||||
void setWriteAccess(unsigned short w){accessWrite=w;};
|
||||
void setNelem (unsigned int n) {nelem=n;};
|
||||
void setConnectionState (long cs) {connectionState=cs;};
|
||||
void setCafeConnectionState (long ccs) {cafeConnectionState=ccs;};
|
||||
|
||||
public:
|
||||
chid getChannelID() const {return channelID;};
|
||||
bool getConnectFlag()const {return connectFlag;};
|
||||
const char * getHostName() const {return hostName;};
|
||||
string getHostNameAsString() {string h= hostName; return h;};
|
||||
chtype getDataType() const {return dataType;};
|
||||
const char * getClassName() const {return className;};
|
||||
string getClassNameAsString() {string c=className; return c;};
|
||||
unsigned short getAccessRead() const {return accessRead;};
|
||||
unsigned short getAccessWrite()const {return accessWrite;};
|
||||
unsigned short getReadAccess() const {return accessRead;};
|
||||
unsigned short getWriteAccess()const {return accessWrite;};
|
||||
unsigned int getNelem() const {return nelem;};
|
||||
int getConnectionState() const {return connectionState;};
|
||||
int getCafeConnectionState() const {return cafeConnectionState;};
|
||||
string getConnectionStateAsString() {
|
||||
if(connectionState==CA_OP_CONN_UP){return "CA_OP_CONN_UP";}
|
||||
else if(connectionState==CA_OP_CONN_DOWN){return "CA_OP_CONN_DOWN"; }
|
||||
else {return "CA_OP_CONN is UNKNOWN: THIS SHOULD NEVER APPEAR!";}};
|
||||
|
||||
string getCafeConnectionStateAsString() {
|
||||
return cafeStatus.csc.message(cafeConnectionState);};
|
||||
|
||||
ChannelRegalia():channelID((chid) NULL), connectFlag(false), nelem((unsigned int) 1),
|
||||
dataType((chtype) CAFE_TYPENOTCONN),
|
||||
accessRead((unsigned short) 0), accessWrite((unsigned short) 0),
|
||||
connectionState((int) CA_OP_CONN_DOWN), cafeConnectionState((int) ICAFE_CS_NEVER_CONN)
|
||||
{strcpy(className, ""); hostName="";};
|
||||
|
||||
~ChannelRegalia(){};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Stores strings for Enum datatypes
|
||||
*
|
||||
*/
|
||||
class ChannelEnumStrings{
|
||||
public:
|
||||
friend struct change_eventHandlerArgs;
|
||||
private:
|
||||
char options [MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];
|
||||
short noOptions;
|
||||
public:
|
||||
ChannelEnumStrings():noOptions( (short) 0){};
|
||||
short getNoOptions() const {return noOptions;};
|
||||
char getOptions() const {return options[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Stores device/attribute pairing
|
||||
*
|
||||
*/
|
||||
class ChannelDeviceAttribute{
|
||||
private:
|
||||
std::string pv;
|
||||
std::string device;
|
||||
std::string attribute;
|
||||
std::string deliminator;
|
||||
public:
|
||||
ChannelDeviceAttribute(){};
|
||||
~ChannelDeviceAttribute(){};
|
||||
|
||||
int init(std::string _pv, std::string _deliminator)
|
||||
{
|
||||
pv=_pv;
|
||||
deliminator=_deliminator;
|
||||
short posOfSeparator=pv.find_first_of(deliminator);
|
||||
if (posOfSeparator<0){
|
||||
device="";
|
||||
attribute="";
|
||||
return ECAFE_DEVICE_ATTRIB_NOT_FOUND;
|
||||
}
|
||||
else {
|
||||
device= pv.substr(0,posOfSeparator);
|
||||
attribute=pv.substr(posOfSeparator+1,pv.size());
|
||||
}
|
||||
return ICAFE_NORMAL;
|
||||
};
|
||||
|
||||
const char * getDeliminator() const {return deliminator.c_str();};
|
||||
const char * getDevice() const {return device.c_str();};
|
||||
const char * getAttribute() const {return attribute.c_str();};
|
||||
const char * getAttrib() const {return attribute.c_str();};
|
||||
std::string getDeliminatorAsString() const {return deliminator;};
|
||||
std::string getDeviceAsString() const {return device;};
|
||||
std::string getAttributeAsString() const {return attribute;};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 0. Struct defining channel datatype/nelem executed by CAFE for use in Conduit container
|
||||
*
|
||||
*/
|
||||
class ChannelRequestMetaData{
|
||||
public:
|
||||
friend struct change_connectionHandlerArgs;
|
||||
friend struct change_dataBufferSize_CTRL;
|
||||
friend struct change_dataBufferSize_TIME;
|
||||
friend struct change_dataBufferSize_PRIMITIVE;
|
||||
friend struct change_dataBufferSize_STSACK;
|
||||
friend struct change_eventHandlerArgs;
|
||||
|
||||
friend struct copy_channelRequestMetaDataToChannelRequestMetaDataRepository;
|
||||
|
||||
friend class Conduit;
|
||||
friend class ConduitGroup;
|
||||
|
||||
protected:
|
||||
chid channelID; //of requested item
|
||||
unsigned int nelem; //depends on Policy
|
||||
unsigned int nelemCache; //nelem To Retrieve From Cache
|
||||
chtype dataType; //depends on Policy
|
||||
chtype dbrDataType; //depends on Policy
|
||||
CAFENUM::DBR_TYPE cafeDbrType;
|
||||
void * usrArg; //from Conduit.usrArg
|
||||
unsigned int byteSize; //data buffer (bytes) must be large enough to store data
|
||||
unsigned int offset;
|
||||
|
||||
public:
|
||||
void setNelem(unsigned int n){nelem= n > 0 ? n : 1;
|
||||
//nelemCache= nelem > nelemCache ? nelemCache : nelem;
|
||||
}; // byteSize=dbr_size_n(dbrDataType,nelem); };
|
||||
void setNelemCache(unsigned int n){nelemCache= n > 0 ? n : 1;}
|
||||
void setUsrArg(void * u){usrArg=u;};
|
||||
void setDataType(chtype d){dataType=d;};
|
||||
void setDbrDataType(chtype dbr){dbrDataType=dbr; }; //byteSize=dbr_size_n(dbrDataType,nelem);};
|
||||
void setCafeDbrType(CAFENUM::DBR_TYPE cd){cafeDbrType=cd;};
|
||||
void setDbrTypesFromCafeDbrType(CAFENUM::DBR_TYPE cd){
|
||||
cafeDbrType=cd;
|
||||
switch(cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
dbrDataType = dbf_type_to_DBR_TIME(dataType);
|
||||
break;
|
||||
case CAFENUM::DBR_STS:
|
||||
dbrDataType = dbf_type_to_DBR_STS(dataType);
|
||||
break;
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
dbrDataType = dbf_type_to_DBR(dataType);
|
||||
break;
|
||||
default:
|
||||
//Print Warning Message?
|
||||
dbrDataType = dbf_type_to_DBR_TIME(dataType);
|
||||
cafeDbrType = CAFENUM::DBR_TIME;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void setByteSize(unsigned int b){ byteSize=b;};
|
||||
|
||||
unsigned int getNelem() const{return nelem;};
|
||||
unsigned int getNelemCache() const{return nelemCache;};
|
||||
void * getUsrArg() const{return usrArg;};
|
||||
chtype getDataType() const { return dataType;};
|
||||
chtype getDbrDataType() const { return dbrDataType;};
|
||||
CAFENUM::DBR_TYPE getCafeDbrType() const {return cafeDbrType;};
|
||||
|
||||
unsigned int getByteSize() const {return byteSize;};
|
||||
|
||||
void setOffset(unsigned int o) {offset=o;};
|
||||
unsigned int getOffset() const {return offset;};
|
||||
|
||||
//Constructors
|
||||
ChannelRequestMetaData():channelID((chid) NULL), nelem((unsigned int) 1), nelemCache((unsigned int) 1),
|
||||
dataType((chtype) DBF_NO_ACCESS), dbrDataType((chtype) TYPENOTCONN), //
|
||||
cafeDbrType( (CAFENUM::DBR_TYPE) NULL),
|
||||
usrArg((void *) NULL), byteSize((unsigned int) 0), offset((unsigned int) 0){
|
||||
|
||||
}; //CAStatus((long) ECA_NORMAL){};
|
||||
|
||||
~ChannelRequestMetaData(){};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* -1. Struct defining channel datatype/nelem requested by client for use in Conduit container
|
||||
*
|
||||
*/
|
||||
class ChannelRequestMetaDataClient: public ChannelRequestMetaData{
|
||||
public:
|
||||
|
||||
//protected:
|
||||
//unsigned int offset;
|
||||
public:
|
||||
//void setOffset(unsigned int o) {offset=o;};
|
||||
//unsigned int getOffset() const {return offset;};
|
||||
|
||||
//Constructors
|
||||
ChannelRequestMetaDataClient(){};//:offset((unsigned int) 0){};
|
||||
~ChannelRequestMetaDataClient(){};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gives status of the Request message \n
|
||||
* messageStatus = requestStatus if requestStatus != ECA_NORMAL else \n
|
||||
* messageStatus = requestStatus or messageStatus=callbackStatus (if policy WITH_CALLBACK)
|
||||
*
|
||||
*/
|
||||
class ChannelRequestStatus{
|
||||
|
||||
private:
|
||||
int preRequestStatus; // current status of channel
|
||||
int requestStatus; // from get/put operation
|
||||
int pendStatus; // from pend_io operation
|
||||
int callbackStatus; // used by CAFE::waitForEvent() to record status of callback
|
||||
int messageStatus; // overall status
|
||||
CAFENUM::StatusMessageKind messageKind; // statusMessageKind indicating method status occuping overall messageStatus
|
||||
|
||||
bool hasCallbackInitiated;
|
||||
bool hasCallbackTriggered;
|
||||
CAFENUM::CallbackProgressKind callbackProgressKind;
|
||||
|
||||
public:
|
||||
int getPreRequestStatus() const {return preRequestStatus;};
|
||||
int getRequestStatus() const {return requestStatus;};
|
||||
int getPendStatus() const {return pendStatus;};
|
||||
int getCallbackStatus() const {return callbackStatus;};
|
||||
int getMessageStatus() const {return messageStatus;};
|
||||
CAFENUM::StatusMessageKind getMessageKind() const {return messageKind;};
|
||||
CAFENUM::CallbackProgressKind getCallbackProgressKind() const {return callbackProgressKind;};
|
||||
|
||||
void setPreRequestStatus (int s) {preRequestStatus=s; messageStatus=s; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::PRE_REQUEST;};
|
||||
void setRequestStatus (int r) {requestStatus = r; messageStatus=r; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::FROM_REQUEST;};
|
||||
void setPendStatus (int p) {pendStatus = p; messageStatus=p; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::FROM_PEND;};
|
||||
void setCallbackStatus (int c) {callbackStatus= c; messageStatus=c; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::FROM_CALLBACK;};
|
||||
void setCallbackKind (bool hasInit, bool hasTrig) {
|
||||
hasCallbackInitiated=hasInit; hasCallbackTriggered=hasTrig;
|
||||
if ( hasInit && !hasTrig) {callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::PENDING;}
|
||||
else if (!hasInit && hasTrig) {callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::COMPLETE;}
|
||||
else if (!hasInit && !hasTrig) {callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::NOT_INITIATED;}
|
||||
else {std::cout << "CAFE INTERNAL POLICY ERROR" << std::endl;
|
||||
std::cout << "ChannelRequestStatus::setCallbackKind gives an INVALID callbackProgressKind" << endl;}
|
||||
};
|
||||
//void setMessageStatus (long mstatus) {messageStatus = mstatus;};
|
||||
// void setMessageKind (StatusMessageKind mkind) { if (mkind<=CAFENUM::FROM_CALLBACK && mkind >= CAFENUM::PRE_REQUEST)
|
||||
// {messageKind = mkind;} else {cout<< mkind << " is an invalid statusMessageKind!" << endl;}};
|
||||
|
||||
ChannelRequestStatus():preRequestStatus(ICAFE_CS_NEVER_CONN),requestStatus(ICAFE_CS_NEVER_CONN),pendStatus(ICAFE_CS_NEVER_CONN),
|
||||
callbackStatus(ICAFE_CS_NEVER_CONN),messageStatus(ICAFE_CS_NEVER_CONN),messageKind((CAFENUM::StatusMessageKind) CAFENUM::NO_MESSAGE),
|
||||
hasCallbackInitiated(false),hasCallbackTriggered(false),callbackProgressKind((CAFENUM::CallbackProgressKind) CAFENUM::NOT_INITIATED){};
|
||||
};
|
||||
|
||||
#endif // CHANNELINFO_H
|
||||
361
include/conduit.h
Normal file
361
include/conduit.h
Normal file
@@ -0,0 +1,361 @@
|
||||
///
|
||||
/// \file conduit.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CONDUIT_H
|
||||
#define CONDUIT_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <config.h>
|
||||
#include <cadef.h>
|
||||
|
||||
|
||||
#include <channelRegalia.h>
|
||||
#include <PVDataHolder.h>
|
||||
#include <PVCtrlHolder.h>
|
||||
#include <policies.h>
|
||||
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
|
||||
#if HAVE_PYCAFE_EXT
|
||||
#include <Python.h> //required for PyCafe.h
|
||||
#include <PyCafe.h>
|
||||
#else
|
||||
#include <PyCafe_api.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Principal constructor has:\n
|
||||
* \param _pv process variable
|
||||
* \param _ccc ca_client_context
|
||||
*/
|
||||
class Conduit
|
||||
{
|
||||
public:
|
||||
friend struct change_alarmStatus;
|
||||
friend struct change_alarmSeverity;
|
||||
friend struct change_epicsTimeStamp;
|
||||
|
||||
friend struct change_accessRightsHandlerArgs;
|
||||
friend struct change_accessRead;
|
||||
friend struct change_accessWrite;
|
||||
friend struct change_channelDeviceAttribute;
|
||||
friend struct change_channelID;
|
||||
friend struct change_channelRegalia;
|
||||
|
||||
friend struct change_channelGetCacheWaitPolicy;
|
||||
friend struct change_channelGetActionWhenMonitorPolicy;
|
||||
|
||||
friend struct change_channelRequestDataTypePolicy;
|
||||
|
||||
friend struct change_channelRequestMetaCtrl;
|
||||
friend struct change_channelRequestMetaCtrlClient;
|
||||
|
||||
friend struct change_channelRequestMetaData;
|
||||
friend struct change_channelRequestMetaDataClient;
|
||||
|
||||
friend struct change_channelRequestMetaPrimitive;
|
||||
|
||||
friend struct change_channelRequestPolicyPut;
|
||||
friend struct change_channelRequestStatusPut;
|
||||
|
||||
friend struct change_channelRequestPolicyGet;
|
||||
friend struct change_channelRequestStatusGet;
|
||||
|
||||
friend struct change_channelRequestPolicyGetCtrl;
|
||||
friend struct change_channelRequestStatusGetCtrl;
|
||||
|
||||
friend struct change_channelRequestStatusGetSTSACK;
|
||||
friend struct change_channelRequestStatusGetClassName;
|
||||
|
||||
friend struct change_channelTimeoutPolicyGet;
|
||||
friend struct change_channelTimeoutPolicyPut;
|
||||
|
||||
friend struct change_connectionHandlerArgs;
|
||||
|
||||
friend struct change_dataBufferSize_PRIMITIVE;
|
||||
friend struct change_dataBufferSize_TIME;
|
||||
friend struct change_dataBufferSize_CTRL;
|
||||
friend struct change_dataBufferSize_STSACK;
|
||||
|
||||
//friend struct change_dataBufferPVCtrlHolder;
|
||||
//friend struct change_dataBufferPVDataHolder;
|
||||
friend struct change_eventHandlerArgs;
|
||||
friend struct change_hasNewData;
|
||||
friend struct change_monitorAction;
|
||||
friend struct change_monitorActionClear;
|
||||
friend struct change_monitorActionErase;
|
||||
friend struct change_monitorPolicyErase;
|
||||
friend struct change_monitorPolicyInsert;
|
||||
|
||||
friend struct change_monitorPolicyInWaitingErase;
|
||||
friend struct change_monitorPolicyInWaitingInsert;
|
||||
|
||||
//friend struct change_rule;
|
||||
|
||||
friend struct change_pvAlias;
|
||||
friend struct change_status;
|
||||
|
||||
friend struct change_usrArgs;
|
||||
|
||||
friend struct free_dataBuffers;
|
||||
|
||||
friend class Connect;
|
||||
friend class CAFE;
|
||||
friend class Granules;
|
||||
friend class ChannelCreatePolicy;
|
||||
friend class ConduitGroup;
|
||||
friend class MonitorPolicy;
|
||||
|
||||
//friend void CAFE_CALLBACK::PyHandlerPut;
|
||||
//friend void CAFE_CALLBACK::PyHandlerGet;
|
||||
//friend struct change_pyCafeFlag;
|
||||
|
||||
private:
|
||||
//from alarmString.h
|
||||
const char * epicsAlarmSeverityStrings[ALARM_SEVERITY_STRING_LENGTH];
|
||||
const char * epicsAlarmConditionStrings[ALARM_STATUS_STRING_LENGTH];
|
||||
|
||||
static unsigned int handleNext;
|
||||
|
||||
ca_client_context * ccc;
|
||||
|
||||
union db_access_val * dataBuffer;
|
||||
union db_access_val * ctrlBuffer;
|
||||
union db_access_val * putBuffer;
|
||||
union db_access_val * stsackBuffer;
|
||||
|
||||
short alarmStatus;
|
||||
short alarmSeverity;
|
||||
epicsTimeStamp ts;
|
||||
|
||||
void * usrArgs; //Filled in conduitEventHandlerArgs.h; used by getUsrArgsAsUInt in CyCafe
|
||||
|
||||
chtype dataType;
|
||||
chtype dbrDataType;
|
||||
CAFENUM::DBR_TYPE cafeDbrType;
|
||||
|
||||
//Reserved
|
||||
unsigned int beamEventNo;
|
||||
|
||||
//bool rule;
|
||||
bool pyCafeFlag;
|
||||
|
||||
std::string deviceAttributeDeliminator;
|
||||
ChannelDeviceAttribute channelDeviceAttribute;
|
||||
|
||||
//PVCtrlHolder pvc;
|
||||
//PVDataHolder pvd;
|
||||
|
||||
ChannelEnumStrings channelEnumStrings;
|
||||
|
||||
//ChannelPolicies
|
||||
|
||||
ChannelGetCacheWaitPolicy channelGetCacheWaitPolicy;
|
||||
ChannelGetActionWhenMonitorPolicy channelGetActionWhenMonitorPolicy;
|
||||
|
||||
ChannelRequestDataTypePolicy channelRequestDataTypePolicy;
|
||||
|
||||
ChannelRequestPolicy channelRequestPolicyPut;
|
||||
ChannelRequestStatus channelRequestStatusPut;
|
||||
|
||||
ChannelRequestPolicy channelRequestPolicyGet; //DATA
|
||||
ChannelRequestStatus channelRequestStatusGet; //DATA
|
||||
|
||||
ChannelRequestPolicy channelRequestPolicyGetCtrl; //CTRL
|
||||
ChannelRequestStatus channelRequestStatusGetCtrl; //CTRL
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGetSTSACK; //STSACK
|
||||
ChannelRequestStatus channelRequestStatusGetClassName;//ClassName
|
||||
|
||||
ChannelTimeoutPolicy channelTimeoutPolicyGet;
|
||||
ChannelTimeoutPolicy channelTimeoutPolicyPut;
|
||||
|
||||
ChannelRegalia channelRegalia;
|
||||
|
||||
ChannelRequestMetaData channelRequestMetaData; //0 container for actual send
|
||||
ChannelRequestMetaDataClient channelRequestMetaDataClient; //-1 //DATA
|
||||
//ChannelRequestMetaDataRepository channelRequestMetaDataRepository; // (CAFENUM::DBR_TYPE DBR_TIME) ; //1
|
||||
|
||||
ChannelRequestMetaData channelRequestMetaCtrl; //0 container for actual send
|
||||
ChannelRequestMetaDataClient channelRequestMetaCtrlClient; //-1 //CTRL
|
||||
//ChannelRequestMetaDataRepository channelRequestMetaCtrlRepository; // (CAFENUM::DBR_TYPE DBR_CTRL); //1
|
||||
|
||||
ChannelRequestMetaData channelRequestMetaSTSACK;// (CAFENUM::DBR_TYPE DBR_STSACK);//1
|
||||
ChannelRequestMetaData channelRequestMetaPrimitive; //Put operations
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
void * PyEventHandler() const;
|
||||
void * PyEventHandler(unsigned int) const;
|
||||
void * PyDataEventHandler() const;
|
||||
void * PyCtrlEventHandler() const;
|
||||
#endif
|
||||
|
||||
int putWithCallback(pCallback callbackHandlerPut) const;
|
||||
|
||||
int put(void) const;
|
||||
int get(void) const;
|
||||
int getWithCallback(pCallback) const;
|
||||
int getCtrl(void) const;
|
||||
int getCtrlWithCallback(pCallback) const;
|
||||
int getSTSACKWithCallback(pCallback) const;
|
||||
int getClassNameWithCallback(pCallback) const;
|
||||
|
||||
//Monitor Policies
|
||||
//map<evid,MonitorPolicy> emp;
|
||||
//map<evid,MonitorPolicy>::iterator iemp;
|
||||
//map<unsigned long,MonitorPolicy> lump;
|
||||
//map<unsigned long,MonitorPolicy>::iterator ilump;
|
||||
|
||||
////MonitorPolicy mpBase;
|
||||
vector<MonitorPolicy> mpV;
|
||||
vector<MonitorPolicy> mpInWaitingV;
|
||||
|
||||
int monitorStart(MonitorPolicy &mp) const;
|
||||
int monitorStop(evid eventID) const;
|
||||
|
||||
vector<std::string> monitorAction;
|
||||
|
||||
bool hasNewData; // used by HandleHelper.getMonitorAction();
|
||||
|
||||
public:
|
||||
#if HAVE_PYTHON_H
|
||||
void * PyGetHandler() const;
|
||||
void * PyPutHandler() const;
|
||||
#endif
|
||||
|
||||
Conduit(void );
|
||||
|
||||
Conduit(const char * _pv, ca_client_context *_ccc,
|
||||
ChannelRequestPolicy _channelRequestPolicyPut, ChannelRequestPolicy _channelRequestPolicyGet,
|
||||
ChannelGetActionWhenMonitorPolicy _channelGetActionWhenMonitorPolicy,
|
||||
bool _pyCafeFlag);
|
||||
|
||||
//Conduit(const char * _pv, ca_client_context *_ccc, bool _pyCafeFlag);
|
||||
//Conduit(const char * _pv, ca_client_context *_ccc);
|
||||
virtual ~Conduit();
|
||||
unsigned int groupHandle; // Group handle this pv handle belongs to!!
|
||||
unsigned int handle;
|
||||
|
||||
chid channelID;
|
||||
//evid eventID;
|
||||
|
||||
std::string pv;
|
||||
std::string pvAlias;
|
||||
|
||||
int status;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const Conduit& e)
|
||||
{
|
||||
os<< "handle=" << e.handle<<" pv=" << e.pv<< std::endl;
|
||||
return os;
|
||||
};
|
||||
|
||||
bool getPyCafe() const {return pyCafeFlag;};
|
||||
|
||||
bool operator<(const Conduit& c)const{return handle<c.handle;};
|
||||
|
||||
const char * getDevice(void) const {return channelDeviceAttribute.getDevice();};
|
||||
const char * getAttribute(void) const {return channelDeviceAttribute.getAttribute();};
|
||||
|
||||
const char * getHostName(void) const {return channelRegalia.hostName;};
|
||||
bool isConnected(void) const {return channelRegalia.connectFlag;};
|
||||
|
||||
epicsTimeStamp getTimeStamp(void) const{return ts;}
|
||||
short getAlarmStatus(void) const{return alarmStatus;}
|
||||
short getAlarmSeverity(void) const{return alarmSeverity;}
|
||||
|
||||
string getAlarmStatusAsString(void) const{
|
||||
if (alarmStatus>-1 && alarmStatus<ALARM_STATUS_STRING_LENGTH) {
|
||||
return (string) epicsAlarmConditionStrings[alarmStatus];}
|
||||
else {
|
||||
cout << "alarmStatusValue=" << alarmStatus << " is not within the valid range of 0-3!" << endl;
|
||||
return (string) "ALARM_UNKNOWN";
|
||||
}
|
||||
}
|
||||
string getAlarmSeverityAsString(void) const{
|
||||
if (alarmSeverity>-1 && alarmSeverity<ALARM_SEVERITY_STRING_LENGTH) {
|
||||
return (string) epicsAlarmSeverityStrings[alarmSeverity];}
|
||||
else {
|
||||
cout << "alarmStatusSeverity=" << alarmSeverity << " is not within the valid range of 0-21!" << endl;
|
||||
return (string) "SEVERITY_UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned short getAccessRead(void) const{return channelRegalia.accessRead;};
|
||||
unsigned short getAccessWrite(void) const{return channelRegalia.accessWrite;};
|
||||
//Reserved
|
||||
unsigned int getBeamEventNo(void) const {return beamEventNo;};
|
||||
chid getChannelID(void) const {return channelRegalia.channelID;};
|
||||
ChannelRegalia getChannelRegalia(void) const {return channelRegalia;};
|
||||
ca_client_context * getClientContext(void) const {return ccc;};
|
||||
unsigned int getGroupHandle(void) const {return groupHandle;};
|
||||
unsigned int getHandle(void) const {return handle;};
|
||||
const char * getPV(void) const {return pv.c_str();};
|
||||
const char * getPVAlias(void) const {return pvAlias.c_str();};
|
||||
|
||||
int getStatus(void) const {return status;};
|
||||
|
||||
void * getUsrArgs(void) const {return usrArgs;};
|
||||
chtype getDataType(void) const {return dataType;};
|
||||
chtype getDbrDataType(void) const {return dbrDataType;};
|
||||
CAFENUM::DBR_TYPE getCafeDbrType(void) const {return cafeDbrType;};
|
||||
|
||||
db_access_val * getCtrlBuffer(void) const {return ctrlBuffer;};
|
||||
db_access_val * getDataBuffer(void) const {return dataBuffer;};
|
||||
db_access_val * getPutBuffer(void) const {return putBuffer;};
|
||||
|
||||
int getPVDataHolder(PVDataHolder &) const ;
|
||||
int getPVCtrlHolder(PVCtrlHolder &) const ;
|
||||
|
||||
//bool getRule(void) const {return rule;};
|
||||
|
||||
//RequestPolicy
|
||||
ChannelGetCacheWaitPolicy getChannelGetCacheWaitPolicy(void) const { return channelGetCacheWaitPolicy;};
|
||||
ChannelGetActionWhenMonitorPolicy getChannelGetActionWhenMonitorPolicy(void) const { return channelGetActionWhenMonitorPolicy;}
|
||||
|
||||
ChannelTimeoutPolicy getChannelTimeoutPolicyGet (void) const {return channelTimeoutPolicyGet;};
|
||||
ChannelRequestPolicy getChannelRequestPolicyGet (void) const {return channelRequestPolicyGet;};
|
||||
ChannelRequestStatus getChannelRequestStatusGet (void) const {return channelRequestStatusGet;};
|
||||
ChannelRequestPolicy getChannelRequestPolicyGetCtrl (void) const {return channelRequestPolicyGetCtrl;};
|
||||
ChannelRequestStatus getChannelRequestStatusGetCtrl (void) const {return channelRequestStatusGetCtrl;};
|
||||
|
||||
ChannelRequestStatus getChannelRequestStatusGetSTSACK (void) const {return channelRequestStatusGetSTSACK;};
|
||||
ChannelRequestStatus getChannelRequestStatusGetClassName (void) const {return channelRequestStatusGetClassName;};
|
||||
|
||||
ChannelTimeoutPolicy getChannelTimeoutPolicyPut (void) const {return channelTimeoutPolicyPut;};
|
||||
ChannelRequestPolicy getChannelRequestPolicyPut (void) const {return channelRequestPolicyPut;};
|
||||
ChannelRequestStatus getChannelRequestStatusPut (void) const {return channelRequestStatusPut;};
|
||||
|
||||
ChannelRequestDataTypePolicy getChannelRequestDataTypePolicy(void) const { return channelRequestDataTypePolicy;};
|
||||
|
||||
ChannelRequestMetaData getChannelRequestMetaData(void) const {return channelRequestMetaData;}; //0
|
||||
ChannelRequestMetaDataClient getChannelRequestMetaDataClient(void) const {return channelRequestMetaDataClient;}; //-1
|
||||
ChannelRequestMetaData getChannelRequestMetaCtrl(void) const {return channelRequestMetaCtrl;}; //0
|
||||
ChannelRequestMetaDataClient getChannelRequestMetaCtrlClient(void) const {return channelRequestMetaCtrlClient;}; //-1
|
||||
|
||||
ChannelRequestMetaData getChannelRequestMetaPrimitive(void) const {return channelRequestMetaPrimitive;}; //0
|
||||
|
||||
//ChannelRequestMetaDataRepository getChannelRequestMetaDataRepository (void) const {return channelRequestMetaDataRepository;}; //1
|
||||
//ChannelRequestMetaDataRepository getChannelRequestMetaCtrlRepository (void) const {return channelRequestMetaCtrlRepository;}; //1
|
||||
//ChannelRequestMetaDataRepository getChannelRequestMetaSTSACKRepository(void) const {return channelRequestMetaSTSACKRepository;}; //1
|
||||
//ChannelRequestMetaDataRepository getChannelRequestMetaPrimitiveRepository(void) const {return channelRequestMetaPrimitiveRepository;}; //1
|
||||
|
||||
////MonitorPolicy getMonitorPolicy(void) const {return mpBase;};
|
||||
vector<MonitorPolicy> getMonitorPolicyVector(void) const {return mpV;};
|
||||
vector<MonitorPolicy> getMonitorPolicyInWaitingVector(void) const {return mpInWaitingV;};
|
||||
|
||||
vector<string> getMonitorAction(void) const {return monitorAction;};
|
||||
bool getHasNewData(void) const {return hasNewData;};
|
||||
};
|
||||
|
||||
#endif // CONDUIT_H
|
||||
488
include/conduitConnectionHandlerArgs.h
Normal file
488
include/conduitConnectionHandlerArgs.h
Normal file
@@ -0,0 +1,488 @@
|
||||
///
|
||||
/// \file conduitConnectionHandlerArgs.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date November 2014
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CONDUITCONNECTIONHANDLERARGS_H
|
||||
#define CONDUITCONNECTIONHANDLERARGS_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <conduit.h>
|
||||
#include <statusCodes.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup records the connection_handler_args struct from callback fns
|
||||
* in hash table
|
||||
*/
|
||||
struct change_connectionHandlerArgs
|
||||
{
|
||||
#define __METHOD__ "change_connectionHandlerArgs"
|
||||
change_connectionHandlerArgs (const struct connection_handler_args & new_connectionHandlerArgs):
|
||||
new_connectionHandlerArgs(new_connectionHandlerArgs){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
chtype nativeDataType = ca_field_type(new_connectionHandlerArgs.chid);
|
||||
|
||||
c.channelRegalia.connectionState=new_connectionHandlerArgs.op;
|
||||
|
||||
// Data type code will be one of DBF_. The constant TYPENOTCONN=-1 is
|
||||
// returned if the channel is not connected
|
||||
// but we do not overwrite it upon disconnect.
|
||||
|
||||
//connectFlag
|
||||
if (new_connectionHandlerArgs.op == CA_OP_CONN_UP){
|
||||
|
||||
//cout << " change_connectionHandlerArgs: bytesize UP " << c.channelRequestMetaData.byteSize << endl;
|
||||
//channelRegalia
|
||||
c.channelRegalia.nelem = ca_element_count(new_connectionHandlerArgs.chid);
|
||||
c.channelRegalia.connectFlag = true;
|
||||
c.channelRegalia.hostName = (const char *) ca_host_name (new_connectionHandlerArgs.chid);
|
||||
|
||||
if (c.channelRegalia.channelID != new_connectionHandlerArgs.chid) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Internal CAFE WARNING for handle : " << c.handle << endl;
|
||||
cout << "Channel ID has changed from " << c.channelRegalia.channelID
|
||||
<< " to " << new_connectionHandlerArgs.chid << " " << endl;
|
||||
cout << "This is a rare occurence and happens when the ca message buffer " << endl;
|
||||
cout << "is flushed ahead of schedule (does that when full) and this callback is " << endl;
|
||||
cout << "consequently activated before channel ID is written to the hash table " << endl;
|
||||
c.channelRegalia.channelID = new_connectionHandlerArgs.chid;
|
||||
}
|
||||
|
||||
|
||||
//Data type code will be one of DBF_. The constant TYPENOTCONN=-1 is
|
||||
//returned if the channel is not connected.
|
||||
//Does not get overwritten on channel disconnection
|
||||
c.channelRegalia.dataType = nativeDataType;
|
||||
|
||||
|
||||
// DATA BUFFER ------------------------------------------------------------------
|
||||
// data buffer CLIENT
|
||||
// Check if c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN or not!
|
||||
|
||||
|
||||
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
|
||||
c.channelRequestMetaDataClient.channelID = new_connectionHandlerArgs.chid;
|
||||
c.channelRequestMetaDataClient.nelem = c.channelRegalia.nelem;
|
||||
c.channelRequestMetaDataClient.nelemCache = c.channelRegalia.nelem;
|
||||
c.channelRequestMetaDataClient.dataType = nativeDataType;
|
||||
|
||||
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
|
||||
//but will be overwritten by whatever the client needs
|
||||
switch (c.channelRequestMetaDataClient.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
|
||||
break;
|
||||
case CAFENUM::DBR_STS:
|
||||
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_STS(nativeDataType);
|
||||
break;
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR(nativeDataType);
|
||||
break;
|
||||
default:
|
||||
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
|
||||
c.channelRequestMetaDataClient.cafeDbrType = CAFENUM::DBR_TIME;
|
||||
break;
|
||||
}
|
||||
|
||||
//What client is actutally requesting
|
||||
c.channelRequestMetaDataClient.byteSize=dbr_size_n(
|
||||
c.channelRequestMetaDataClient.dbrDataType,
|
||||
//dbf_type_to_DBR_TIME(nativeDataType),
|
||||
c.channelRequestMetaDataClient.nelem);
|
||||
}
|
||||
|
||||
//data Buffer requested by Cafe
|
||||
c.channelRequestMetaData.channelID = new_connectionHandlerArgs.chid;
|
||||
c.channelRequestMetaData.nelem = c.channelRegalia.nelem;
|
||||
c.channelRequestMetaData.nelemCache = c.channelRegalia.nelem;
|
||||
c.channelRequestMetaData.dataType = nativeDataType;
|
||||
|
||||
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
|
||||
//cafeDbrType can only be overwritten by an explicit method invocation
|
||||
switch (c.channelRequestMetaData.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
|
||||
break;
|
||||
case CAFENUM::DBR_STS:
|
||||
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_STS(nativeDataType);
|
||||
break;
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR(nativeDataType);
|
||||
break;
|
||||
default:
|
||||
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
|
||||
c.channelRequestMetaData.cafeDbrType = CAFENUM::DBR_TIME;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// CTRL BUFFER ------------------------------------------------------------------
|
||||
|
||||
//No of elements for Ctrl Buffers
|
||||
unsigned int nelem_ctrl_buffer=1;
|
||||
|
||||
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_CTRL_BUFFER) {
|
||||
nelem_ctrl_buffer = DEFAULT_NELEM_FOR_CTRL_BUFFER;
|
||||
}
|
||||
else {
|
||||
nelem_ctrl_buffer = c.channelRegalia.nelem;
|
||||
}
|
||||
|
||||
//ctrl data CLIENT
|
||||
//Ctrl data requested by Client
|
||||
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
|
||||
c.channelRequestMetaCtrlClient.channelID = new_connectionHandlerArgs.chid;
|
||||
c.channelRequestMetaCtrlClient.nelem = c.channelRegalia.nelem; //nelem_ctrl_buffer;
|
||||
c.channelRequestMetaCtrlClient.nelemCache = c.channelRegalia.nelem;
|
||||
c.channelRequestMetaCtrlClient.dataType = nativeDataType;
|
||||
|
||||
//cafeDbrType first filled with CAFENUM:DBR_CTRL on initialization
|
||||
//but will be overwritten by whatever the client needs
|
||||
switch (c.channelRequestMetaCtrlClient.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_CTRL:
|
||||
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
|
||||
break;
|
||||
case CAFENUM::DBR_GR:
|
||||
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_GR (nativeDataType);
|
||||
break;
|
||||
default:
|
||||
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
|
||||
c.channelRequestMetaCtrlClient.cafeDbrType = CAFENUM::DBR_CTRL;
|
||||
break;
|
||||
}
|
||||
|
||||
c.channelRequestMetaCtrlClient.byteSize=dbr_size_n(
|
||||
c.channelRequestMetaCtrlClient.dbrDataType,c.channelRequestMetaCtrlClient.nelem);
|
||||
}
|
||||
|
||||
//ctrl Data requested by Cafe
|
||||
c.channelRequestMetaCtrl.channelID = new_connectionHandlerArgs.chid;
|
||||
c.channelRequestMetaCtrl.nelem = nelem_ctrl_buffer;
|
||||
c.channelRequestMetaCtrl.nelemCache = nelem_ctrl_buffer;
|
||||
c.channelRequestMetaCtrl.dataType = nativeDataType;
|
||||
//cafeDbrType first filled with CAFENUM:DBR_CTRL on initialization
|
||||
//cafeDbrType can only be overwritten by an explicit method invocation
|
||||
switch (c.channelRequestMetaCtrl.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_CTRL:
|
||||
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
|
||||
break;
|
||||
case CAFENUM::DBR_GR:
|
||||
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_GR (nativeDataType);
|
||||
break;
|
||||
default:
|
||||
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
|
||||
c.channelRequestMetaCtrl.cafeDbrType = CAFENUM::DBR_CTRL;
|
||||
break;
|
||||
}
|
||||
|
||||
// STSACK BUFFER ------------------------------------------------------------------
|
||||
|
||||
//No of elements for STSACK Buffers
|
||||
unsigned int nelem_stsack_buffer;
|
||||
|
||||
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_STSACK_BUFFER) {
|
||||
nelem_stsack_buffer = DEFAULT_NELEM_FOR_STSACK_BUFFER;
|
||||
}
|
||||
else {
|
||||
nelem_stsack_buffer = c.channelRegalia.nelem;
|
||||
}
|
||||
|
||||
|
||||
//STSACK Buffer Repository
|
||||
c.channelRequestMetaSTSACK.channelID = new_connectionHandlerArgs.chid;
|
||||
c.channelRequestMetaSTSACK.nelem = nelem_stsack_buffer;
|
||||
c.channelRequestMetaSTSACK.nelemCache = nelem_stsack_buffer;
|
||||
c.channelRequestMetaSTSACK.dataType = DBR_STRING;
|
||||
c.channelRequestMetaSTSACK.dbrDataType = DBR_STSACK_STRING;
|
||||
c.channelRequestMetaSTSACK.cafeDbrType = CAFENUM::DBR_STSACK;
|
||||
|
||||
|
||||
//PRIMITIVE Buffer Repository
|
||||
c.channelRequestMetaPrimitive.channelID = new_connectionHandlerArgs.chid;
|
||||
c.channelRequestMetaPrimitive.nelem = c.channelRegalia.nelem;
|
||||
c.channelRequestMetaPrimitive.dataType = nativeDataType;;
|
||||
c.channelRequestMetaPrimitive.dbrDataType= dbf_type_to_DBR(nativeDataType);
|
||||
c.channelRequestMetaPrimitive.cafeDbrType= CAFENUM::DBR_PRIMITIVE;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
if ( c.channelRegalia.nelem>1) {
|
||||
double tout= ((unsigned int) (c.channelRegalia.nelem*0.000001)); // 1 sec per million
|
||||
c.channelRequestDataTypePolicy.setRequestKind(CAFENUM::LOWEST_DATATYPE);
|
||||
c.channelTimeoutPolicyGet.setTimeout(std::max(DEFAULT_TIMEOUT_PEND_IO_WF , tout));
|
||||
c.channelTimeoutPolicyPut.setTimeout(std::max(DEFAULT_TIMEOUT_PEND_IO_WF , tout));
|
||||
c.channelTimeoutPolicyGet.setDefaultTimeout(DEFAULT_TIMEOUT_PEND_IO_WF);
|
||||
c.channelTimeoutPolicyPut.setDefaultTimeout(DEFAULT_TIMEOUT_PEND_IO_WF);
|
||||
}
|
||||
|
||||
c.channelRegalia.cafeConnectionState = ICAFE_CS_CONN;
|
||||
c.status = ICAFE_CA_OP_CONN_UP;
|
||||
}
|
||||
else {
|
||||
|
||||
//nativeType not known on disconnect!!
|
||||
|
||||
//Also callback done
|
||||
c.channelRequestStatusGet.setCallbackKind(false, true); //fake completion
|
||||
c.channelRequestStatusPut.setCallbackKind(false, true); //fake completion
|
||||
c.channelRegalia.cafeConnectionState =ICAFE_CS_DISCONN;
|
||||
c.channelRegalia.connectFlag = false;
|
||||
c.status = ICAFE_CA_OP_CONN_DOWN;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
connection_handler_args new_connectionHandlerArgs;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to the ctrlBuffer
|
||||
* This is the ctrlBuffer for _CTRL data requested through ca_get
|
||||
*/
|
||||
struct change_dataBufferSize_CTRL
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_CTRL"
|
||||
change_dataBufferSize_CTRL (const chtype & new_ctrlTypeBuffer): new_ctrlTypeBuffer(new_ctrlTypeBuffer){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
// Free buffer on re-connection
|
||||
// Check Byte size first!!!
|
||||
|
||||
bool allocateMemory=false ;
|
||||
|
||||
if(c.ctrlBuffer==NULL) {
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
else if ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) > c.channelRequestMetaCtrl.getByteSize() ) {
|
||||
cout << "ctrlBuffer already exists= " << c.ctrlBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << endl;
|
||||
cout << "Freeing and reallocating ctrlBuffer" << endl;
|
||||
free(c.ctrlBuffer);
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
//cout << "sizeof c.ctrlBuffer " << dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) << endl;
|
||||
c.ctrlBuffer = (db_access_val *) malloc ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) );
|
||||
c.channelRequestMetaCtrl.byteSize=dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem());
|
||||
}
|
||||
|
||||
|
||||
if (c.ctrlBuffer==0){
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
chtype new_ctrlTypeBuffer;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the dataBuffer of type DBR (putBuffer)
|
||||
* This is used in ca_put methods when input data that is not already in native data type is thus converted
|
||||
*/
|
||||
struct change_dataBufferSize_PRIMITIVE
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
|
||||
change_dataBufferSize_PRIMITIVE (const chtype & new_dataTypeBufferNative): new_dataTypeBufferNative(new_dataTypeBufferNative){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
bool allocateMemory=false ;
|
||||
|
||||
if(c.putBuffer==NULL) {
|
||||
allocateMemory=true;
|
||||
}
|
||||
else if ( dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
|
||||
c.channelRequestMetaPrimitive.getNelem())
|
||||
> c.channelRequestMetaPrimitive.getByteSize() ) {
|
||||
cout << "putBuffer already exists= " << c.putBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << endl;
|
||||
cout << "Freeing and reallocating putBuffer" << endl;
|
||||
free(c.putBuffer);
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
//cout << "sizeof c.putBuffer " << dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
|
||||
// c.channelRequestMetaPrimitive.getNelem()) << endl;
|
||||
c.putBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
|
||||
c.channelRequestMetaPrimitive.getNelem()));
|
||||
|
||||
c.channelRequestMetaPrimitive.byteSize
|
||||
=dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
|
||||
c.channelRequestMetaPrimitive.getNelem());
|
||||
}
|
||||
|
||||
if (c.putBuffer==0){
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
chtype new_dataTypeBufferNative;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the ctrlBuffer
|
||||
* This is the ctrlBuffer for _CTRL data requested through ca_get
|
||||
*/
|
||||
struct change_dataBufferSize_STSACK
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_STSACK"
|
||||
change_dataBufferSize_STSACK (){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
bool allocateMemory=false ;
|
||||
|
||||
if(c.stsackBuffer==NULL) {
|
||||
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
else if ( dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
|
||||
c.channelRequestMetaSTSACK.getNelem())
|
||||
> c.channelRequestMetaSTSACK.getByteSize() ) {
|
||||
cout << "stsackBuffer already exists= " << c.stsackBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << endl;
|
||||
cout << "Freeing and reallocating putBuffer" << endl;
|
||||
free(c.stsackBuffer);
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
//cout << "sizeof c.stsackBuffer " << dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
|
||||
// c.channelRequestMetaSTSACK.getNelem()) << endl;
|
||||
c.stsackBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
|
||||
c.channelRequestMetaSTSACK.getNelem()));
|
||||
|
||||
c.channelRequestMetaSTSACK.byteSize
|
||||
=dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
|
||||
c.channelRequestMetaSTSACK.getNelem());
|
||||
}
|
||||
|
||||
}
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the dataBuffer of type DBR_TIME (dataBuffer)
|
||||
* This is the main dataBuffer for data requested through ca_get
|
||||
*/
|
||||
struct change_dataBufferSize_TIME
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
|
||||
|
||||
change_dataBufferSize_TIME (const chtype & new_dataTypeBuffer): new_dataTypeBuffer(new_dataTypeBuffer){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
// Free buffer on re-connection
|
||||
// Check Byte size first!!!
|
||||
|
||||
bool allocateMemory=false ;
|
||||
|
||||
|
||||
if(c.dataBuffer==NULL) {
|
||||
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
else if ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) > c.channelRequestMetaData.getByteSize() ) {
|
||||
cout << "dataBuffer already exists= " << c.dataBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << endl;
|
||||
cout << "Freeing and reallocating dataBuffer" << endl;
|
||||
|
||||
cout << dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) << " VERSUS "
|
||||
<< c.channelRequestMetaData.getByteSize() << endl;
|
||||
free(c.dataBuffer);
|
||||
allocateMemory=true;
|
||||
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
//cout << "sizeof c.dataBuffer " << dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) << endl;
|
||||
c.dataBuffer = (db_access_val *) malloc ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) );
|
||||
c.channelRequestMetaData.byteSize=dbr_size_n(new_dataTypeBuffer,c.channelRequestMetaData.getNelem());
|
||||
|
||||
}
|
||||
|
||||
if (c.dataBuffer==NULL){
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
chtype new_dataTypeBuffer;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to CAFEConduit/CAFEGroup - releases resources
|
||||
*/
|
||||
struct free_dataBuffers
|
||||
{
|
||||
free_dataBuffers (){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
//cout << "c.handle=" << c.handle << " " << c.pv << endl;
|
||||
|
||||
if(c.dataBuffer) {
|
||||
free(c.dataBuffer); // _TIME data buffer for ca_get
|
||||
}
|
||||
|
||||
if(c.ctrlBuffer) {
|
||||
free(c.ctrlBuffer); // _CTRL data buffer for ca_get
|
||||
}
|
||||
|
||||
if(c.stsackBuffer) {
|
||||
free(c.stsackBuffer); // _STSACK_STRING data buffer for ca_get
|
||||
}
|
||||
|
||||
if(c.putBuffer) {
|
||||
free(c.putBuffer); // data buffer for ca_put
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // CONDUITCONNECTIONHANDLERARGS_H
|
||||
1190
include/conduitEventHandlerArgs.h
Normal file
1190
include/conduitEventHandlerArgs.h
Normal file
File diff suppressed because it is too large
Load Diff
794
include/conduitFriends.h
Normal file
794
include/conduitFriends.h
Normal file
@@ -0,0 +1,794 @@
|
||||
///
|
||||
/// \file conduitFriends.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date November 2014
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CONDUITFRIENDS_H
|
||||
#define CONDUITFRIENDS_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <conduit.h>
|
||||
#include <statusCodes.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to STS recorded in hash table
|
||||
*/
|
||||
struct change_alarmStatus
|
||||
{
|
||||
change_alarmStatus (const dbr_short_t & new_alarmStatus): new_alarmStatus(new_alarmStatus){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
c.alarmStatus = new_alarmStatus;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
private:
|
||||
dbr_short_t new_alarmStatus;
|
||||
};
|
||||
struct change_alarmSeverity
|
||||
{
|
||||
change_alarmSeverity (const dbr_short_t & new_alarmSeverity): new_alarmSeverity(new_alarmSeverity){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
c.alarmSeverity = new_alarmSeverity;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
private:
|
||||
dbr_short_t new_alarmSeverity;
|
||||
};
|
||||
struct change_epicsTimeStamp
|
||||
{
|
||||
change_epicsTimeStamp (const epicsTimeStamp & new_epicsTimeStamp): new_epicsTimeStamp(new_epicsTimeStamp){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
c.ts = new_epicsTimeStamp;
|
||||
//Do this to prevent overflow error in epicsTime time(ts) routines!
|
||||
//This bad number can occur in timeouts
|
||||
if(c.ts.nsec>1000000000) {c.ts.nsec=0;}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
private:
|
||||
epicsTimeStamp new_epicsTimeStamp;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
|
||||
*/
|
||||
struct change_accessRead
|
||||
{
|
||||
change_accessRead (const unsigned int & new_accessRead): new_accessRead(new_accessRead){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
c.channelRegalia.accessRead = new_accessRead;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int new_accessRead;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
|
||||
*/
|
||||
struct change_accessWrite
|
||||
{
|
||||
change_accessWrite (const unsigned int & new_accessWrite): new_accessWrite(new_accessWrite){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
c.channelRegalia.accessWrite = new_accessWrite;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int new_accessWrite;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend toConduit/CAFEGroup permitting the access_rights_handler_args struct from callback fns
|
||||
* to be recorded in hash table
|
||||
*/
|
||||
struct change_accessRightsHandlerArgs
|
||||
{
|
||||
change_accessRightsHandlerArgs (const struct access_rights_handler_args & new_accessRightsHandlerArgs):
|
||||
new_accessRightsHandlerArgs(new_accessRightsHandlerArgs){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
c.channelRegalia.accessRead = new_accessRightsHandlerArgs.ar.read_access;
|
||||
c.channelRegalia.accessWrite= new_accessRightsHandlerArgs.ar.write_access;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
private:
|
||||
access_rights_handler_args new_accessRightsHandlerArgs;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
|
||||
*/
|
||||
struct change_channelDeviceAttribute
|
||||
{
|
||||
change_channelDeviceAttribute (const ChannelDeviceAttribute & new_channelDeviceAttribute):
|
||||
new_channelDeviceAttribute(new_channelDeviceAttribute){}
|
||||
|
||||
void operator() (Conduit& c) {c.channelDeviceAttribute = new_channelDeviceAttribute;}
|
||||
|
||||
private:
|
||||
ChannelDeviceAttribute new_channelDeviceAttribute;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup records the channelID in hash table
|
||||
*/
|
||||
struct change_channelID
|
||||
{
|
||||
change_channelID (const chid & new_channelID): new_channelID(new_channelID){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
c.channelRegalia.channelID=new_channelID;
|
||||
c.channelID=new_channelID;
|
||||
}
|
||||
|
||||
private:
|
||||
chid new_channelID;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelGetActionWhenMonitorPolicy in hash table
|
||||
*/
|
||||
struct change_channelGetActionWhenMonitorPolicy
|
||||
{
|
||||
change_channelGetActionWhenMonitorPolicy (
|
||||
const ChannelGetActionWhenMonitorPolicy & new_channelGetActionWhenMonitorPolicy):
|
||||
new_channelGetActionWhenMonitorPolicy(new_channelGetActionWhenMonitorPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
c.channelGetActionWhenMonitorPolicy = new_channelGetActionWhenMonitorPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelGetActionWhenMonitorPolicy new_channelGetActionWhenMonitorPolicy;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelGetCacheWaitPolicy in hash table
|
||||
*/
|
||||
struct change_channelGetCacheWaitPolicy
|
||||
{
|
||||
change_channelGetCacheWaitPolicy (
|
||||
const ChannelGetCacheWaitPolicy & new_channelGetCacheWaitPolicy):
|
||||
new_channelGetCacheWaitPolicy(new_channelGetCacheWaitPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
c.channelGetCacheWaitPolicy = new_channelGetCacheWaitPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelGetCacheWaitPolicy new_channelGetCacheWaitPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting hasNewData flag to be set in hash table
|
||||
*/
|
||||
struct change_hasNewData
|
||||
{
|
||||
change_hasNewData (const bool & new_hasNewData): new_hasNewData(new_hasNewData){}
|
||||
|
||||
void operator() (Conduit& c) {c.hasNewData = new_hasNewData;}
|
||||
|
||||
private:
|
||||
bool new_hasNewData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
|
||||
*/
|
||||
struct change_channelRegalia
|
||||
{
|
||||
change_channelRegalia (const ChannelRegalia & new_channelRegalia): new_channelRegalia(new_channelRegalia){}
|
||||
|
||||
void operator() (Conduit& c) {c.channelRegalia = new_channelRegalia;}
|
||||
|
||||
private:
|
||||
ChannelRegalia new_channelRegalia;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestDataTypePolicy in hash table
|
||||
*/
|
||||
struct change_channelRequestDataTypePolicy
|
||||
{
|
||||
change_channelRequestDataTypePolicy (
|
||||
const ChannelRequestDataTypePolicy & new_channelRequestDataTypePolicy):
|
||||
new_channelRequestDataTypePolicy(new_channelRequestDataTypePolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
c.channelRequestDataTypePolicy = new_channelRequestDataTypePolicy;
|
||||
}
|
||||
private:
|
||||
ChannelRequestDataTypePolicy new_channelRequestDataTypePolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaCtrl in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaCtrl
|
||||
{
|
||||
change_channelRequestMetaCtrl (const ChannelRequestMetaData & new_channelData):
|
||||
new_channelData(new_channelData){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
c.channelRequestMetaCtrl = new_channelData;
|
||||
}
|
||||
private:
|
||||
ChannelRequestMetaData new_channelData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaCtrlClient in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaCtrlClient
|
||||
{
|
||||
change_channelRequestMetaCtrlClient (const ChannelRequestMetaDataClient & new_channelData):
|
||||
new_channelData(new_channelData){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
c.channelRequestMetaCtrlClient = new_channelData;
|
||||
|
||||
}
|
||||
private:
|
||||
ChannelRequestMetaDataClient new_channelData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaData in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaData
|
||||
{
|
||||
change_channelRequestMetaData (const ChannelRequestMetaData & new_channelData):
|
||||
new_channelData(new_channelData){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
|
||||
c.channelRequestMetaData = new_channelData;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
ChannelRequestMetaData new_channelData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaDataClient in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaDataClient
|
||||
{
|
||||
change_channelRequestMetaDataClient (const ChannelRequestMetaDataClient & new_channelData):
|
||||
new_channelData(new_channelData){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
|
||||
c.channelRequestMetaDataClient = new_channelData;
|
||||
}
|
||||
private:
|
||||
ChannelRequestMetaDataClient new_channelData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaPrimitive in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaPrimitive
|
||||
{
|
||||
change_channelRequestMetaPrimitive (const ChannelRequestMetaData & new_channelData):
|
||||
new_channelData(new_channelData){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//
|
||||
c.channelRequestMetaPrimitive = new_channelData;
|
||||
}
|
||||
private:
|
||||
ChannelRequestMetaData new_channelData;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestPolicyGet in hash table
|
||||
*/
|
||||
struct change_channelRequestPolicyGet
|
||||
{
|
||||
change_channelRequestPolicyGet (const ChannelRequestPolicy & new_ChannelRequestPolicy):
|
||||
new_ChannelRequestPolicy(new_ChannelRequestPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelRequestPolicyGet = new_ChannelRequestPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelRequestPolicy new_ChannelRequestPolicy;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestPolicyGetCtrl in hash table
|
||||
*/
|
||||
struct change_channelRequestPolicyGetCtrl
|
||||
{
|
||||
change_channelRequestPolicyGetCtrl (const ChannelRequestPolicy & new_ChannelRequestPolicy):
|
||||
new_ChannelRequestPolicy(new_ChannelRequestPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelRequestPolicyGetCtrl = new_ChannelRequestPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelRequestPolicy new_ChannelRequestPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestPolicyPut in hash table
|
||||
*/
|
||||
struct change_channelRequestPolicyPut
|
||||
{
|
||||
change_channelRequestPolicyPut (const ChannelRequestPolicy & new_ChannelRequestPolicy):
|
||||
new_ChannelRequestPolicy(new_ChannelRequestPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelRequestPolicyPut = new_ChannelRequestPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelRequestPolicy new_ChannelRequestPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGet in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGet
|
||||
{
|
||||
change_channelRequestStatusGet (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
|
||||
c.channelRequestStatusGet = new_ChannelRequestStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
ChannelRequestStatus new_ChannelRequestStatus;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGetCtrl in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGetCtrl
|
||||
{
|
||||
change_channelRequestStatusGetCtrl (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelRequestStatusGetCtrl = new_ChannelRequestStatus;
|
||||
}
|
||||
private:
|
||||
ChannelRequestStatus new_ChannelRequestStatus;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGetSTSACK in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGetSTSACK
|
||||
{
|
||||
change_channelRequestStatusGetSTSACK (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelRequestStatusGetSTSACK = new_ChannelRequestStatus;
|
||||
}
|
||||
private:
|
||||
ChannelRequestStatus new_ChannelRequestStatus;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGetClassName in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGetClassName
|
||||
{
|
||||
change_channelRequestStatusGetClassName (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelRequestStatusGetClassName = new_ChannelRequestStatus;
|
||||
}
|
||||
private:
|
||||
ChannelRequestStatus new_ChannelRequestStatus;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusPut in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusPut
|
||||
{
|
||||
change_channelRequestStatusPut (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelRequestStatusPut = new_ChannelRequestStatus;
|
||||
}
|
||||
private:
|
||||
ChannelRequestStatus new_ChannelRequestStatus;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelTimeoutPolicyGet in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicyGet
|
||||
{
|
||||
change_channelTimeoutPolicyGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelTimeoutPolicyGet = new_channelTimeoutPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelTimeoutPolicy new_channelTimeoutPolicy;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit records the channelTimeoutPolicyPut in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicyPut
|
||||
{
|
||||
change_channelTimeoutPolicyPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
//This does a deep copy!
|
||||
c.channelTimeoutPolicyPut = new_channelTimeoutPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelTimeoutPolicy new_channelTimeoutPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast modification to vector<string> monitorAction
|
||||
* (for CAFE Extensions)
|
||||
*/
|
||||
struct change_monitorAction
|
||||
{
|
||||
change_monitorAction (string &new_monitorAction): new_monitorAction(new_monitorAction){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
c.monitorAction.push_back(new_monitorAction);
|
||||
}
|
||||
private:
|
||||
string new_monitorAction;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast removal of all elements in vector<string> monitorAction
|
||||
* (for CAFE Extensions)
|
||||
*/
|
||||
struct change_monitorActionClear
|
||||
{
|
||||
change_monitorActionClear (){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
c.monitorAction.clear();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast removal of an entry in vector<string> monitorAction
|
||||
* (for CAFE Extensions)
|
||||
*/
|
||||
struct change_monitorActionErase
|
||||
{
|
||||
change_monitorActionErase (string &new_monitorAction): new_monitorAction(new_monitorAction){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
bool maFound=false;
|
||||
vector<string>::iterator it;
|
||||
|
||||
|
||||
for (it = c.monitorAction.begin(); it != c.monitorAction.end(); ) {
|
||||
if( (*it)==new_monitorAction) {
|
||||
it = c.monitorAction.erase(it);
|
||||
maFound=true;
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (!maFound) {
|
||||
cout << "monitorAction " << new_monitorAction << " NOT FOUND! " << endl;
|
||||
cout << "Could not delete entry!" << endl;
|
||||
}
|
||||
|
||||
}
|
||||
private:
|
||||
string new_monitorAction;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast removal of an entry in the monitorPolicy vector
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyErase
|
||||
{
|
||||
change_monitorPolicyErase (unsigned int & new_evid): new_evid(new_evid){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
bool evidFound=false;
|
||||
vector<MonitorPolicy>::iterator it;
|
||||
//Iterate
|
||||
for (it = c.mpV.begin(); it != c.mpV.end();) {
|
||||
//cout << "ID " << (*it).getID() << " " << endl;
|
||||
|
||||
if ( (*it).getID()==new_evid) {
|
||||
evidFound=true;
|
||||
it=(c.mpV).erase(it);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (!evidFound) {
|
||||
cout << "evid " << new_evid << " NOT FOUND! " << endl;
|
||||
cout << "Could not delete entry!" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int new_evid;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast insertion into the monitorPolicy vector
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyInsert
|
||||
{
|
||||
change_monitorPolicyInsert (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
|
||||
//insert into mpV
|
||||
(c.mpV).push_back(new_monitorPolicy);
|
||||
|
||||
if (c.mpV.size()>(MAX_NO_MONITORS_PER_CHANNEL/2)) {
|
||||
cout << "HEY DUDE - YOU NOW HAVE " << c.mpV.size() << " MONITORS " << endl;
|
||||
cout << "for channel " << c.pv << " with handle " << c.handle << endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
class MonitorPolicy new_monitorPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast removal of an entry in the monitorPolicyInWaiting vector
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyInWaitingErase
|
||||
{
|
||||
change_monitorPolicyInWaitingErase (unsigned int & new_evid): new_evid(new_evid){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
bool evidFound=false;
|
||||
vector<MonitorPolicy>::iterator it;
|
||||
//Iterate
|
||||
for (it = c.mpInWaitingV.begin(); it != c.mpInWaitingV.end(); ++it) {
|
||||
|
||||
if ( (*it).getID()==new_evid) {
|
||||
evidFound=true;
|
||||
(c.mpInWaitingV).erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!evidFound) {
|
||||
cout << "evid " << new_evid << " NOT FOUND! " << endl;
|
||||
cout << "Could not delete entry!" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int new_evid;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast insertion into the monitorPolicyInWaiting vector
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyInWaitingInsert
|
||||
{
|
||||
change_monitorPolicyInWaitingInsert (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
|
||||
//insert into mpnWaitingV
|
||||
(c.mpInWaitingV).push_back(new_monitorPolicy);
|
||||
|
||||
if (c.mpInWaitingV.size()>6) {
|
||||
cout << "HEY DUDE - YOU NOW HAVE " << c.mpInWaitingV.size()
|
||||
<< " MONITORS IN WAITING" << endl;
|
||||
cout << "for channel " << c.pv << " with handle " << c.handle << endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
class MonitorPolicy new_monitorPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to pvAlias in hash table
|
||||
*/
|
||||
struct change_pvAlias
|
||||
{
|
||||
change_pvAlias (const char * & new_pvAlias): new_pvAlias(new_pvAlias){}
|
||||
|
||||
void operator() (Conduit& c) {
|
||||
c.pvAlias = new_pvAlias;
|
||||
//No longer supporting c,pvd
|
||||
///strcpy(c.pvd.pvAlias, new_pvAlias);
|
||||
//strcpy(c.pvc.pvAlias, new_pvAlias);
|
||||
}
|
||||
|
||||
private:
|
||||
const char * new_pvAlias;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting pyCafeFlag flag to be set in hash table
|
||||
*
|
||||
struct change_pyCafeFlag
|
||||
{
|
||||
change_pyCafeFlag (const bool & new_pyCafeFlag): new_pyCafeFlag(new_pyCafeFlag){}
|
||||
|
||||
void operator() (Conduit& c) {c.pyCafeFlag = new_pyCafeFlag;}
|
||||
|
||||
private:
|
||||
bool new_pyCafeFlag;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to the status as given by the last method invocation
|
||||
*/
|
||||
struct change_status
|
||||
{
|
||||
change_status (const int & new_status): new_status(new_status){}
|
||||
void operator() (Conduit& c) {c.status = new_status;}
|
||||
|
||||
private:
|
||||
int new_status;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to the usrArgs as given by the last method invocation
|
||||
*/
|
||||
struct change_usrArgs
|
||||
{
|
||||
change_usrArgs (const unsigned int & new_usrArgs): new_usrArgs(new_usrArgs){}
|
||||
void operator() (Conduit& c) {c.usrArgs = (void *) new_usrArgs;}
|
||||
|
||||
private:
|
||||
unsigned int new_usrArgs;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* friend to Conduit/CAFEGroup permitting the groupHandle to which the channel belongs to be recorded in hash table
|
||||
*/
|
||||
struct change_groupHandle
|
||||
{
|
||||
change_groupHandle (const unsigned int & new_groupHandle): new_groupHandle(new_groupHandle){}
|
||||
|
||||
void operator() (Conduit& c) {c.groupHandle = new_groupHandle;}
|
||||
|
||||
private:
|
||||
unsigned int new_groupHandle;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // CONDUITFRIENDS_H
|
||||
171
include/conduitGroup.h
Normal file
171
include/conduitGroup.h
Normal file
@@ -0,0 +1,171 @@
|
||||
///
|
||||
/// \file conduitGroup.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CONDUITGROUP_H
|
||||
#define CONDUITGROUP_H
|
||||
|
||||
#include <iostream>
|
||||
#include <cadef.h>
|
||||
|
||||
#include <hashConduit.h>
|
||||
#include <statusCodes.h>
|
||||
|
||||
|
||||
/**
|
||||
* Principal constructor has:\n
|
||||
* \param _groupName assigned group name
|
||||
* \param _ccc ca_client_context
|
||||
* \param _groupID unique group identifier (CA_SYNC_GID)
|
||||
* \param _nMember number of members in group
|
||||
* \param _memberCC CAFEConduit object representing each group member
|
||||
* \param _groupStatus groupStatus: error indicates >0 members have an error
|
||||
*/
|
||||
class ConduitGroup
|
||||
{
|
||||
friend struct change_channelTimeoutPolicySGPut;
|
||||
friend struct change_channelTimeoutPolicySGGet;
|
||||
friend struct change_timeout_sg_pend_io;
|
||||
friend struct change_sg_rule;
|
||||
friend class Connect;
|
||||
|
||||
private:
|
||||
static unsigned int groupHandleNext;
|
||||
unsigned int nMember;
|
||||
ca_client_context * ccc;
|
||||
|
||||
double timeout_sg_pend_io;
|
||||
|
||||
ChannelTimeoutPolicy channelTimeoutPolicySGGet;
|
||||
ChannelTimeoutPolicy channelTimeoutPolicySGPut;
|
||||
|
||||
union db_access_val ** dataBuffer;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const ConduitGroup& e)
|
||||
{
|
||||
os<< "handle=" << e.groupHandle<<" name=" << e.groupName<< " nMember=" << e.nMember << std::endl;
|
||||
return os;
|
||||
};
|
||||
|
||||
public:
|
||||
std::string groupName;
|
||||
unsigned int groupHandle;
|
||||
CA_SYNC_GID groupID;
|
||||
|
||||
int * mStatus;
|
||||
bool * mRule;
|
||||
|
||||
unsigned int * mHandle;
|
||||
|
||||
virtual ~ConduitGroup();
|
||||
|
||||
ConduitGroup();
|
||||
ConduitGroup(const char * _groupName, ca_client_context * _ccc, CA_SYNC_GID _groupID,
|
||||
unsigned int _nMember, unsigned int * _handle);
|
||||
|
||||
int get(void) const;
|
||||
int put(void) const;
|
||||
|
||||
ca_client_context * getClientContext(void) const {return ccc;};
|
||||
const char * getGroupName(void) const {return groupName.c_str();};
|
||||
string getGroupNameAsString(void) const {return groupName;};
|
||||
CA_SYNC_GID getGroupID(void) const {return groupID;};
|
||||
unsigned int getNMember(void) const {return nMember;};
|
||||
int * getStatus(void) const {return mStatus;};
|
||||
bool * getRule(void) const {return mRule;};
|
||||
bool getRule(unsigned int i) const {return mRule[i];};
|
||||
unsigned int getGroupHandle(void) const {return groupHandle;};
|
||||
ChannelTimeoutPolicy getChannelTimeoutPolicySGPut(void) const {return channelTimeoutPolicySGPut;};
|
||||
ChannelTimeoutPolicy getChannelTimeoutPolicySGGet(void) const {return channelTimeoutPolicySGGet;};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to ConduitGroup permitting fast modification of the rule in group hash table;
|
||||
* the rule flag only functions within a PVGroup
|
||||
*/
|
||||
struct change_sg_rule
|
||||
{
|
||||
change_sg_rule (const bool & new_rule, const unsigned int & iMember):
|
||||
new_rule(new_rule),iMember(iMember){}
|
||||
|
||||
void operator() (ConduitGroup& g) {g.mRule[iMember] = new_rule;}
|
||||
|
||||
private:
|
||||
bool new_rule;
|
||||
unsigned int iMember;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to ConduitGroup permitting fast modification of status in group hash table;
|
||||
*/
|
||||
struct change_sg_status
|
||||
{
|
||||
change_sg_status (const int & new_status, const unsigned int & iMember):
|
||||
new_status(new_status),iMember(iMember){}
|
||||
|
||||
void operator() (ConduitGroup& g) {
|
||||
g.mStatus[iMember] = new_status;
|
||||
}
|
||||
|
||||
private:
|
||||
int new_status;
|
||||
unsigned int iMember;
|
||||
};
|
||||
|
||||
/**
|
||||
* friend to ConduitGroup permitting fast modification to \n
|
||||
* the timeout_sg_pend_event period recorded in ConduitGroup hash table
|
||||
*/
|
||||
struct change_timeout_sg_pend_io
|
||||
{
|
||||
change_timeout_sg_pend_io (const double & new_timeout_sg_pend_io):
|
||||
new_timeout_sg_pend_io(new_timeout_sg_pend_io){}
|
||||
void operator() (ConduitGroup& g) {g.timeout_sg_pend_io = new_timeout_sg_pend_io;}
|
||||
|
||||
private:
|
||||
double new_timeout_sg_pend_io;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to ConduitGroup records the channelTimeoutPolicySGGet in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicySGGet
|
||||
{
|
||||
change_channelTimeoutPolicySGGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
|
||||
|
||||
void operator() (ConduitGroup & g) {
|
||||
//This does a deep copy!
|
||||
g.channelTimeoutPolicySGGet = new_channelTimeoutPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelTimeoutPolicy new_channelTimeoutPolicy;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to ConduitGroup records the channelTimeoutPolicySGPut in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicySGPut
|
||||
{
|
||||
change_channelTimeoutPolicySGPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
|
||||
|
||||
void operator() (ConduitGroup & g) {
|
||||
//This does a deep copy!
|
||||
g.channelTimeoutPolicySGPut = new_channelTimeoutPolicy;
|
||||
}
|
||||
private:
|
||||
ChannelTimeoutPolicy new_channelTimeoutPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
594
include/connect.h
Normal file
594
include/connect.h
Normal file
@@ -0,0 +1,594 @@
|
||||
///
|
||||
/// \file connect.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release February: 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef CONNECT_H
|
||||
#define CONNECT_H
|
||||
|
||||
// generated by autotools
|
||||
#include <config.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <climits>
|
||||
|
||||
#include <global.h>
|
||||
|
||||
#include <exceptionsHelper.h>
|
||||
#include <handleHelper.h>
|
||||
#include <policyHelper.h>
|
||||
#include <hashConduitGroup.h>
|
||||
|
||||
#if HAVE_BOOST_THREAD
|
||||
#include <boost/thread/thread_only.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
class Connect
|
||||
{
|
||||
protected:
|
||||
int status;
|
||||
CAFEStatus cafeStatus;
|
||||
CAFEStatusSeverity cafeStatusSeverity;
|
||||
|
||||
cafeConduit_set::iterator itcs;
|
||||
cafeGroup_set::iterator itgs;
|
||||
|
||||
CAFEDataTypeCode cafeDataTypeCode;
|
||||
|
||||
ExceptionsHelper exceptionsHelper;
|
||||
|
||||
ChannelCreatePolicy channelCreatePolicy;
|
||||
|
||||
PolicyHelper policyHelper;
|
||||
HandleHelper handleHelper;
|
||||
Helper helper;
|
||||
|
||||
std::string deviceAttributeDeliminator;
|
||||
|
||||
bool pyCafeFlag;
|
||||
|
||||
//connectCallbacks.cc
|
||||
static void callbackHandlerAccessRights(struct access_rights_handler_args args);
|
||||
|
||||
static void callbackHandlerException (struct exception_handler_args args);
|
||||
|
||||
//connect.cpp
|
||||
int createChannel(unsigned int handle, const char * pv, chid &pCh);
|
||||
int createHandle(const char * pv, ca_client_context * ccc, unsigned int &handle)
|
||||
//int createHandle(const char * pv, ca_client_context * ccc, ChannelRequestPolicy channelRequestPolicyPut, unsigned int &handle)
|
||||
throw (CAFEException_pv);
|
||||
|
||||
int contextDestroy();
|
||||
int contextDestroy(ca_client_context * cctLocal);
|
||||
|
||||
unsigned short epicsVersion(unsigned short & major, unsigned short & minor, unsigned short & patch);
|
||||
|
||||
//group functions
|
||||
|
||||
int createChannelWithinGroup(unsigned int handle, const char * pv, chid &pCh);
|
||||
int createHandleWithinGroup(const char * pv, ca_client_context * ccc, unsigned int & _handle)
|
||||
throw (CAFEException_pv);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Connect(){
|
||||
|
||||
channelMonitorPolicy.setPolicy(
|
||||
(ChannelWhenToFlushSendBufferPolicyKind) CAFENUM::FLUSH_AFTER_EACH_CHANNEL_SUBSCRIPTION,
|
||||
CAFENUM::WITH_FLUSH_IO, DEFAULT_TIMEOUT_PEND_IO);
|
||||
|
||||
channelOpenGroupPolicy.setPolicy(
|
||||
CAFENUM::FLUSH_AFTER_EACH_GROUP_CREATION,
|
||||
CAFENUM::WITH_PEND_EVENT, DEFAULT_TIMEOUT_SG_PEND_EVENT);
|
||||
|
||||
channelOpenPolicy.setPolicy(
|
||||
CAFENUM::FLUSH_AFTER_EACH_CHANNEL_CREATION,
|
||||
CAFENUM::WITH_PEND_EVENT, DEFAULT_TIMEOUT_PEND_EVENT);
|
||||
|
||||
deviceAttributeDeliminator=DEFAULT_DEVICE_ATTRIBUTE_DELIMINATOR;
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
pyCafeFlag=true;
|
||||
#else
|
||||
pyCafeFlag=false;
|
||||
#endif
|
||||
};
|
||||
|
||||
//these need to be public
|
||||
|
||||
PrintErrorPolicy printErrorPolicy;
|
||||
|
||||
ChannelOpenPolicy channelOpenPolicy;
|
||||
ChannelOpenPolicy channelClosePolicy; //can also use for close
|
||||
ChannelOpenPolicy channelMonitorPolicy;
|
||||
ChannelOpenPolicy channelOpenGroupPolicy;
|
||||
|
||||
|
||||
//28 May 2017
|
||||
ChannelRequestPolicy channelRequestPolicyMasterPut;
|
||||
ChannelRequestPolicy channelRequestPolicyMasterGet;
|
||||
ChannelRequestPolicy channelRequestPolicyMasterGetCtrl;
|
||||
ChannelGetActionWhenMonitorPolicy channelGetActionWhenMonitorPolicyMaster;
|
||||
|
||||
//ChannelOpenPolicy getChannelOpenPolicy(){return channelOpenPolicy;}
|
||||
//ChannelOpenPolicy getChannelClosePolicy(){return channelClosePolicy;}
|
||||
//ChannelOpenPolicy getChannelMonitorPolicy(){return channelMonitorPolicy;}
|
||||
//ChannelOpenPolicy getChannelOpenGroupPolicy(){return channelOpenGroupPolicy;}
|
||||
|
||||
HandleHelper getHandleHelper() {return handleHelper;}
|
||||
HandleHelper getInfo() {return handleHelper;}
|
||||
PolicyHelper getPolicyHelper() {return policyHelper;}
|
||||
PolicyHelper getPolicy() {return policyHelper;}
|
||||
|
||||
unsigned int getNelemClient(unsigned int h){ return handleHelper.getNelemClient(h);}
|
||||
unsigned int getNelemNative(unsigned int h){ return handleHelper.getNelemNative(h);}
|
||||
unsigned int getNelemRequest(unsigned int h){ return handleHelper.getNelemRequest(h);}
|
||||
|
||||
int getStatus() {return status;}
|
||||
|
||||
CAFEStatus getCafeStatus() {return cafeStatus;}
|
||||
CAFEStatusSeverity getCafeStatusSeverity() {return cafeStatusSeverity;}
|
||||
|
||||
int flushNow() {return ca_flush_io();}
|
||||
|
||||
int _ca_flush_io(){return ca_flush_io();}
|
||||
int _ca_poll(){return ca_poll();}
|
||||
int _ca_pend_io(double t){return ca_pend_io(t);}
|
||||
int _ca_pend_event(double t){return ca_pend_event(t);}
|
||||
|
||||
//connect.cc
|
||||
bool setPyCafe(bool b){return pyCafeFlag=b;};
|
||||
bool getPyCafe(){return pyCafeFlag;} ;
|
||||
int init() throw (CAFEException_init);
|
||||
int init(ca_preemptive_callback_select select) throw (CAFEException_init);
|
||||
|
||||
//std::string
|
||||
int open(const string pvS, unsigned int &handle) throw (CAFEException_open){
|
||||
try { open (pvS.c_str(), handle);} catch(CAFEException_open &e) {throw e;};
|
||||
}
|
||||
int open(const string pvS, const std::string pvAliasS, unsigned int &handle)
|
||||
throw (CAFEException_open){
|
||||
try { open (pvS.c_str(), pvAliasS.c_str(), handle);} catch(CAFEException_open &e) {throw e;};
|
||||
}
|
||||
int open(const string *pvArrayS, unsigned int *handleArray, const unsigned int nHandles)
|
||||
throw (CAFEException_open);
|
||||
|
||||
//const char *pv
|
||||
int open(const char *pv, unsigned int &handle) throw (CAFEException_open);
|
||||
int open(const char *pv, const char *pvAlias, unsigned int &handle)
|
||||
throw (CAFEException_open);
|
||||
|
||||
int open(const char **pvArray, unsigned int *handleArray, const unsigned int nHandles)
|
||||
throw (CAFEException_open);
|
||||
int open(vector<const char *>, vector<unsigned int> &) throw (CAFEException_open);
|
||||
int open(vector<string>, vector<unsigned int> &) throw (CAFEException_open);
|
||||
|
||||
int openV(vector<string> s, vector<unsigned int> &i) throw (CAFEException_open)
|
||||
{return open(s,i); };
|
||||
|
||||
|
||||
//################################################################################
|
||||
|
||||
|
||||
void openGroupPrepare(){
|
||||
channelOpenGroupPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
|
||||
channelOpenGroupPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
|
||||
return;
|
||||
}
|
||||
|
||||
void openMonitorPrepare(){
|
||||
channelMonitorPolicy.setFlushSendBufferKind(WITH_FLUSH_IO);
|
||||
channelMonitorPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
|
||||
return;
|
||||
}
|
||||
|
||||
double setOpenDefaultPendTime(double _timeout){
|
||||
return channelOpenPolicy.setDefaultTimeout(_timeout);
|
||||
}
|
||||
|
||||
double getOpenDefaultPendTime(){
|
||||
return channelOpenPolicy.getDefaultTimeout();
|
||||
}
|
||||
|
||||
|
||||
void openGroupNowAndWait(double _timeout){
|
||||
double dto = channelOpenGroupPolicy.getTimeout();
|
||||
channelOpenGroupPolicy.setTimeout(_timeout);
|
||||
channelOpenGroupPolicy.flushSendBufferNow();
|
||||
//
|
||||
//reset
|
||||
channelOpenGroupPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
|
||||
channelOpenGroupPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
|
||||
//channelOpenGroupPolicy.setTimeoutToDefault();
|
||||
channelOpenGroupPolicy.setTimeout(dto);
|
||||
return;
|
||||
}
|
||||
|
||||
void openMonitorNow(){
|
||||
channelMonitorPolicy.flushSendBufferNow();
|
||||
//reset
|
||||
channelMonitorPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
|
||||
channelMonitorPolicy.setFlushSendBufferKind(WITH_FLUSH_IO);
|
||||
return;
|
||||
}
|
||||
|
||||
void openMonitorNowAndWait(double _timeout){
|
||||
channelMonitorPolicy.setTimeout(_timeout);
|
||||
channelMonitorPolicy.flushSendBufferNow();
|
||||
//reset
|
||||
channelMonitorPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
|
||||
channelMonitorPolicy.setFlushSendBufferKind(WITH_FLUSH_IO);
|
||||
return;
|
||||
}
|
||||
|
||||
void openPrepare() {
|
||||
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
|
||||
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
|
||||
return;
|
||||
}
|
||||
|
||||
void openNowAndWait(double _timeout) {
|
||||
double dto = channelOpenPolicy.getTimeout();
|
||||
channelOpenPolicy.setTimeout(_timeout);
|
||||
channelOpenPolicy.flushSendBufferNow();
|
||||
//reset
|
||||
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
|
||||
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
|
||||
//channelOpenPolicy.setTimeoutToDefault();
|
||||
channelOpenPolicy.setTimeout(dto);
|
||||
return;
|
||||
}
|
||||
|
||||
void openNow() {
|
||||
channelOpenPolicy.flushSendBufferNow();
|
||||
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
|
||||
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
|
||||
return;
|
||||
}
|
||||
|
||||
void openNoWait(){
|
||||
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
|
||||
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
|
||||
return;
|
||||
}
|
||||
|
||||
bool initCallbackComplete(vector<unsigned int> hV) {
|
||||
return initCallbackComplete(&hV[0], hV.size());
|
||||
}
|
||||
|
||||
bool initCallbackComplete(unsigned int * hArray, unsigned int nelem);
|
||||
|
||||
|
||||
|
||||
//#################################################################################
|
||||
|
||||
unsigned int printHandle(unsigned int h){return handleHelper.printHandle(h);};
|
||||
unsigned int printHandles(void){return handleHelper.printHandles();};
|
||||
unsigned int printDisconnectedHandles(void){return handleHelper.printDisconnectedHandles();};
|
||||
unsigned int getDisconnectedHandles(vector<unsigned int> &dhV, vector<string> &pvV)
|
||||
{return handleHelper.getDisconnectedHandles(dhV, pvV);};
|
||||
|
||||
|
||||
void printCAFEException_pv(CAFEException_pv & e){exceptionsHelper.printCAFEException_pv(e);};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//closeChannel(s) only close within a context
|
||||
int closeChannels(unsigned int * handleArray, unsigned int nHandles);
|
||||
int closeChannels(vector<unsigned int> v){
|
||||
|
||||
//unsigned int * handleArray = new unsigned int[v.size()];
|
||||
//int status= closeChannels(handleArray, v.size());
|
||||
//delete [] handleArray;
|
||||
//return status;
|
||||
return closeChannels(&v[0], v.size());
|
||||
};
|
||||
int closeChannelsV(vector<unsigned int> v){
|
||||
//unsigned int * handleArray = new unsigned int[v.size()];
|
||||
//int status= closeChannels(handleArray, v.size());
|
||||
//delete [] handleArray;
|
||||
//return status;
|
||||
return closeChannels(&v[0], v.size());
|
||||
};
|
||||
|
||||
|
||||
int close(unsigned int handle);
|
||||
int closeChannel(unsigned int handle){return close(handle);};
|
||||
int closeChannels();
|
||||
int closeChannels(ca_client_context * cctLocal);
|
||||
int close(){return closeChannels();};
|
||||
|
||||
//closeHandle(s) close regardless of context
|
||||
int closeHandlesV(vector<unsigned int> v){ return closeHandles(&v[0], v.size());}
|
||||
int closeHandles (vector<unsigned int> v){ return closeHandles(&v[0], v.size());}
|
||||
|
||||
|
||||
int closeHandles(unsigned int * handleArray, unsigned int nHandles);
|
||||
int closeHandle(unsigned int handle);
|
||||
int closeHandles();
|
||||
|
||||
// Monitors
|
||||
int monitorStart(unsigned int handle, MonitorPolicy &mp);
|
||||
int monitorStart(unsigned int handle, unsigned int & monitorID);
|
||||
int monitorStart(unsigned int handle) {
|
||||
unsigned int monitorID; return monitorStart(handle, monitorID);
|
||||
}
|
||||
|
||||
int monitorStop (unsigned int handle, MonitorPolicy mp);
|
||||
int monitorStop (unsigned int handle, unsigned int monitorID);
|
||||
int monitorStopWithID (unsigned int handle, unsigned int monitorID){
|
||||
return monitorStop(handle, monitorID);}
|
||||
int monitorStop (unsigned int handle); //stop all monitors for this handle
|
||||
int monitorStop ();
|
||||
int monitorStopAll (){return monitorStop();};
|
||||
int monitorStop (ca_client_context * ccc);
|
||||
|
||||
// Monitors for arrays and vectors
|
||||
int monitorStart(unsigned int * handleArray, unsigned int nelem) {
|
||||
int * statusArray = new int[nelem];
|
||||
MonitorPolicy * mpV = new MonitorPolicy[nelem];
|
||||
status = monitorStart (handleArray, nelem, statusArray, mpV);
|
||||
delete [] statusArray; delete [] mpV;
|
||||
return status;
|
||||
}
|
||||
|
||||
int monitorStart(unsigned int * handleArray, unsigned int nelem, int *statusArray,
|
||||
MonitorPolicy * mpV);
|
||||
int monitorStart(unsigned int * handleArray, unsigned int nelem, int *statusArray,
|
||||
unsigned int * monitorIDArray);
|
||||
int monitorStart(vector<unsigned int> handleV, vector<int> &statusV,
|
||||
vector<MonitorPolicy> &mpV);
|
||||
int monitorStart(vector<unsigned int> handleV, vector<int> &statusV,
|
||||
vector<unsigned int> &monitorIDV);
|
||||
int monitorStop (unsigned int * handleArray, unsigned int nelem, int *statusArray);
|
||||
int monitorStop (vector<unsigned int> handleV, vector<int> &statusV);
|
||||
|
||||
int monitorStop(unsigned int * handleArray, unsigned int nelem) {
|
||||
int * statusArray = new int[nelem];
|
||||
status = monitorStop (handleArray, nelem, statusArray);
|
||||
delete [] statusArray;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
MonitorPolicy * createMonitorPolicyArray(const unsigned int nmp) {
|
||||
MonitorPolicy * mpArray = new MonitorPolicy[nmp];
|
||||
return mpArray;
|
||||
}
|
||||
|
||||
int terminate();
|
||||
int terminate(ca_client_context * cctLocal);
|
||||
|
||||
unsigned int getHandleFromPV(const char * pv) {return handleHelper.getHandleFromPV(pv); }
|
||||
const char * getPVFromHandle(unsigned int handle){
|
||||
return handleHelper.getPVFromHandle(handle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int getHandleFromPVWithinGroup(const char * pv, unsigned int grh) {
|
||||
return handleHelper.getHandleFromPVWithinGroup(pv, grh); }
|
||||
|
||||
|
||||
bool isEnum(unsigned int handle) {return handleHelper.isEnum(handle);}
|
||||
|
||||
bool isValid(unsigned int handle) { for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
|
||||
{if ((*itcs).getHandle()==handle) {return true;}} return false;}
|
||||
|
||||
bool allChannelsConnected() { for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
|
||||
{if (!(*itcs).isConnected()) {return false;}} return true;}
|
||||
|
||||
bool isConnected(unsigned int handle) {
|
||||
return isChannelConnected(handle);
|
||||
}
|
||||
|
||||
bool isChannelConnected(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
|
||||
if (it_handle != handle_index.end()) {return (*it_handle).isConnected();}
|
||||
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return false;}}
|
||||
int getChannelInfo(unsigned int handle, ChannelRegalia & channelInfo){
|
||||
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
|
||||
if (it_handle != handle_index.end()) {channelInfo=(*it_handle).getChannelRegalia(); return ICAFE_NORMAL;}
|
||||
else {return ECAFE_INVALID_HANDLE;}
|
||||
};
|
||||
chid getChannelID(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
|
||||
if (it_handle != handle_index.end()) {return (*it_handle).getChannelID();}
|
||||
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return NULL;}}
|
||||
|
||||
|
||||
ca_client_context * getClientContext(const char * pvname){
|
||||
return handleHelper.getContextFromPV(pvname);
|
||||
}
|
||||
|
||||
ca_client_context * getClientContext(unsigned int handle){
|
||||
return handleHelper.getContextFromHandle(handle);
|
||||
}
|
||||
|
||||
int attachContext(ca_client_context *ccc){
|
||||
if (ccc != NULL) {
|
||||
return ca_attach_context(ccc);
|
||||
} else { return ECAFE_NULLCONTEXT;}
|
||||
}
|
||||
|
||||
int attachContextByPVName(const char * pvname){
|
||||
ca_client_context * ccc=getClientContext(pvname);
|
||||
if (ccc != NULL) {
|
||||
return ca_attach_context(ccc);
|
||||
} else { return ECAFE_NULLCONTEXT;}
|
||||
}
|
||||
|
||||
int attachContextByHandle(unsigned int handle){
|
||||
ca_client_context * ccc=getClientContext(handle);
|
||||
if (ccc != NULL) {
|
||||
return ca_attach_context(ccc);
|
||||
} else { return ECAFE_NULLCONTEXT;}
|
||||
}
|
||||
|
||||
//Add these methods for QCafe
|
||||
int updateAccessRead(unsigned int handle, int ar) {cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if ( (*it_handle).getAccessRead() != ar ) {
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_accessRead(ar));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
}
|
||||
return ICAFE_NORMAL;}
|
||||
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
|
||||
return ECAFE_INVALID_HANDLE;}
|
||||
}
|
||||
|
||||
int updateAccessWrite(unsigned int handle, int aw) {cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
|
||||
if (it_handle != handle_index.end()) {
|
||||
if ( (*it_handle).getAccessWrite() != aw ) {
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_accessWrite(aw));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
}
|
||||
return ICAFE_NORMAL;}
|
||||
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
|
||||
return ECAFE_INVALID_HANDLE;}
|
||||
}
|
||||
|
||||
bool getReadAccess(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
|
||||
if (it_handle != handle_index.end()) {return (bool) (*it_handle).getAccessRead();}
|
||||
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return false;}}
|
||||
|
||||
bool getWriteAccess(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
|
||||
if (it_handle != handle_index.end()) {return (bool) (*it_handle).getAccessWrite();}
|
||||
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return false;}}
|
||||
|
||||
void printStatusMessage(int status) {
|
||||
string s = getCafeStatus().csi.message(status);
|
||||
string c = getCafeStatus().csc.message(status);
|
||||
printf("%s\n",c.c_str());
|
||||
printf("%s\n",s.c_str());
|
||||
}
|
||||
|
||||
int printStatus(unsigned int handle, int status);
|
||||
int printStatusIfError(unsigned int handle, int status);
|
||||
int printStatus(unsigned int * handleArray, unsigned int nelem, int * statusArray);
|
||||
int printStatusIfError(unsigned int * handleArray, unsigned int nelem, int * statusArray);
|
||||
int printStatus(vector<unsigned int> handleV, vector<int> statusV);
|
||||
int printStatusIfError(vector<unsigned int> handleV, vector<int> statusV);
|
||||
|
||||
|
||||
int setPVAlias(unsigned int handle, const char * pv) throw (CAFEException_open);
|
||||
|
||||
// GROUP FUNCTIONS
|
||||
|
||||
PVDataHolder * getPVData(vector <unsigned int> handleArray);
|
||||
|
||||
int collectionDefine(const char * collectionName, vector<string> deviceV);
|
||||
int collectionDefine(const char * collectionName, vector<const char *> deviceV);
|
||||
int collectionDefine(const char * collectionName, pv_string_t * deviceArray, unsigned int deviceLength);
|
||||
int collectionFetch(const char * collectionName, vector<string> &deviceListV);
|
||||
int collectionFetch(const char * collectionName, vector<const char *> &deviceListV);
|
||||
int collectionFetch(const char * collectionName,deviceCollection &dC);
|
||||
vector<deviceCollection> getCollections() const {return deviceCollectionV;};
|
||||
|
||||
|
||||
//To do: Add shared_ptr for this method to ensure memory release
|
||||
int collectionMemberList(const char * collectionName, boost::shared_ptr<pv_string_t []> &list, unsigned int &listLength);
|
||||
//int collectionMemberList(const char * collectionName, dbr_string_t * &list, unsigned int &listLength);
|
||||
|
||||
//To do: Add shared_ptr for this method to ensure memory release
|
||||
int collectionList (boost::shared_ptr<pv_string_t []> &clist, unsigned int &listLength);
|
||||
//int collectionList (dbr_string_t * &clist, unsigned int &listLength);
|
||||
|
||||
int collectionMemberList(const char * collectionName, vector<string> &list);
|
||||
int collectionList (vector<string> &clist);
|
||||
|
||||
int devicePositionOrderedMultiMap(const char * collectionName, std::multimap<float, string> &posDev);
|
||||
int devicePositionMap(const char * collectionName, std::map<float, string> &posDev);
|
||||
int devicePositionV(const char * collectionName, std::vector<string> &dev, std::vector<float> &pos);
|
||||
|
||||
|
||||
int fetchIndexOfCollectionMember(const char *collectionName, const char * deviceName);
|
||||
|
||||
bool isGroup(const char *);
|
||||
bool isCollection(const char *);
|
||||
|
||||
int groupOpen(const char *pv, unsigned int &groupHandle) throw (CAFEException_groupOpen);
|
||||
int groupOpen(PVGroup &pvgroup, unsigned int &groupHandle) throw (CAFEException_groupOpen);
|
||||
|
||||
|
||||
int groupClose(unsigned int groupHandle);
|
||||
int groupClose();
|
||||
int groupCloseAll(){return groupClose(); };
|
||||
int groupHandleErase();
|
||||
int groupHandleErase(ca_client_context *ccc);
|
||||
|
||||
int groupCombine(const char * newGroupName, const char * groupName1,
|
||||
const char * groupName2); // PVGroup &pvGroup);
|
||||
int groupCombine(const char * newGroupName, vector<char *> groupName);// PVGroup &pvGroup);
|
||||
|
||||
|
||||
vector<string> generateChannelList(vector<string> inputStringV) {
|
||||
return getFromGlobalChannelList(inputStringV);
|
||||
}
|
||||
|
||||
vector<string> getFromGlobalChannelList(vector<string>);
|
||||
|
||||
|
||||
int groupDefine (const char * groupName, const char * collectionName, vector<string> attributeV);
|
||||
int groupDefine (const char * groupName, const char * collectionName, vector<const char*> attributeV);
|
||||
int groupDefine (const char * groupName, const char * collectionName,
|
||||
pv_string_t * attributeArray, unsigned short attributeLength);
|
||||
int groupDefine (const char * groupName, const char * collectionName, pv_string_t attribute){
|
||||
pv_string_t aA[1]; strcpy(aA[0], attribute);
|
||||
return groupDefine(groupName, collectionName, aA, 1);
|
||||
}
|
||||
|
||||
int groupDefine (const char * groupName, vector<string> deviceV, vector<string> attributeV);// PVGroup &pvGroup);
|
||||
int groupDefine (const char * groupName, vector<const char *> deviceV, vector<const char*> attributeV);
|
||||
//PVGroup &pvGroup);
|
||||
int groupDefine (const char * groupName, pv_string_t * deviceArray, unsigned int deviceLength,
|
||||
pv_string_t * attributeArray, unsigned short attributeLength); //
|
||||
|
||||
int groupDefine (const char * groupName, vector<string> pvArrayV); // PVGroup &pvGroup);
|
||||
int groupDefine (const char * groupName, vector<const char *> pvArrayV); // PVGroup &pvGroup);
|
||||
int groupDefine (const char * groupName, pv_string_t * pvArray, unsigned int pvArrayLength);
|
||||
//PVGroup &pvGroup);
|
||||
|
||||
//To do: Add shared_ptr for this method to ensure memory release
|
||||
|
||||
int groupMemberList(const char * groupName, boost::shared_ptr<pv_string_t []> &list, unsigned int &listLength);
|
||||
//int groupMemberList(const char * groupName, dbr_string_t * &list, unsigned int &listLength);
|
||||
|
||||
int groupList (boost::shared_ptr<pv_string_t []> &glist, unsigned int &listLength);
|
||||
//int groupList (dbr_string_t * &glist, unsigned int &listLength);
|
||||
|
||||
int groupMemberList(const char * groupName, vector<string> &list);
|
||||
|
||||
int groupList (vector<string> &glist);
|
||||
|
||||
int fetchIndexOfGroupMember(const char *groupName, const char * pv);
|
||||
|
||||
void setDeviceAttributeDeliminator(std::string d) {deviceAttributeDeliminator=d;};
|
||||
std::string getDeviceAttributeDeliminator() const {return deviceAttributeDeliminator;};
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // CONNECT_H
|
||||
80
include/defines.h
Normal file
80
include/defines.h
Normal file
@@ -0,0 +1,80 @@
|
||||
///
|
||||
/// \file defines.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
|
||||
#ifndef DEFINES_H
|
||||
#define DEFINES_H
|
||||
|
||||
#include <cadef.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#define EV EPICSVERSION(HAVE_EPICS)
|
||||
|
||||
#if (EPICS_VERSION==3) && (EPICS_MAJOR==14) && (EPICS_MINOR>=11)
|
||||
#define MASK_CTRL DBE_VALUE | DBE_LOG | DBE_ALARM | DBE_PROPERTY
|
||||
#elif (EPICS_VERSION==3) && (EPICS_MAJOR>14)
|
||||
#define MASK_CTRL DBE_VALUE | DBE_LOG | DBE_ALARM | DBE_PROPERTY
|
||||
#else
|
||||
#define MASK_CTRL DBE_VALUE | DBE_LOG | DBE_ALARM
|
||||
#endif
|
||||
|
||||
//To match alarmString.h in EPICS
|
||||
const unsigned short ALARM_SEVERITY_STRING_LENGTH = 4; // "NO_ALARM","MINOR","MAJOR", "INVALID"
|
||||
const unsigned short ALARM_STATUS_STRING_LENGTH = 22; // "NO_ALARM","READ","WRITE",
|
||||
//"HIHI","HIGH","LOLO","LOW","STATE","COS","COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
|
||||
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS","WRITE_ACCESS"
|
||||
|
||||
|
||||
/**
|
||||
* Define pCallback \n
|
||||
*/
|
||||
typedef void (*pCallback) (struct event_handler_args ARGS);
|
||||
typedef void (*pCallbackConnection) (struct connection_handler_args ARGS);
|
||||
|
||||
|
||||
const bool ADD_EXCEPTION_EVENT=false; //set to false for use with MATLAB
|
||||
// Standard exception event is good enough
|
||||
/**
|
||||
* Size of char * array to hold pv and pvAlias names \n
|
||||
*/
|
||||
const short PVNAME_SIZE=MAX_STRING_SIZE +20; //from epicsTypes.h 40;
|
||||
const short PVGROUP_PSEUDO_SIZE=1024; //determines max size of groupNameEntry for Pseudo groups
|
||||
|
||||
//List all possible deliminators; code will separate dev/attriby when first of this list is found;
|
||||
const std::string DEFAULT_DEVICE_ATTRIBUTE_DELIMINATOR=":"; //Only one deliminator
|
||||
|
||||
typedef char pv_string_t[PVNAME_SIZE];
|
||||
|
||||
/**
|
||||
* Default configuration parameters. Recall that if pend_event is too short \n
|
||||
* then create callback function will still be called after the specified period
|
||||
*/
|
||||
const bool DEFAULT_SELF_GOVERNING_TIMEOUT = true;
|
||||
|
||||
const double DEFAULT_TIMEOUT_PEND_IO_WF = 5.0;
|
||||
const double TIMEOUT_PEND_IO_MIN = 0.00001;
|
||||
const double TIMEOUT_PEND_IO_MAX = 20.0; // max timeout for first attempt (ntries=1)
|
||||
const unsigned short DEFAULT_PEND_IO_NO_TRIES = 2;
|
||||
const unsigned short PEND_IO_MAX_TRIES = 10; // safety net
|
||||
const double DEFAULT_PEND_IO_INCREMENT_TIME = 2.0;
|
||||
const double PEND_IO_INCREMENT_TIME_MIN= 0.05;
|
||||
const double PEND_IO_INCREMENT_TIME_MAX= 10.0;
|
||||
const double DEFAULT_TIMEOUT_PEND_EVENT = 0.4;
|
||||
const double DEFAULT_TIMEOUT_PEND_IO = 3.0;
|
||||
const double DEFAULT_TIMEOUT_SG_PEND_EVENT = 0.5; // plus nMember/NMEMBER_PER_SEC_SG_PEND_EVENT
|
||||
const double NMEMBER_PER_SEC_SG_PEND_EVENT = 400; //
|
||||
const double DEFAULT_TIMEOUT_SG_PEND_IO = 5.0;
|
||||
|
||||
// Otherwise too many large databuffers are created
|
||||
const unsigned int MAX_NELEM_FOR_CTRL_BUFFER = 8192;
|
||||
// Keep at 1, else becomes problematic when wf is made a syn. group member (ch disconnect occurs for STSACK cb)
|
||||
const unsigned int MAX_NELEM_FOR_STSACK_BUFFER = 1;
|
||||
const unsigned int DEFAULT_NELEM_FOR_CTRL_BUFFER = 256; // if nelem exceeds above
|
||||
const unsigned int DEFAULT_NELEM_FOR_STSACK_BUFFER = 1; // if nelem exceeds above
|
||||
|
||||
const unsigned short MAX_NO_MONITORS_PER_CHANNEL = 4; // Can't start more than 4; 1 is more usual.
|
||||
|
||||
#endif // DEFINES_H
|
||||
115
include/deviceCollection.h
Normal file
115
include/deviceCollection.h
Normal file
@@ -0,0 +1,115 @@
|
||||
///
|
||||
/// \file deviceCollection.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef DEVICECOLLECTION_H
|
||||
#define DEVICECOLLECTION_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <helper.h>
|
||||
|
||||
class collectionMember {
|
||||
public:
|
||||
collectionMember():deviceName(""),devicePosition(0){};
|
||||
virtual ~collectionMember(){};
|
||||
std::string deviceName;
|
||||
float devicePosition;
|
||||
};
|
||||
|
||||
class deviceCollection {
|
||||
friend class Connect;
|
||||
friend class CAFE;
|
||||
//if HAVE_LIBQTXML
|
||||
friend class loadCollectionXMLParser;
|
||||
//endif
|
||||
private:
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::vector<collectionMember> cMembers;
|
||||
std::vector<std::string> attributes;
|
||||
|
||||
Helper helper;
|
||||
public:
|
||||
deviceCollection():description("collection of devices"){};
|
||||
virtual ~deviceCollection(){};
|
||||
|
||||
std::string getName() const {return name;};
|
||||
std::string getDescription() const {return description;};
|
||||
std::vector<collectionMember> getCMembers() const {return cMembers;};
|
||||
|
||||
std::vector<std::string> getAttributes() const {return attributes;};
|
||||
std::vector<float> getPositions() {
|
||||
std::vector<float> posV; posV.clear(); posV.reserve(cMembers.size());
|
||||
for (size_t i=0; i<cMembers.size(); ++i) {
|
||||
posV.push_back(cMembers[i].devicePosition);
|
||||
};
|
||||
return posV;
|
||||
};
|
||||
float getPosition(const char * c) {
|
||||
char _c[PVNAME_SIZE];
|
||||
helper.removeLeadingAndTrailingSpaces(c, _c);
|
||||
for (size_t i=0; i<cMembers.size(); ++i) {
|
||||
if(strcmp(cMembers[i].deviceName.c_str(),_c)==0) {
|
||||
return cMembers[i].devicePosition;
|
||||
}
|
||||
}
|
||||
std::cout << "INPUT: " << _c << " NOT FOUND IN COLLECTION: " << name << std::endl;
|
||||
std::cout << "HENCE RETURNING -1 FOR POSITION " << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::vector<std::string> getMembers() {
|
||||
std::vector<std::string> memberV; memberV.clear(); memberV.reserve(cMembers.size());
|
||||
for (size_t i=0; i<cMembers.size(); ++i) {
|
||||
memberV.push_back(cMembers[i].deviceName);
|
||||
};
|
||||
return memberV;
|
||||
};
|
||||
|
||||
unsigned int getNCollectionMembers() const {return cMembers.size();};
|
||||
unsigned int getNAttribuites() const {return attributes.size();};
|
||||
};
|
||||
|
||||
|
||||
class collectionInGroup {
|
||||
//friend class loadGroupXMLParser;
|
||||
public:
|
||||
collectionInGroup(){};
|
||||
virtual ~collectionInGroup(){};
|
||||
std::string id;
|
||||
std::string attrib;
|
||||
};
|
||||
|
||||
class deviceGroup {
|
||||
//if HAVE_LIBQTXML
|
||||
friend class loadGroupXMLParser;
|
||||
//endif
|
||||
private:
|
||||
std::string id;
|
||||
std::string description;
|
||||
|
||||
std::vector<collectionMember> members;
|
||||
std::vector<std::string> xmlMembers;
|
||||
std::vector<collectionInGroup> collections;
|
||||
public:
|
||||
deviceGroup(){};
|
||||
virtual ~deviceGroup(){};
|
||||
|
||||
std::string getName() const {return id;};
|
||||
std::string getID() const {return id;};
|
||||
|
||||
std::string getDescription() const {return description;};
|
||||
std::vector<collectionMember> getCMembers() const {return members;};
|
||||
std::vector<collectionInGroup> getCollections() const {return collections;};
|
||||
std::vector<std::string>getXMLMembers() const {return xmlMembers;};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // DEVICECOLLECTION_H
|
||||
98
include/enumStrings.h
Normal file
98
include/enumStrings.h
Normal file
@@ -0,0 +1,98 @@
|
||||
///
|
||||
/// \file enumStrings.h
|
||||
/// \author Jan Chrin, PSi
|
||||
/// \brief Modified from Astari's C++11 version.
|
||||
/// Use boost::begin() boost::end() for C++
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef ENUMSTRINGS_H
|
||||
#define ENUMSTRINGS_H
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <boost/range.hpp>
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct enumStrings
|
||||
{
|
||||
static char const* data[];
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct enumRefHolder
|
||||
{
|
||||
T& enumVal;
|
||||
enumRefHolder(T& enumVal): enumVal(enumVal) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct enumConstRefHolder
|
||||
{
|
||||
T const& enumVal;
|
||||
enumConstRefHolder(T const& enumVal): enumVal(enumVal) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline std::ostream& operator<<(std::ostream& str, enumConstRefHolder<T> const& data)
|
||||
{
|
||||
//Add check on enumStrings<T>::data size to ensure correspondence with entries in cafeEnumEpics.h
|
||||
|
||||
if ( boost::size( enumStrings<T>::data) > (unsigned int) data.enumVal) {
|
||||
return str << enumStrings<T>::data[data.enumVal];
|
||||
}
|
||||
else {
|
||||
return str << "ERROR: enumStrings.h reports data.enumVal= " << data.enumVal
|
||||
<< " DOES NOT HAVE A STRING EQUIVALENT!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline std::istream& operator>>(std::istream& str, enumRefHolder<T> const& data)
|
||||
{
|
||||
std::string value;
|
||||
str >> value;
|
||||
|
||||
// These two can be made easier to read in C++11
|
||||
// using std::begin() and std::end()
|
||||
|
||||
//static auto begin = std::begin(enumStrings<T>::data);
|
||||
//static auto end = std::end(enumStrings<T>::data);
|
||||
//auto find = std::find(begin, end, value);
|
||||
//if (find != end)
|
||||
|
||||
if ( std::find( boost::begin(enumStrings<T>::data), boost::end( enumStrings<T>::data), value) !=
|
||||
boost::end( enumStrings<T>::data))
|
||||
{
|
||||
//data.enumVal = static_cast<T>(std::distance(begin, find));
|
||||
data.enumVal = static_cast<T>(std::distance(boost::begin(enumStrings<T>::data),
|
||||
std::find (boost::begin(enumStrings<T>::data), boost::end(enumStrings<T>::data), value ) ));
|
||||
}
|
||||
|
||||
|
||||
if (data.enumVal > boost::size( enumStrings<T>::data) ) {
|
||||
|
||||
std::cout << "ERROR: enumStrings.h reports data.enumVal = " << data.enumVal
|
||||
<< " is out of enum range = " << boost::size( enumStrings<T>::data) << std::endl;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
enumConstRefHolder<T> enumToString(T const& e) {return enumConstRefHolder<T>(e);}
|
||||
|
||||
template<typename T>
|
||||
enumRefHolder<T> enumFromString(T& e) {return enumRefHolder<T>(e);}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // ENUMSTRINGS_H
|
||||
106
include/exceptions.h
Normal file
106
include/exceptions.h
Normal file
@@ -0,0 +1,106 @@
|
||||
///
|
||||
/// \file exceptions.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date November 2014
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef EXCEPTIONS_H
|
||||
#define EXCEPTIONS_H
|
||||
|
||||
#include <exception>
|
||||
#include <cstring>
|
||||
#include <defines.h>
|
||||
#include <cafeDataType.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* The CAFEException_pv struct for pv error reporting
|
||||
*/
|
||||
struct CAFEException_pv
|
||||
{
|
||||
char pv [PVNAME_SIZE];
|
||||
char pvAlias[PVNAME_SIZE];
|
||||
unsigned int handle;
|
||||
CAFE_DATATYPE dataTypeNative;
|
||||
const char * dataTypeNativeText;
|
||||
int statusCode;
|
||||
const char * statusCodeText;
|
||||
const char * statusMessage;
|
||||
const char * source;
|
||||
unsigned int ln;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The CAFEException_group struct for group error reporting
|
||||
*/
|
||||
struct CAFEException_group
|
||||
{
|
||||
char groupName [PVNAME_SIZE];
|
||||
unsigned int groupHandle;
|
||||
int statusCode;
|
||||
const char * statusCodeText;
|
||||
const char * statusMessage;
|
||||
const char * source;
|
||||
unsigned int ln;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The CAFEException_open class for ca open error reporting
|
||||
*/
|
||||
class CAFEException_open : public exception
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "CAFEException_open exception: Could not establish link to pv";
|
||||
};
|
||||
|
||||
CAFEException_pv pvEx;
|
||||
};
|
||||
|
||||
/**
|
||||
* The CAFEException_groupOpen class for ca group open error reporting
|
||||
*/
|
||||
class CAFEException_groupOpen : public exception
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "CAFEException_groupOpen exception: Could not establish link to group";
|
||||
};
|
||||
|
||||
CAFEException_group groupEx;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The CAFEException_init
|
||||
*/
|
||||
class CAFEException_init: public exception
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "CAFEException_init exception: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The CAFEException_allocBufferMem
|
||||
*/
|
||||
class CAFEException_allocBufferMem: public exception
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "CAFEException_allocBufferMem exception: \nCAFE ERROR: Cannot create space for pv data/ctrl buffer";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif // EXCEPTION_H
|
||||
38
include/exceptionsHelper.h
Normal file
38
include/exceptionsHelper.h
Normal file
@@ -0,0 +1,38 @@
|
||||
///
|
||||
/// \file exceptionsHelper.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef EXCEPTIONSHELPER_H
|
||||
#define EXCEPTIONSHELPER_H
|
||||
|
||||
#include "exceptions.h"
|
||||
#include "statusCodes.h"
|
||||
#include "defines.h"
|
||||
|
||||
class ExceptionsHelper
|
||||
{
|
||||
private:
|
||||
CAFEDataTypeCode cafeDataTypeCode;
|
||||
CAFEStatus cafeStatus;
|
||||
public:
|
||||
CAFEException_pv prepareCAFEException_pv(const char *pv, const char *pvAlias,
|
||||
unsigned int handle, chid pCh, int status,
|
||||
const char * source, unsigned int ln);
|
||||
|
||||
CAFEException_group prepareCAFEException_group(
|
||||
char groupName [PVNAME_SIZE],
|
||||
unsigned int groupHandle,
|
||||
int statusCode,
|
||||
const char * source,
|
||||
unsigned int ln);
|
||||
|
||||
ExceptionsHelper(void){};
|
||||
~ExceptionsHelper(void){};
|
||||
void printCAFEException_pv(CAFEException_pv & e);
|
||||
|
||||
|
||||
};
|
||||
#endif // EXCEPTIONSHELPER_H
|
||||
36
include/global.h
Normal file
36
include/global.h
Normal file
@@ -0,0 +1,36 @@
|
||||
///
|
||||
/// \file global.h
|
||||
/// \brief For access to containers for callbacks
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
|
||||
#ifndef GLOBAL_H
|
||||
#define GLOBAL_H
|
||||
|
||||
#include <cadef.h>
|
||||
#include <hashConduit.h>
|
||||
#include <hashConduitGroup.h>
|
||||
#include <PVGroup.h>
|
||||
#include <deviceCollection.h>
|
||||
#include <enumStrings.h>
|
||||
|
||||
extern bool CHECK_CONSISTENCY_CA_STATE;
|
||||
extern bool MUTEX;
|
||||
extern epicsMutex cafeMutex;
|
||||
extern cafeConduit_set cs;
|
||||
extern cafeGroup_set gs;
|
||||
extern vector<PVGroup> PVGroupV;
|
||||
extern vector<PVGroup> PVGroupPseudo;
|
||||
extern vector<deviceCollection> deviceCollectionV;
|
||||
extern map<vector<unsigned int>, string> groupPseudoMap;
|
||||
|
||||
extern vector<string> globalChannelList;
|
||||
|
||||
extern string globalZmqStream;
|
||||
extern string contentsS;
|
||||
extern unsigned long nCBs;
|
||||
|
||||
#endif // GLOBAL_H
|
||||
98
include/granules.h
Normal file
98
include/granules.h
Normal file
@@ -0,0 +1,98 @@
|
||||
///
|
||||
/// \file granules.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
|
||||
/**
|
||||
* Contains methods that are used by Instant template
|
||||
* Among these are the Verify, Prepare, Execute
|
||||
*/
|
||||
|
||||
#ifndef GRANULES_H
|
||||
#define GRANULES_H
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_BOOST_THREAD
|
||||
#include <boost/thread/thread_only.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#include <global.h>
|
||||
#include <conduitFriends.h>
|
||||
#include <handleHelper.h>
|
||||
|
||||
|
||||
|
||||
class Granules {
|
||||
public:
|
||||
|
||||
template <class CTYPE> friend class Instant;
|
||||
friend class CAFE;
|
||||
Granules(){};
|
||||
|
||||
private:
|
||||
HandleHelper helper;
|
||||
CAFEStatus cafeStatus;
|
||||
|
||||
ChannelRequestDataTypePolicy channelRequestDataTypePolicy;
|
||||
|
||||
ChannelRequestPolicyKind methodKind; //for channelExecutePut
|
||||
|
||||
ChannelRequestPolicy channelRequestPolicyPut;
|
||||
ChannelRequestStatus channelRequestStatusPut;
|
||||
|
||||
ChannelRequestPolicy channelRequestPolicyGet;
|
||||
ChannelRequestStatus channelRequestStatusGet;
|
||||
|
||||
ChannelRequestMetaDataClient channelRequestMetaDataClient;
|
||||
ChannelRequestMetaData channelRequestMetaData;
|
||||
ChannelRequestMetaData channelRequestMetaPrimitive;
|
||||
|
||||
ChannelRequestPolicy channelRequestPolicyGetCtrl;
|
||||
ChannelRequestStatus channelRequestStatusGetCtrl;
|
||||
|
||||
ChannelRequestMetaDataClient channelRequestMetaCtrlClient;
|
||||
ChannelRequestMetaData channelRequestMetaCtrl;
|
||||
|
||||
ChannelTimeoutPolicy channelTimeoutPolicyGet;
|
||||
ChannelTimeoutPolicy channelTimeoutPolicyPut;
|
||||
|
||||
int channelVerifyPut (const unsigned int, chtype); //isChannelConnected //writeAccess
|
||||
int channelPreparePut (const unsigned int); //nelem offset requestType
|
||||
int channelExecutePut (const unsigned int);
|
||||
|
||||
int waitForPutEvent (const unsigned int, double);
|
||||
bool isPutCallbackDone (const unsigned int _handle);
|
||||
|
||||
int channelVerifyGet (const unsigned int, chtype); //isChannelConnected //readAccess
|
||||
int channelPrepareGet (const unsigned int); //nelem offset requestType
|
||||
int channelExecuteGet (const unsigned int); //report status
|
||||
int channelExecuteGetNoWait(const unsigned int); //report status
|
||||
|
||||
int waitForManyGetEvents(const unsigned int * handleArray, unsigned int arrayLength, map<unsigned int, int> & bundleResponse);
|
||||
|
||||
int waitForGetEvent (const unsigned int, double);
|
||||
bool isGetCallbackDone (const unsigned int _handle);
|
||||
|
||||
int channelVerifyGetCtrl (const unsigned int, chtype); //isChannelConnected //readAccess
|
||||
int channelPrepareGetCtrl (const unsigned int); //nelem offset requestType
|
||||
int channelExecuteGetCtrl (const unsigned int); //report status
|
||||
int channelExecuteGetCtrlNoWait(const unsigned int _handle);
|
||||
|
||||
int waitForGetCtrlEvent(const unsigned int, double);
|
||||
bool isGetCtrlCallbackDone(const unsigned int _handle);
|
||||
|
||||
int status;
|
||||
|
||||
chtype convertMatrix(const chtype nativeType, const chtype clientT);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // GRANULES_H
|
||||
276
include/handleHelper.h
Normal file
276
include/handleHelper.h
Normal file
@@ -0,0 +1,276 @@
|
||||
///
|
||||
/// \file handleHelper.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef HANDLEHELPER_H
|
||||
#define HANDLEHELPER_H
|
||||
|
||||
#include <cadef.h>
|
||||
#include <helper.h>
|
||||
#include <defines.h>
|
||||
#include <hashConduit.h>
|
||||
#include <conduitFriends.h>
|
||||
#include <hashConduitGroup.h>
|
||||
#include <cafeDataType.h>
|
||||
|
||||
|
||||
class HandleHelper : public Helper {
|
||||
|
||||
private:
|
||||
CAFEStatus cafeStatus;
|
||||
cafeConduit_set::iterator itcs;
|
||||
|
||||
cafeGroup_set::iterator itgs;
|
||||
|
||||
ChannelRequestMetaDataClient channelRequestMetaDataClient;
|
||||
ChannelRequestMetaData channelRequestMetaData;
|
||||
|
||||
ChannelRequestMetaDataClient channelRequestMetaCtrlClient;
|
||||
ChannelRequestMetaData channelRequestMetaCtrl;
|
||||
|
||||
ChannelDeviceAttribute channelDeviceAttribute;
|
||||
|
||||
CAFEDataTypeCode cafeDataTypeCode;
|
||||
|
||||
PrintErrorPolicy printErrorPolicy;
|
||||
|
||||
struct etsNorm{ unsigned int secPastEpoch; unsigned int nsec;};
|
||||
struct etsDate{ int year; int mon; int day;
|
||||
int hour; int min; int sec; unsigned long nsec;};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
HandleHelper(){};
|
||||
~HandleHelper(){};
|
||||
|
||||
//Move to private if possible
|
||||
int setSTS(unsigned int _handle, dbr_short_t a, dbr_short_t s, epicsTimeStamp ets);
|
||||
|
||||
|
||||
etsNorm _etsNorm;
|
||||
etsDate _etsDate;
|
||||
|
||||
int checkConsistency();
|
||||
int checkConsistency(unsigned int _handle);
|
||||
|
||||
int setChannelDeviceAttribute(std::string deliminator);
|
||||
int setChannelDeviceAttribute(unsigned int _handle, std::string deliminator);
|
||||
|
||||
int getChannelDevice(unsigned int _handle, std::string & device);
|
||||
int getChannelAttribute(unsigned int _handle, std::string & attribute);
|
||||
|
||||
int getChannelRegalia(unsigned int _handle, ChannelRegalia & channelInfo);
|
||||
|
||||
int getChannelRequestStatusGetClassName(unsigned int _handle, ChannelRequestStatus &crsClassName);
|
||||
int getChannelRequestStatusGetSTSACK (unsigned int _handle, ChannelRequestStatus &crsSTSACK);
|
||||
int getChannelRequestStatusGetCtrl (unsigned int _handle, ChannelRequestStatus &crsCtrl);
|
||||
int getChannelRequestStatusGet (unsigned int _handle, ChannelRequestStatus &crs);
|
||||
|
||||
|
||||
//Add getPVFromHandle
|
||||
ca_client_context * getContextFromPV (const char * _pv);
|
||||
ca_client_context * getContextFromHandle (unsigned int _handle);
|
||||
|
||||
const char * getPVFromHandle (unsigned int _handle);
|
||||
const char * getPVFromHandle (unsigned int _handle, ca_client_context * ccc);
|
||||
|
||||
unsigned int getHandleFromPV (const char * _pv);
|
||||
unsigned int getHandleFromPV (const char * _pv, ca_client_context * ccc);
|
||||
unsigned int getHandleFromPVAlias(const char * _pv);
|
||||
unsigned int getHandleFromPVAlias(const char * _pv, ca_client_context * ccc);
|
||||
|
||||
|
||||
vector<unsigned int> getHandlesFromWithinGroupV(unsigned int gh);
|
||||
unsigned int * getHandlesFromWithinGroup(unsigned int gh);
|
||||
|
||||
unsigned int getHandleFromPVWithinGroup(const char * _pv, unsigned int gh);
|
||||
unsigned int getHandleFromPVWithinGroup(const char * _pv,
|
||||
ca_client_context * ccc, unsigned int gh);
|
||||
|
||||
int getStatus (unsigned int h);
|
||||
int getTimeStamp(unsigned int h, epicsTimeStamp &ts);
|
||||
|
||||
|
||||
etsNorm getEpicsTimeStampAsUInt32(unsigned int h) {
|
||||
epicsTimeStamp ts;
|
||||
getTimeStamp(h, ts);
|
||||
_etsNorm.secPastEpoch=ts.secPastEpoch; _etsNorm.nsec=ts.nsec;
|
||||
return _etsNorm;};
|
||||
|
||||
etsDate getEpicsTimeStampAsDate(unsigned int h) {
|
||||
epicsTimeStamp ts;
|
||||
|
||||
getTimeStamp(h, ts);
|
||||
|
||||
epicsTime time(ts);
|
||||
|
||||
local_tm_nano_sec local = (local_tm_nano_sec) time;
|
||||
_etsDate.year = local.ansi_tm.tm_year + 1900;
|
||||
_etsDate.mon = local.ansi_tm.tm_mon + 1;
|
||||
_etsDate.day = local.ansi_tm.tm_mday;
|
||||
_etsDate.hour = local.ansi_tm.tm_hour;
|
||||
_etsDate.min = local.ansi_tm.tm_min;
|
||||
_etsDate.sec = local.ansi_tm.tm_sec;
|
||||
|
||||
_etsDate.nsec = (unsigned long) ts.nsec;
|
||||
|
||||
return _etsDate;
|
||||
}
|
||||
|
||||
etsDate epicsTimeStampToDate(epicsTimeStamp ts) {
|
||||
epicsTime time(ts);
|
||||
local_tm_nano_sec local = (local_tm_nano_sec) time;
|
||||
_etsDate.year = local.ansi_tm.tm_year + 1900;
|
||||
_etsDate.mon = local.ansi_tm.tm_mon + 1;
|
||||
_etsDate.day = local.ansi_tm.tm_mday;
|
||||
_etsDate.hour = local.ansi_tm.tm_hour;
|
||||
_etsDate.min = local.ansi_tm.tm_min;
|
||||
_etsDate.sec = local.ansi_tm.tm_sec;
|
||||
_etsDate.nsec = (unsigned long) ts.nsec;
|
||||
return _etsDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int getPulseID(unsigned int h, unsigned int &pulseID) {
|
||||
epicsTimeStamp ts;
|
||||
int status=getTimeStamp(h, ts);
|
||||
if (status==ICAFE_NORMAL){
|
||||
std::string nsS = static_cast<ostringstream*>( &(ostringstream() << ts.nsec) )->str();
|
||||
int l=nsS.length();
|
||||
int startPos=max(l-6,0);
|
||||
std::string pidS = nsS.substr(startPos,min(6,l));
|
||||
if ( ! (istringstream(pidS) >> pulseID) ) pulseID = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
unsigned int getPulseIDFromTS(epicsTimeStamp ts) {
|
||||
unsigned int pulseID;
|
||||
std::string nsS = static_cast<ostringstream*>( &(ostringstream() << ts.nsec) )->str();
|
||||
int l=nsS.length();
|
||||
int startPos=max(l-6,0);
|
||||
std::string pidS = nsS.substr(startPos,min(6,l));
|
||||
if ( ! (istringstream(pidS) >> pulseID) ) pulseID = 0;
|
||||
return pulseID;
|
||||
}
|
||||
|
||||
int getAlarmStatusSeverity(unsigned int h, dbr_short_t as[2]);
|
||||
int getAlarmStatusSeverityAsString(unsigned int h, string asas[2]);
|
||||
unsigned int getNoHandles();
|
||||
unsigned int getNextFreeHandle();
|
||||
|
||||
bool isChannelConnected(unsigned int handle);
|
||||
|
||||
int printHandle (unsigned int h);
|
||||
int printHandlesV(vector<unsigned int> handleV);
|
||||
int printHandles(unsigned int * handleArray, unsigned int nHandles);
|
||||
unsigned int printHandles();
|
||||
unsigned int printChannels(){return printHandles();};
|
||||
unsigned int printDisconnectedHandles();
|
||||
unsigned int printDisconnectedChannels(){return printDisconnectedChannels();};
|
||||
unsigned int getDisconnectedHandles(vector<unsigned int> &, vector<string> &);
|
||||
unsigned int getConnectedHandles(vector<unsigned int> &, vector<string> &);
|
||||
unsigned int getHandles(vector<unsigned int> &, vector<string> &);
|
||||
unsigned int getHandleStates(vector<unsigned int> &, vector<string> &, vector<unsigned short> &);
|
||||
unsigned int printMonitors();
|
||||
|
||||
vector<unsigned int> getHandlesWithMonitors();
|
||||
int getMonitorHandlesAndActions(vector<unsigned int> & handleV, vector<string> & actionV);
|
||||
|
||||
int setCafeDbrTypeV(vector<unsigned int> _handleV, CAFENUM::DBR_TYPE cdt);
|
||||
int setCafeDbrType(unsigned int _handle, CAFENUM::DBR_TYPE cdt);
|
||||
int getCafeDbrType(unsigned int _handle, CAFENUM::DBR_TYPE &cdt);
|
||||
|
||||
bool isEnum(unsigned int _handle);
|
||||
short getEnumFromString(unsigned int _handle, string enumStringValue);
|
||||
string getStringFromEnum(unsigned int _handle, unsigned short enumValue);
|
||||
|
||||
int getDataTypeNative (unsigned int _handle, chtype &ndt);
|
||||
int getDataTypeRequest(unsigned int _handle, chtype &rdt);
|
||||
|
||||
int eraseMonitorAction(unsigned int _handle);
|
||||
int clearMonitorAction(unsigned int _handle);
|
||||
|
||||
int clearMonitorAction();
|
||||
|
||||
int addMonitorAction(unsigned int _handle, string mAction);
|
||||
int getMonitorAction(unsigned int _handle, vector<string> &msV);
|
||||
vector<string> getMonitorAction(bool onlyIfNewData); //all handles; false gives all
|
||||
|
||||
int getMonitorPolicyVector(unsigned int _handle, vector<MonitorPolicy> &mpV);
|
||||
int getMonitorPolicyInWaitingVector(unsigned int _handle, vector<MonitorPolicy> &mpV);
|
||||
int getNmonitor(unsigned int _handle);
|
||||
int getNmonitorData(unsigned int _handle);
|
||||
int getNmonitorCtrl(unsigned int _handle);
|
||||
vector<unsigned int> getMonitorIDs(unsigned int _handle);
|
||||
vector<unsigned int> getMonitorIDsInWaiting(unsigned int _handle);
|
||||
|
||||
unsigned int getUsrArgsAsUInt(unsigned int _handle); //From c.channelRequestMetaData.usrArg
|
||||
chtype getDataTypeCB(unsigned int _handle);
|
||||
chtype getDbrDataTypeCB(unsigned int _handle);
|
||||
CAFENUM::DBR_TYPE getCafeDbrTypeCB(unsigned int _handle);
|
||||
|
||||
//setNoElements
|
||||
int setNelem (); //All handles to native
|
||||
unsigned int setNelem (unsigned int _handle); //To Native
|
||||
unsigned int setNelemToNative (unsigned int _handle){return setNelem(_handle);}; //To Native
|
||||
unsigned int setNelem (unsigned int _handle, unsigned int _nelem);
|
||||
//For Arrays:
|
||||
unsigned int setNelemToRetrieveFromCache (unsigned int _handle);
|
||||
unsigned int setNelemToRetrieveFromCache (unsigned int _handle, unsigned int _nelem);
|
||||
unsigned int setNelemToRetrieveFromCtrlCache (unsigned int _handle);
|
||||
unsigned int setNelemToRetrieveFromCtrlCache (unsigned int _handle, unsigned int _nelem);
|
||||
unsigned int getNelemToRetrieveFromCache (unsigned int _handle);
|
||||
unsigned int getNelemToRetrieveFromCtrlCache (unsigned int _handle);
|
||||
|
||||
char * getPV (unsigned int _handle);
|
||||
char * getPVAlias (unsigned int _handle);
|
||||
|
||||
unsigned int getNelemClient (unsigned int _handle);
|
||||
unsigned int getNelemNative (unsigned int _handle);
|
||||
unsigned int getNelemRequest (unsigned int _handle);
|
||||
|
||||
int getNelem(unsigned int _handle, unsigned int &c, unsigned int &n, unsigned int &r);
|
||||
|
||||
//Ctrl
|
||||
|
||||
unsigned int setNelemCtrl (unsigned int _handle, unsigned int _nelem);
|
||||
unsigned int getNelemRequestCtrl (unsigned int _handle);
|
||||
unsigned int getNelemClientCtrl (unsigned int _handle);
|
||||
//setOffSet
|
||||
unsigned int setOffset(unsigned int _handle, unsigned int _offset);
|
||||
unsigned int getOffset(unsigned int _handle);
|
||||
unsigned int getOffsetLast(unsigned int _handle);
|
||||
|
||||
void setFirstAndLastArrayElements(unsigned int _handle,
|
||||
unsigned int _start, unsigned int _last){
|
||||
if (_last > _start ) { setOffset(_handle, _start); setNelem(_handle, _last);}
|
||||
else {std::cout << " offset must be less than the nelements" <<std::endl; };
|
||||
};
|
||||
|
||||
|
||||
//long setOffsetCtrl(unsigned int _handle, unsigned int _offset);
|
||||
|
||||
//Groups
|
||||
unsigned int getGroupHandleFromGroupName(const char * _groupName){
|
||||
ca_client_context * ccc= ca_current_context();
|
||||
return getGroupHandleFromGroupName(_groupName, ccc);
|
||||
}
|
||||
|
||||
unsigned int getGroupHandleFromGroupName(const char * _groupName, ca_client_context * ccc);
|
||||
string getGroupNameFromGroupHandle(unsigned int groupHandle);
|
||||
|
||||
unsigned int getGroupNPV(unsigned int gHandle);
|
||||
unsigned int getGroupNPV(const char * _groupName, ca_client_context * ccc);
|
||||
unsigned int getGroupNPV(const char * _groupName){
|
||||
ca_client_context * ccc= ca_current_context();
|
||||
return getGroupNPV(_groupName, ccc);
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
53
include/hashConduit.h
Normal file
53
include/hashConduit.h
Normal file
@@ -0,0 +1,53 @@
|
||||
///
|
||||
/// \file hashConduit.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
|
||||
#ifndef HASHCONDUIT_H
|
||||
#define HASHCONDUIT_H
|
||||
|
||||
#include <conduit.h>
|
||||
#include <map>
|
||||
|
||||
// boost include
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
using boost::multi_index_container;
|
||||
using namespace boost::multi_index;
|
||||
|
||||
struct by_handle{};
|
||||
struct by_channelID{};
|
||||
struct by_pv{};
|
||||
struct by_pvAlias{};
|
||||
|
||||
|
||||
typedef multi_index_container<
|
||||
Conduit,
|
||||
indexed_by<
|
||||
ordered_unique<
|
||||
tag<by_handle>, BOOST_MULTI_INDEX_MEMBER(Conduit, unsigned int, handle)>,
|
||||
ordered_non_unique<
|
||||
tag<by_channelID>, BOOST_MULTI_INDEX_MEMBER(Conduit, chid, channelID)>,
|
||||
ordered_non_unique<
|
||||
tag<by_pv>, BOOST_MULTI_INDEX_MEMBER(Conduit, std::string, pv)>,
|
||||
ordered_non_unique<
|
||||
tag<by_pvAlias>, BOOST_MULTI_INDEX_MEMBER(Conduit, std::string, pvAlias)>,
|
||||
//ordered_non_unique<
|
||||
//tag<by_uniqueID>, BOOST_MULTI_INDEX_MEMBER(Conduit, unsigned int, uniqueID)>,
|
||||
hashed_unique<member<Conduit, unsigned int, &Conduit::handle> >
|
||||
>
|
||||
> cafeConduit_set;
|
||||
|
||||
|
||||
typedef cafeConduit_set::index<by_channelID>::type cafeConduit_set_by_channelID;
|
||||
typedef cafeConduit_set::index<by_handle>::type cafeConduit_set_by_handle;
|
||||
typedef cafeConduit_set::index<by_pv>::type cafeConduit_set_by_pv;
|
||||
typedef cafeConduit_set::index<by_pvAlias>::type cafeConduit_set_by_pvAlias;
|
||||
|
||||
|
||||
#endif // HASHCONDUIT_H
|
||||
45
include/hashConduitGroup.h
Normal file
45
include/hashConduitGroup.h
Normal file
@@ -0,0 +1,45 @@
|
||||
///
|
||||
/// \file hashConduitGroup.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef HASHCONDUIT_GROUP_H
|
||||
#define HASHCONDUIT_GROUP_H
|
||||
|
||||
#include "conduitGroup.h"
|
||||
|
||||
// boost include
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
using boost::multi_index_container;
|
||||
// namespace multi-indexing of reference handles to CAFEConduit objects
|
||||
using namespace boost::multi_index;
|
||||
|
||||
struct by_groupHandle{};
|
||||
struct by_groupID{};
|
||||
struct by_groupName{};
|
||||
|
||||
typedef multi_index_container<
|
||||
ConduitGroup,
|
||||
indexed_by<
|
||||
ordered_unique<
|
||||
tag<by_groupHandle>, BOOST_MULTI_INDEX_MEMBER(ConduitGroup, unsigned int, groupHandle)>,
|
||||
ordered_non_unique<
|
||||
tag<by_groupID>, BOOST_MULTI_INDEX_MEMBER(ConduitGroup, CA_SYNC_GID, groupID)>,
|
||||
ordered_non_unique<
|
||||
tag<by_groupName>, BOOST_MULTI_INDEX_MEMBER(ConduitGroup, std::string, groupName)>,
|
||||
hashed_unique<member<ConduitGroup, unsigned int, &ConduitGroup::groupHandle> >
|
||||
>
|
||||
> cafeGroup_set;
|
||||
|
||||
typedef cafeGroup_set::index<by_groupID>::type cafeGroup_set_by_groupID;
|
||||
typedef cafeGroup_set::index<by_groupHandle>::type cafeGroup_set_by_groupHandle;
|
||||
typedef cafeGroup_set::index<by_groupName>::type cafeGroup_set_by_groupName;
|
||||
|
||||
#endif
|
||||
37
include/helper.h
Normal file
37
include/helper.h
Normal file
@@ -0,0 +1,37 @@
|
||||
///
|
||||
/// \file helper.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef HELPER_H
|
||||
#define HELPER_H
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <cmath>
|
||||
#include <cadef.h>
|
||||
#include <cafeEnum.h>
|
||||
#include <defines.h>
|
||||
|
||||
class Helper
|
||||
{
|
||||
public:
|
||||
Helper(){};
|
||||
|
||||
void removeLeadingAndTrailingSpacesDbrString(const char * _pv, char pvStripped[MAX_STRING_SIZE]);
|
||||
void removeLeadingAndTrailingSpacesPseudo(const char * _pv, char pvStripped[PVGROUP_PSEUDO_SIZE]);
|
||||
void removeLeadingAndTrailingSpaces(const char * _pv, char pvStripped[PVNAME_SIZE]);
|
||||
unsigned int convertToUniqueNumber(const char * pv, ca_client_context * ccc, unsigned int ghs);
|
||||
unsigned int convertToUniqueNumber(const char * pv, ca_client_context * ccc);
|
||||
CAFENUM::DBR_TYPE convertToCAFEDbrTypeClass(const chtype _chtype) const;
|
||||
|
||||
std::string concatToString(dbr_char_t * inChar, unsigned int nChar);
|
||||
};
|
||||
|
||||
#endif // HELPER_H
|
||||
2145
include/instant.cpp
Normal file
2145
include/instant.cpp
Normal file
File diff suppressed because it is too large
Load Diff
272
include/instant.h
Normal file
272
include/instant.h
Normal file
@@ -0,0 +1,272 @@
|
||||
///
|
||||
/// \file instant.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef INSTANT_H
|
||||
#define INSTANT_H
|
||||
|
||||
#include <transpose.h>
|
||||
#include <granules.h>
|
||||
#include <cafeEnum.h>
|
||||
|
||||
|
||||
template <class CTYPE> class Instant {
|
||||
|
||||
private:
|
||||
Transpose<dbr_string_t> renderString; // 0
|
||||
Transpose<dbr_short_t> renderShort; // 1
|
||||
Transpose<dbr_float_t> renderFloat; // 2
|
||||
Transpose<dbr_enum_t> renderEnum; // 3
|
||||
Transpose<dbr_char_t> renderChar; // 4
|
||||
Transpose<dbr_long_t> renderLong; // 5
|
||||
Transpose<dbr_double_t> renderDouble; // 6
|
||||
|
||||
CAFEStatus cafeStatus;
|
||||
Granules cafeGranules;
|
||||
|
||||
PolicyHelper policyHelper;
|
||||
|
||||
HandleHelper helper;
|
||||
|
||||
Conduit cc;
|
||||
ChannelTimeoutPolicy channelTimeoutPolicyGet;
|
||||
ChannelRequestPolicy channelRequestPolicyGet;
|
||||
ChannelRequestStatus channelRequestStatusGet;
|
||||
ChannelRequestDataTypePolicy channelRequestDataTypePolicy;
|
||||
|
||||
ChannelRequestMetaDataClient channelRequestMetaDataClient; //-1
|
||||
|
||||
int status;
|
||||
|
||||
int clientRequests(const unsigned int _handle, const chtype dbrType, const CTYPE * _val);
|
||||
|
||||
int clientRequests(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts,
|
||||
bool isCacheRequest);
|
||||
public:
|
||||
|
||||
Instant (){};
|
||||
~Instant (){};
|
||||
|
||||
int set(const unsigned int *handleArray, const unsigned int nelem,
|
||||
const chtype _dbrType, const CTYPE * val, int *statusArray);
|
||||
|
||||
int set(const unsigned int _handle, const chtype dbrType, const CTYPE * _val);
|
||||
|
||||
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
|
||||
|
||||
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){
|
||||
epicsTimeStamp ts;
|
||||
return get(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val){
|
||||
dbr_short_t alarmStatus; dbr_short_t alarmSeverity; epicsTimeStamp ts;
|
||||
return get(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
|
||||
|
||||
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){
|
||||
epicsTimeStamp ts;
|
||||
return getCache(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val){
|
||||
dbr_short_t alarmStatus; dbr_short_t alarmSeverity; epicsTimeStamp ts;
|
||||
return getCache(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int getCache(const unsigned int *handleArray, const unsigned int nelem,
|
||||
const chtype _dbrType, CTYPE * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
|
||||
|
||||
int getCache(const unsigned int *handleArray, const unsigned int nelem,
|
||||
const chtype _dbrType, CTYPE * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity ) {
|
||||
epicsTimeStamp * ts;
|
||||
return getCache(handleArray, nelem, _dbrType, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, const unsigned int nelem,
|
||||
const chtype _dbrType, CTYPE * val, int *statusArray) {
|
||||
dbr_short_t * alarmStatus; dbr_short_t * alarmSeverity; epicsTimeStamp * ts;
|
||||
return getCache(handleArray, nelem, _dbrType, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int setAndGet(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, CTYPE &valGet);
|
||||
int setAndMatch(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, const unsigned int handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSetV, const chtype dbrType, vector<CTYPE> valSet, vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int matchMany( const chtype dbrType, vector<CTYPE> valSet, vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int match( const chtype dbrType, CTYPE valSet, unsigned int handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set followed by an immediate get
|
||||
* \param handleSet input: handle
|
||||
* \param valSet input: string value to set
|
||||
* \param valGet output: string value to get
|
||||
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
|
||||
*/
|
||||
int setAndGetString(const unsigned int handleSet, string valSet, string &valGet) {
|
||||
#define __METHOD__ "Instant<CTYPE>::setAndGetString(const unsigned int handleSet, string valSet, string &valGet"
|
||||
//CheckPolicy
|
||||
|
||||
dbr_string_t valGetA[1]; dbr_string_t valSetA[1];
|
||||
|
||||
strcpy(valGetA[0],"0");
|
||||
valGet="0";
|
||||
|
||||
helper.removeLeadingAndTrailingSpaces(valSet.c_str(), valSetA[0]);
|
||||
|
||||
status=Instant::set(handleSet, DBR_STRING, valSetA);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
status=Instant::get(handleSet, DBR_STRING, valGetA);
|
||||
|
||||
valGet=valGetA[0];
|
||||
}
|
||||
else {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (strcmp(valSetA[0],valGetA[0])==0) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
//Check if number
|
||||
istringstream ins, ous;
|
||||
double oud=0;
|
||||
ous.clear();
|
||||
ous.str(valGetA[0]);
|
||||
ous>>oud;
|
||||
double ind=0;
|
||||
ins.clear();
|
||||
ins.str(valSetA[0]);
|
||||
ins>>ind;
|
||||
|
||||
|
||||
if ( !ous.fail() && !ins.fail()) {
|
||||
if (ind==oud) {return ICAFE_NORMAL;}
|
||||
}
|
||||
//Cater for enums that are refered to by their integer values in string format
|
||||
else if (!ins.fail()) {
|
||||
short enumval=-1;
|
||||
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
|
||||
//Convert integer to string
|
||||
|
||||
stringstream ss;
|
||||
ss << enumval;
|
||||
valGet= ss.str();
|
||||
if ((short)ind==enumval) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << endl;
|
||||
cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet.c_str() << endl;
|
||||
return ICAFE_SET_AND_GET_MISMATCH;
|
||||
#undef __METHOD__
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set followed by an immediate get
|
||||
* \param handleSet input: handle
|
||||
* \param valSet input: dbr_string_t value to set
|
||||
* \param valGet output: dbr_string_t value to get
|
||||
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
|
||||
*/
|
||||
int setAndGetDbrString(const unsigned int handleSet, dbr_string_t valSet, dbr_string_t &valGet) {
|
||||
#define __METHOD__ "Instant<CTYPE>::setAndGetDbrString(const unsigned int handleSet, dbr_string_tvalSet, dbr_string_t &valGet"
|
||||
//CheckPolicy
|
||||
|
||||
dbr_string_t valGetA[1]; dbr_string_t valSetA[1];
|
||||
|
||||
strcpy(valGetA[0],"0");
|
||||
strcpy(valGet,"0");
|
||||
|
||||
helper.removeLeadingAndTrailingSpaces(valSet, valSetA[0]);
|
||||
|
||||
status=Instant::set(handleSet, DBR_STRING, valSetA);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
status=Instant::get(handleSet, DBR_STRING, valGetA);
|
||||
|
||||
strcpy(valGet,valGetA[0]);
|
||||
}
|
||||
else {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (strcmp(valSetA[0],valGetA[0])==0) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
//Check if number
|
||||
//Check if number
|
||||
istringstream ins, ous;
|
||||
double oud=0;
|
||||
ous.clear();
|
||||
ous.str(valGetA[0]);
|
||||
ous>>oud;
|
||||
double ind=0;
|
||||
ins.clear();
|
||||
ins.str(valSetA[0]);
|
||||
ins>>ind;
|
||||
|
||||
if ( !ous.fail() && !ins.fail()) {
|
||||
if (ind==oud) {return ICAFE_NORMAL;}
|
||||
}
|
||||
//Cater for enums that are refered to by their integer values in string format
|
||||
else if (!ins.fail()) {
|
||||
short enumval=-1;
|
||||
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
|
||||
//Convert integer to string
|
||||
stringstream ss;
|
||||
ss << enumval;
|
||||
strcpy(valGet, ss.str().c_str());
|
||||
|
||||
if ((short) ind==enumval) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << endl;
|
||||
cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet << endl;
|
||||
return ICAFE_SET_AND_GET_MISMATCH;
|
||||
#undef __METHOD__
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#include "instant.cpp"
|
||||
|
||||
#endif // INSTANT_H
|
||||
|
||||
62
include/loadCollectionXMLParser.h
Normal file
62
include/loadCollectionXMLParser.h
Normal file
@@ -0,0 +1,62 @@
|
||||
///
|
||||
/// \file loadCollectionXMLParser.h
|
||||
/// \author Jan Chrin, George Prekas, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#ifndef LOADCOLLECTIONXMLPARSER_H
|
||||
#define LOADCOLLECTIONXMLPARSER_H
|
||||
|
||||
#include "deviceCollection.h"
|
||||
|
||||
#include <QtXml/QXmlDefaultHandler>
|
||||
|
||||
|
||||
class loadCollectionXMLParser : public QXmlDefaultHandler {
|
||||
public:
|
||||
loadCollectionXMLParser();
|
||||
virtual ~loadCollectionXMLParser();
|
||||
bool startElement(const QString& namespaceURI,
|
||||
const QString& localName,
|
||||
const QString& qName,
|
||||
const QXmlAttributes& atts);
|
||||
bool endElement (const QString& namespaceURI,
|
||||
const QString& localName,
|
||||
const QString& qName);
|
||||
bool characters (const QString& ch);
|
||||
|
||||
std::vector<deviceCollection> deviceCollectionV;
|
||||
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
NotWaiting,
|
||||
WaitingForDescription,
|
||||
WaitingForDevice,
|
||||
WaitingForAttribute
|
||||
} state;
|
||||
|
||||
deviceCollection devCollection;
|
||||
collectionMember cMember;
|
||||
|
||||
std::string attributeName;
|
||||
static const QString& tagConfig;
|
||||
static const QString& tagGroup;
|
||||
static const QString& tagDescription;
|
||||
static const QString& tagAttributes;
|
||||
static const QString& tagAttribute;
|
||||
static const QString& tagMember;
|
||||
static const QString& tagDevice;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // LOADCOLLECTIONXMLPARSER_H
|
||||
67
include/loadGroupXMLParser.h
Normal file
67
include/loadGroupXMLParser.h
Normal file
@@ -0,0 +1,67 @@
|
||||
///
|
||||
/// \file loadGroupXMLParser.h
|
||||
/// \author Jan Chrin, G. Prekas, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#ifndef LOADGROUPXMLPARSER_H
|
||||
#define LOADGROUPXMLPARSER_H
|
||||
|
||||
#include "deviceCollection.h"
|
||||
|
||||
#include <QtXml/QXmlDefaultHandler>
|
||||
|
||||
class loadGroupXMLParser : public QXmlDefaultHandler {
|
||||
public:
|
||||
loadGroupXMLParser();
|
||||
virtual ~loadGroupXMLParser();
|
||||
bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts);
|
||||
bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName);
|
||||
bool characters(const QString& ch);
|
||||
|
||||
std::vector<deviceGroup> groups;
|
||||
private:
|
||||
enum
|
||||
{
|
||||
NotWaiting,
|
||||
WaitingForDescription,
|
||||
WaitingForStatusGroup,
|
||||
WaitingForMember,
|
||||
WaitingForName,
|
||||
WaitingForNelem,
|
||||
WaitingForStatus,
|
||||
WaitingForRule,
|
||||
WaitingForDataType,
|
||||
WaitingForId,
|
||||
WaitingForAttrib,
|
||||
WaitingForCollectiveType
|
||||
} state;
|
||||
deviceGroup group;
|
||||
//collectionMember member;
|
||||
collectionInGroup collection;
|
||||
std::string xmlMem;
|
||||
|
||||
const static QString& tagCollection_list;
|
||||
const static QString& tagGroup;
|
||||
const static QString& tagDescription;
|
||||
const static QString& tagStatusGroup;
|
||||
const static QString& tagMember;
|
||||
const static QString& tagName;
|
||||
const static QString& tagNelem;
|
||||
const static QString& tagStatus;
|
||||
const static QString& tagRule;
|
||||
const static QString& tagDataType;
|
||||
const static QString& tagCollection;
|
||||
const static QString& tagId;
|
||||
const static QString& tagAttrib;
|
||||
const static QString& tagCollectiveType;
|
||||
};
|
||||
|
||||
#endif /* LOADGROUPXMLPARSER_H */
|
||||
|
||||
#endif
|
||||
483
include/makefile
Normal file
483
include/makefile
Normal file
@@ -0,0 +1,483 @@
|
||||
# makefile.in generated by automake 1.11.1 from makefile.am.
|
||||
# include/makefile. Generated from makefile.in by configure.
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
|
||||
pkgdatadir = $(datadir)/cafe
|
||||
pkgincludedir = $(includedir)/cafe
|
||||
pkglibdir = $(libdir)/cafe
|
||||
pkglibexecdir = $(libexecdir)/cafe
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = x86_64-unknown-linux-gnu
|
||||
host_triplet = x86_64-unknown-linux-gnu
|
||||
#am__append_1 = PyCafe_api.h
|
||||
#am__append_2 = PyCafe.h
|
||||
subdir = include
|
||||
DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/makefile.am \
|
||||
$(srcdir)/makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/./include/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__include_HEADERS_DIST = cafe.h cafeCache.h cafeConvert.h \
|
||||
cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
|
||||
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h \
|
||||
caopCodes.h channelRegalia.h conduit.h \
|
||||
conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h \
|
||||
conduitFriends.h connect.h defines.h deviceCollection.h \
|
||||
exceptions.h exceptionsHelper.h global.h enumStrings.h \
|
||||
granules.h handleHelper.h hashConduit.h helper.h instant.h \
|
||||
instant.cpp loadCollectionXMLParser.h loadGroupXMLParser.h \
|
||||
methodCallbacks.h policies.h policyHelper.h PVCtrlHolder.h \
|
||||
PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
|
||||
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h \
|
||||
PyCafe_api.h PyCafe.h
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(includedir)"
|
||||
HEADERS = $(include_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run aclocal-1.11
|
||||
AMTAR = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run tar
|
||||
AM_CPPFLAGS = -fexceptions -fPIC -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
|
||||
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
|
||||
AUTOMAKE = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run automake-1.11
|
||||
AWK = gawk
|
||||
CAFE_CPPFLAGS = -I$(top_srcdir)/include
|
||||
CC = gcc
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -g -O2
|
||||
CPP = gcc -E
|
||||
CPPFLAGS = -fexceptions -fPIC -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 = g++
|
||||
CXXCPP = g++ -E
|
||||
CXXDEPMODE = depmode=gcc3
|
||||
CXXFLAGS = -g -O2
|
||||
CYGPATH_W = echo
|
||||
DEFS = -DHAVE_CONFIG_H
|
||||
DEPDIR = .deps
|
||||
DSYMUTIL =
|
||||
DUMPBIN =
|
||||
ECHO_C =
|
||||
ECHO_N = -n
|
||||
ECHO_T =
|
||||
EGREP = /bin/grep -E
|
||||
EXEEXT =
|
||||
FGREP = /bin/grep -F
|
||||
GREP = /bin/grep
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
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
|
||||
LIBOBJS =
|
||||
LIBS = -lQtXml -lQtCore
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LIPO =
|
||||
LN_S = ln -s
|
||||
LTLIBOBJS =
|
||||
MAKEINFO = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run makeinfo
|
||||
MKDIR_P = /bin/mkdir -p
|
||||
NM = /usr/bin/nm -B
|
||||
NMEDIT =
|
||||
OBJDUMP = objdump
|
||||
OBJEXT = o
|
||||
OTOOL =
|
||||
OTOOL64 =
|
||||
PACKAGE = cafe
|
||||
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
|
||||
PACKAGE_NAME = CAFE
|
||||
PACKAGE_STRING = CAFE 1.0.0
|
||||
PACKAGE_TARNAME = cafe
|
||||
PACKAGE_VERSION = 1.0.0
|
||||
PATH_SEPARATOR = :
|
||||
RANLIB = ranlib
|
||||
SED = /bin/sed
|
||||
SET_MAKE =
|
||||
SHELL = /bin/sh
|
||||
STRIP = strip
|
||||
VERSION = 1.0.0
|
||||
abs_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/include
|
||||
abs_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/include
|
||||
abs_top_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
|
||||
abs_top_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
|
||||
ac_ct_CC = gcc
|
||||
ac_ct_CXX = g++
|
||||
ac_ct_DUMPBIN =
|
||||
am__include = include
|
||||
am__leading_dot = .
|
||||
am__quote =
|
||||
am__tar = ${AMTAR} chof - "$$tardir"
|
||||
am__untar = ${AMTAR} xf -
|
||||
bindir = ${exec_prefix}/bin
|
||||
build = x86_64-unknown-linux-gnu
|
||||
build_alias =
|
||||
build_cpu = x86_64
|
||||
build_os = linux-gnu
|
||||
build_vendor = unknown
|
||||
builddir = .
|
||||
datadir = ${datarootdir}
|
||||
datarootdir = ${prefix}/share
|
||||
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
|
||||
dvidir = ${docdir}
|
||||
exec_prefix = ${prefix}
|
||||
host = x86_64-unknown-linux-gnu
|
||||
host_alias =
|
||||
host_cpu = x86_64
|
||||
host_os = linux-gnu
|
||||
host_vendor = unknown
|
||||
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
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
lt_ECHO = echo
|
||||
mandir = ${datarootdir}/man
|
||||
mkdir_p = /bin/mkdir -p
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.3.0-final-1
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
sharedstatedir = ${prefix}/com
|
||||
srcdir = .
|
||||
sysconfdir = ${prefix}/etc
|
||||
target_alias =
|
||||
top_build_prefix = ../
|
||||
top_builddir = ..
|
||||
top_srcdir = ..
|
||||
include_HEADERS = cafe.h cafeCache.h cafeConvert.h cafeDataType.h \
|
||||
cafeDataTypeHelper.h cafeEnum.h cafeEnumStrings.h cafeRoast.h \
|
||||
cafeVectors.h cafeXML.h caopCodes.h channelRegalia.h conduit.h \
|
||||
conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h \
|
||||
conduitFriends.h connect.h defines.h deviceCollection.h \
|
||||
exceptions.h exceptionsHelper.h global.h enumStrings.h \
|
||||
granules.h handleHelper.h hashConduit.h helper.h instant.h \
|
||||
instant.cpp loadCollectionXMLParser.h loadGroupXMLParser.h \
|
||||
methodCallbacks.h policies.h policyHelper.h PVCtrlHolder.h \
|
||||
PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
|
||||
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h \
|
||||
$(am__append_1) $(am__append_2)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/makefile.in: $(srcdir)/makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu include/makefile
|
||||
.PRECIOUS: makefile
|
||||
makefile: $(srcdir)/makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(includedir)" && rm -f $$files
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: makefile $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-includeHEADERS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool ctags distclean distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am \
|
||||
install-includeHEADERS install-info install-info-am \
|
||||
install-man install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS
|
||||
|
||||
|
||||
#if HAVE_ZEROMQ
|
||||
#include_HEADERS += cafeService.h zhelpers.h
|
||||
#endif
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
27
include/makefile.am
Normal file
27
include/makefile.am
Normal file
@@ -0,0 +1,27 @@
|
||||
## Makefile.am - used by automake to produce makefile.in
|
||||
##
|
||||
## input file for production of cafe library
|
||||
##
|
||||
|
||||
include_HEADERS = cafe.h cafeCache.h cafeConvert.h cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
|
||||
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h caopCodes.h channelRegalia.h \
|
||||
conduit.h conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h conduitFriends.h \
|
||||
connect.h defines.h deviceCollection.h exceptions.h exceptionsHelper.h global.h \
|
||||
enumStrings.h granules.h handleHelper.h hashConduit.h helper.h instant.h instant.cpp \
|
||||
loadCollectionXMLParser.h loadGroupXMLParser.h methodCallbacks.h policies.h policyHelper.h \
|
||||
PVCtrlHolder.h PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
|
||||
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h
|
||||
|
||||
|
||||
|
||||
if HAVE_PYTHON_
|
||||
include_HEADERS += PyCafe_api.h
|
||||
endif
|
||||
|
||||
if HAVE_PYCAFE_EXT
|
||||
include_HEADERS += PyCafe.h
|
||||
endif
|
||||
|
||||
#if HAVE_ZEROMQ
|
||||
#include_HEADERS += cafeService.h zhelpers.h
|
||||
#endif
|
||||
25
include/methodCallbacks.h
Normal file
25
include/methodCallbacks.h
Normal file
@@ -0,0 +1,25 @@
|
||||
///
|
||||
/// \file methodCallbacks.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef METHODCALLBACKS_H
|
||||
#define METHODCALLBACKS_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
namespace CALLBACK_CAFE {
|
||||
#if HAVE_PYTHON_H
|
||||
void PyHandlerPut( struct event_handler_args args);
|
||||
void PyHandlerGet( struct event_handler_args args);
|
||||
#endif
|
||||
void handlerPut( struct event_handler_args args) ;
|
||||
void handlerGet( struct event_handler_args args) ;
|
||||
void handlerGetCtrl( struct event_handler_args args) ;
|
||||
void handlerGetSTSACK( struct event_handler_args args) ;
|
||||
void handlerGetClassName( struct event_handler_args args) ;
|
||||
};
|
||||
|
||||
#endif // METHODCALLBACKS_H
|
||||
536
include/policies.h
Normal file
536
include/policies.h
Normal file
@@ -0,0 +1,536 @@
|
||||
///
|
||||
/// \file policies.h
|
||||
///
|
||||
/// Policies are:
|
||||
/// ChannelCreatePolicy
|
||||
/// ChannelOpenPolicy
|
||||
/// ChannelRequestDataTypePolicy
|
||||
/// ChannelGetCacheWaitPolicy
|
||||
/// ChannelGetActionWhenMonitorPolicy
|
||||
/// ChannelTimeoutPolicy
|
||||
/// ChannelRequestPolicy
|
||||
/// ChannelMonitorPolicy
|
||||
///
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef POLICIES_H
|
||||
#define POLICIES_H
|
||||
|
||||
#include <cafeEnum.h>
|
||||
#include <defines.h>
|
||||
#include <statusCodes.h>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
//include <config.h> //In the below!
|
||||
#include <methodCallbacks.h>
|
||||
|
||||
//include <enumStrings.h>
|
||||
|
||||
using namespace CAFENUM;
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Define Policy for printing messages
|
||||
*/
|
||||
class PrintErrorPolicy{
|
||||
protected:
|
||||
bool invalidHandle;
|
||||
bool info;
|
||||
bool warn;
|
||||
bool error;
|
||||
public:
|
||||
bool setInvalidHandle(bool inv) {return invalidHandle=inv;}
|
||||
bool setInfo(bool i) {return info=i;}
|
||||
bool setWarn(bool w) {return warn=w;}
|
||||
bool setError(bool e) {return error=e;}
|
||||
bool setAll(bool a) {invalidHandle=a; info=a; warn=a; error=a; return a;}
|
||||
bool getInvalidHandle() {return invalidHandle;}
|
||||
bool getInfo() {return info;}
|
||||
bool getWarn() {return warn;}
|
||||
bool getError() {return error;}
|
||||
PrintErrorPolicy():invalidHandle(false),info(true),warn(true),error(true){};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Define Policy for creating channel; this just sets the priority level
|
||||
* for dispatch within the server or network
|
||||
*/
|
||||
class ChannelCreatePolicy{
|
||||
private:
|
||||
unsigned short priority;
|
||||
static void callbackHandlerCreate(struct connection_handler_args args);
|
||||
//special method to find handle thru conduit_set iterator
|
||||
pCallbackConnection handler;
|
||||
public:
|
||||
pCallbackConnection getHandler(){return handler;};
|
||||
void setHandler(pCallbackConnection h){handler=h;};
|
||||
unsigned short getPriority() const {return priority;}
|
||||
unsigned short setPriority(unsigned short p){
|
||||
priority=std::min(p,(unsigned short) CA_SERVER_DISPATCH_PRIORITY_MAX);
|
||||
return priority;
|
||||
}
|
||||
ChannelCreatePolicy():priority(CA_SERVER_DISPATCH_PRIORITY_DEFAULT),handler(callbackHandlerCreate){};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Define Policy to open/close/monitor channels one-by-one
|
||||
* or to accumulate messages for later dispatch
|
||||
*/
|
||||
class ChannelOpenPolicy{
|
||||
public:
|
||||
|
||||
//Constructors
|
||||
ChannelOpenPolicy():whenKind(FLUSH_AFTER_EACH_CHANNEL_CREATION), flushKind(WITH_PEND_EVENT),
|
||||
timeout(DEFAULT_TIMEOUT_PEND_EVENT),defaultTimeout(DEFAULT_TIMEOUT_PEND_EVENT){};
|
||||
|
||||
ChannelOpenPolicy(ChannelFlushSendBufferPolicyKind f,
|
||||
ChannelWhenToFlushSendBufferPolicyKind w, double t){
|
||||
if (f>=WITH_PEND_EVENT && f<=WITH_POLL)
|
||||
{setFlushSendBufferKind(f);} else {std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << endl;}
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{setWhenToFlushSendBuffer(w);} else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;}
|
||||
setTimeout(t), setDefaultTimeout(DEFAULT_TIMEOUT_PEND_EVENT);
|
||||
};
|
||||
~ChannelOpenPolicy(){};
|
||||
private:
|
||||
ChannelWhenToFlushSendBufferPolicyKind whenKind;
|
||||
ChannelFlushSendBufferPolicyKind flushKind;
|
||||
double timeout;
|
||||
double defaultTimeout;
|
||||
public:
|
||||
void flushSendBufferNow() {
|
||||
switch(flushKind){
|
||||
case WITH_PEND_EVENT:
|
||||
ca_pend_event(timeout);
|
||||
break;
|
||||
case WITH_PEND_IO:
|
||||
ca_pend_io(timeout);
|
||||
break;
|
||||
case WITH_FLUSH_IO:
|
||||
ca_flush_io();
|
||||
break;
|
||||
case WITH_POLL:
|
||||
ca_poll();
|
||||
break;
|
||||
default:
|
||||
ca_pend_event(timeout);
|
||||
break;
|
||||
}
|
||||
//Reset to default
|
||||
setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
|
||||
};
|
||||
ChannelFlushSendBufferPolicyKind getFlushSendBufferKind() const {return flushKind;}
|
||||
ChannelWhenToFlushSendBufferPolicyKind getWhenToFlushSendBuffer() const {return whenKind;}
|
||||
double getTimeout() const {
|
||||
//std::cout << "CHANNELOPENPOLICY " << " *GET* timeout " << timeout << endl;
|
||||
return timeout;
|
||||
}
|
||||
|
||||
double getDefaultTimeout() const {return defaultTimeout;}
|
||||
|
||||
void setFlushSendBufferKind(ChannelFlushSendBufferPolicyKind f){if (f>=WITH_FLUSH_IO && f<=WITH_POLL)
|
||||
{flushKind=f;} else {std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << endl;}};
|
||||
|
||||
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind w) {
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{whenKind=w;} else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;}};
|
||||
|
||||
|
||||
double setTimeout(double t) {
|
||||
if (t<0){
|
||||
std::cout << "CHANNELOPENPOLICY:setTimeout " << t << " seconds is an illegal value!" << endl;
|
||||
return timeout;
|
||||
}
|
||||
else if (t==0) {
|
||||
timeout=0.001;
|
||||
std::cout << "CHANNELOPENPOLICY:setTimeout " << " A value of zero would block the ioc for ever! "<< endl;
|
||||
std::cout << "CHANNELOPENPOLICY:setTimeout " << " Setting timeout to " << timeout << endl;
|
||||
return timeout=0.001;
|
||||
}
|
||||
return timeout=t;}
|
||||
|
||||
double setDefaultTimeout(double t) {
|
||||
if (t<0){
|
||||
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << t << " seconds is an illegal value!" << endl;
|
||||
return defaultTimeout;
|
||||
}
|
||||
else if (t==0) {
|
||||
defaultTimeout=0.001;
|
||||
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " A value of zero would block the ioc for ever! "<< endl;
|
||||
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " Setting timeout to " << defaultTimeout << endl;
|
||||
return defaultTimeout;
|
||||
}
|
||||
return defaultTimeout=t;}
|
||||
|
||||
double setTimeoutToDefault() {return timeout=defaultTimeout;}
|
||||
|
||||
void setPolicy(ChannelWhenToFlushSendBufferPolicyKind w, ChannelFlushSendBufferPolicyKind f, double t){
|
||||
if (f>=WITH_FLUSH_IO && f<=WITH_POLL){flushKind=f;}
|
||||
else {std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << endl;}
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{whenKind=w;}
|
||||
else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;}
|
||||
timeout = t;
|
||||
defaultTimeout = t;
|
||||
//std::cout << "CHANNELOPENPOLICY " << " timeout " << timeout << endl;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define Policy to control datatype conversion for data transfer
|
||||
*/
|
||||
class ChannelRequestDataTypePolicy{
|
||||
private:
|
||||
CAFENUM::ChannelRequestDataTypePolicyKind requestKind;
|
||||
public:
|
||||
void setRequestKind(CAFENUM::ChannelRequestDataTypePolicyKind rk) {
|
||||
if (rk>=CAFENUM::NATIVE_DATATYPE && rk<=CAFENUM::LOWEST_DATATYPE)
|
||||
{requestKind=rk;}
|
||||
else {std::cout << rk << " is an INVALID ChannelDataTypePolicyKind" << endl;}
|
||||
};
|
||||
|
||||
CAFENUM::ChannelRequestDataTypePolicyKind getRequestKind() const {return requestKind;}
|
||||
//Constructors
|
||||
ChannelRequestDataTypePolicy():requestKind(CAFENUM::NATIVE_DATATYPE){};
|
||||
ChannelRequestDataTypePolicy(CAFENUM::ChannelRequestDataTypePolicyKind rk){requestKind=rk;};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define Policy to control wait/nowait strategy in getCache operations
|
||||
*/
|
||||
class ChannelGetCacheWaitPolicy{
|
||||
private:
|
||||
CAFENUM::ChannelGetCacheWaitPolicyKind getCacheWaitKind;
|
||||
public:
|
||||
void setWaitKind(CAFENUM::ChannelGetCacheWaitPolicyKind wk) {
|
||||
if (wk>=CAFENUM::GET_CACHE_NO_WAIT && wk<=CAFENUM::GET_CACHE_WAIT)
|
||||
{getCacheWaitKind=wk;}
|
||||
else {std::cout << wk << " is an INVALID ChannelGetCacheWaitKind" << endl;}
|
||||
};
|
||||
|
||||
CAFENUM::ChannelGetCacheWaitPolicyKind getWaitKind() const {return getCacheWaitKind;}
|
||||
//Constructors
|
||||
ChannelGetCacheWaitPolicy():getCacheWaitKind(CAFENUM::GET_CACHE_WAIT){};
|
||||
ChannelGetCacheWaitPolicy(CAFENUM::ChannelGetCacheWaitPolicyKind wk){getCacheWaitKind=wk;};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define Policy to control whether the get operations targets the ioc or not when there is a monitor
|
||||
*/
|
||||
class ChannelGetActionWhenMonitorPolicy{
|
||||
private:
|
||||
CAFENUM::ChannelGetActionWhenMonitorPolicyKind getActionWhenMonitorKind;
|
||||
public:
|
||||
void setActionKind(CAFENUM::ChannelGetActionWhenMonitorPolicyKind ak) {
|
||||
if (ak>=CAFENUM::GET_FROM_CACHE && ak<=CAFENUM::GET_FROM_IOC)
|
||||
{getActionWhenMonitorKind=ak;}
|
||||
else {std::cout << ak << " is an INVALID ChannelGetActionWhenMonitorKind" << endl;}
|
||||
};
|
||||
|
||||
CAFENUM::ChannelGetActionWhenMonitorPolicyKind getActionKind() const {return getActionWhenMonitorKind;}
|
||||
//Constructors
|
||||
ChannelGetActionWhenMonitorPolicy():getActionWhenMonitorKind(CAFENUM::GET_FROM_IOC){};
|
||||
ChannelGetActionWhenMonitorPolicy(CAFENUM::ChannelGetActionWhenMonitorPolicyKind ak){getActionWhenMonitorKind=ak;};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines Timeout policy for channel access transactions
|
||||
* and configures the number of transaction attempts in the
|
||||
* event of an ECA_TIMEOUT error; deltaTimeout gives the
|
||||
* increment in timeout for each additional attempt.
|
||||
*/
|
||||
class ChannelTimeoutPolicy{
|
||||
private:
|
||||
bool selfGoverningTimeout;
|
||||
double timeout;
|
||||
double deltaTimeout;
|
||||
unsigned short ntries;
|
||||
double defaultTimeout;
|
||||
public:
|
||||
bool getSelfGoverningTimeout() const {return selfGoverningTimeout;};
|
||||
void setSelfGoverningTimeout(bool sgt){selfGoverningTimeout=sgt;};
|
||||
double getTimeout() const {return timeout;};
|
||||
double getDefaultTimeout() const {return defaultTimeout;}
|
||||
double getDeltaTimeout() const {return deltaTimeout;};
|
||||
unsigned short getNtries() const {return ntries;};
|
||||
double setTimeout(double t) {timeout=max(t,TIMEOUT_PEND_IO_MIN);
|
||||
return timeout=min(timeout,TIMEOUT_PEND_IO_MAX);};
|
||||
double setDeltaTimeout(double dt) { deltaTimeout=max(dt,PEND_IO_INCREMENT_TIME_MIN);
|
||||
return deltaTimeout=min(deltaTimeout,PEND_IO_INCREMENT_TIME_MAX);};
|
||||
unsigned short setNtries(unsigned short nt) {return ntries=min(nt, PEND_IO_MAX_TRIES);};
|
||||
|
||||
double setDefaultTimeout(double t) {return defaultTimeout=t;}
|
||||
double setTimeoutToDefault() {return timeout=defaultTimeout;}
|
||||
|
||||
ChannelTimeoutPolicy():selfGoverningTimeout(DEFAULT_SELF_GOVERNING_TIMEOUT),
|
||||
timeout(DEFAULT_TIMEOUT_PEND_IO),deltaTimeout(DEFAULT_PEND_IO_INCREMENT_TIME),
|
||||
ntries(DEFAULT_PEND_IO_NO_TRIES),defaultTimeout(DEFAULT_TIMEOUT_PEND_IO){};
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Define Policy to get/set channels whether in blocking/non-blocking mode:
|
||||
* Blocking can be achieved with or without callback
|
||||
*/
|
||||
class ChannelRequestPolicy{
|
||||
private:
|
||||
|
||||
ChannelWhenToFlushSendBufferPolicyKind whenKind; // used for set
|
||||
ChannelWaitForResponsePolicyKind waitKind; //only for WITH_CALLBACK WAIT or NO_WAIT
|
||||
|
||||
ChannelRequestPolicyKind methodKind;
|
||||
|
||||
pCallback handler; // for blockingKind=WITH_CALLBACK_DEFAULT or WITH_CALLBACK_USER_SUPPLIED
|
||||
int callbackStatus; // used by CAFE::waitForGetEvent() to record status of callback
|
||||
|
||||
public:
|
||||
|
||||
ChannelWhenToFlushSendBufferPolicyKind getWhenToFlushSendBuffer() const {return whenKind;}
|
||||
ChannelWaitForResponsePolicyKind getWaitKind() const {return waitKind;};
|
||||
|
||||
ChannelRequestPolicyKind getMethodKind() const {return methodKind;};
|
||||
|
||||
pCallback getHandler() const {return handler;};
|
||||
|
||||
int getCallbackStatus() const {return callbackStatus;};
|
||||
|
||||
void setHandler(pCallback h){if (h!=NULL) {handler=h; methodKind=WITH_CALLBACK_USER_SUPPLIED;}};
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
void setPyHandlerGet(){handler= CALLBACK_CAFE::PyHandlerGet; methodKind=WITH_CALLBACK_USER_SUPPLIED;}; //CAFE_CALLBACK::PyHandlerGet
|
||||
void setPyHandlerPut(){handler= CALLBACK_CAFE::PyHandlerPut; methodKind=WITH_CALLBACK_USER_SUPPLIED;}; //CAFE_CALLBACK::PyHandlerPut
|
||||
#endif
|
||||
|
||||
void setMethodKind(ChannelRequestPolicyKind m) { if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
|
||||
{methodKind=m;} else {std::cout << m << " is an INVALID ChannelRequestPolicyKind" << std::endl;} };
|
||||
|
||||
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind w) {
|
||||
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{whenKind=w;} else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;}};
|
||||
|
||||
void setWaitKind(ChannelWaitForResponsePolicyKind r) { if (r>=WAIT && r<=NO_WAIT)
|
||||
{waitKind=r;} else {std::cout << r << " is an INVALID ChannelWaitForResponsePolicyKind" << std::endl;}};
|
||||
|
||||
void setCallbackStatus (int cstatus) {callbackStatus =cstatus;};
|
||||
|
||||
void setPolicy(
|
||||
ChannelWhenToFlushSendBufferPolicyKind w, ChannelWaitForResponsePolicyKind r,
|
||||
ChannelRequestPolicyKind m)
|
||||
{
|
||||
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{whenKind=w;} else {std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
|
||||
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;
|
||||
std::cout << "Sticking to default value ChannelWhenToFlushSendBufferPolicyKind=" << whenKind << std::endl;
|
||||
}
|
||||
if (r>=WAIT && r<=NO_WAIT)
|
||||
{waitKind=r;} else {std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
|
||||
std::cout << r<< " is an INVALID ChannelWaitForResponsePolicyKind" << endl;
|
||||
std::cout << "Sticking to default value ChannelWaitForRespomsePolicyKind=" << waitKind << std::endl;
|
||||
}
|
||||
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
|
||||
{methodKind=m;} else {std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
|
||||
std::cout << r<< " is an INVALID ChannelRequestPolicyKind" << endl;
|
||||
std::cout << "Sticking to default value ChannelRequestPolicyKind=" << methodKind << std::endl;
|
||||
}
|
||||
|
||||
if (methodKind==WITHOUT_CALLBACK && waitKind==NO_WAIT) {
|
||||
std::cout << "WARNING when setting ChannelRequestPolicy " << std::endl;
|
||||
std::cout << "waitKind=NO_WAIT does not apply when methodKind=WITHOUT_CALLBACK " << std::endl;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//Constructors
|
||||
ChannelRequestPolicy():
|
||||
whenKind(FLUSH_AFTER_EACH_MESSAGE),waitKind(WAIT),methodKind(WITH_CALLBACK_DEFAULT), //WITHOUT_CALLBACK),
|
||||
callbackStatus(ICAFE_NORMAL){
|
||||
handler=NULL;
|
||||
|
||||
};
|
||||
|
||||
ChannelRequestPolicy(ChannelRequestPolicyKind b){
|
||||
if (b>=WITHOUT_CALLBACK && b<=WITH_CALLBACK_USER_SUPPLIED)
|
||||
{methodKind=b;} else {cout << b << " is anINVALID ChannelRequestPolicyKind" << endl;}
|
||||
handler=NULL;
|
||||
callbackStatus=ICAFE_NORMAL;
|
||||
whenKind=FLUSH_AFTER_EACH_MESSAGE;
|
||||
waitKind=WAIT;
|
||||
};
|
||||
|
||||
ChannelRequestPolicy(pCallback h){
|
||||
handler=h;
|
||||
methodKind=WITH_CALLBACK_DEFAULT;
|
||||
whenKind=FLUSH_AFTER_EACH_MESSAGE;
|
||||
waitKind=WAIT;
|
||||
callbackStatus =ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
~ChannelRequestPolicy(){};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Defines policy to start a monitor on a channel
|
||||
* upon first connection. Note that CAFE will not
|
||||
* start a monitor on a channel if it is not connected
|
||||
* as the datatype in such cases is unknown. \n
|
||||
* The monitor is rather placed in a monitor_in_waiting
|
||||
* pseudo-queue and only started upon connection
|
||||
*/
|
||||
class MonitorPolicy
|
||||
{
|
||||
friend class Conduit;
|
||||
friend class Connect;
|
||||
private:
|
||||
static unsigned int idNext;
|
||||
chtype dataType; //specify primitive datatype for monitoring
|
||||
chtype dbrDataType; //1
|
||||
CAFENUM::DBR_TYPE cafeDbrType;
|
||||
unsigned int nelem; //2
|
||||
//chid channelID; //3
|
||||
unsigned int mask; //4
|
||||
pCallback handler;//5
|
||||
void * userArgs; //6
|
||||
evid eventID; //output
|
||||
int status; //output
|
||||
unsigned int id;
|
||||
|
||||
static void callbackHandlerMonitor(struct event_handler_args args);
|
||||
static void PyCallbackHandlerMonitorData(struct event_handler_args args); //pushes pvd,handle,pvname
|
||||
static void PyCallbackHandlerMonitor(struct event_handler_args args); //pushes handle
|
||||
|
||||
void setEventID(evid e){eventID=e;};
|
||||
|
||||
public:
|
||||
MonitorPolicy():dataType((CAFE_DATATYPE) CAFE_NOT_REQUESTED),
|
||||
dbrDataType((CAFE_DATATYPE) CAFE_NOT_REQUESTED),
|
||||
cafeDbrType((CAFENUM::DBR_TYPE) CAFENUM::DBR_TIME),
|
||||
nelem(0), mask(DBE_VALUE | DBE_LOG | DBE_ALARM),
|
||||
handler(callbackHandlerMonitor), userArgs(NULL), eventID(NULL),
|
||||
status(ICAFE_NORMAL){
|
||||
++idNext;
|
||||
id = idNext;
|
||||
};
|
||||
chtype getDataType() const {return dataType;};
|
||||
chtype getDbrDataType() const {return dbrDataType;};
|
||||
CAFENUM::DBR_TYPE getCafeDbrType() const {return cafeDbrType;};
|
||||
unsigned int getNelem() const {return nelem;};
|
||||
//chid getChannelID() const {return channelID;};
|
||||
unsigned int getMask() const {return mask;};
|
||||
|
||||
bool maskHasDBE_PROPERTY() const {bool has=false;
|
||||
# if (EPICS_MAJOR==3 && EPICS_MINOR>=14 && EPICS_PATCH >=11)
|
||||
mask & DBE_PROPERTY ? has=true : has=false;
|
||||
# endif
|
||||
return has;
|
||||
}; //8
|
||||
bool maskHasDBE_VALUE() const {bool has=false; mask & DBE_VALUE ? has=true : has=false; return has;}; //4
|
||||
bool maskHasDBE_LOG() const {bool has=false; mask & DBE_LOG ? has=true : has=false; return has;}; //2
|
||||
bool maskHasDBE_ALARM() const {bool has=false; mask & DBE_ALARM ? has=true : has=false; return has;}; //1
|
||||
pCallback getHandler() const {return handler;};
|
||||
void * getUserArgs() const {return userArgs;};
|
||||
//On most platforms pointers and longs are the same size, but ints and pointers often are not the same size
|
||||
//on 64bit platforms. If you convert (void*) to (long) no precision is lost, then by assigning the (long) to
|
||||
//an (int), it properly truncates the number to fit.
|
||||
unsigned int getUserArgsAsInt() const {return (unsigned int) ((long long) (void *)userArgs);};
|
||||
evid getEventID() const {return eventID;};
|
||||
unsigned int getMonitorID() const {return id;};
|
||||
int getStatus() const {return status;};
|
||||
unsigned int getID() const {return id;};
|
||||
|
||||
|
||||
void setMask(unsigned int m) {mask=m;};
|
||||
|
||||
void setPyHandler(){handler= PyCallbackHandlerMonitor;};
|
||||
void setPyHandlerData(){handler= PyCallbackHandlerMonitorData;};
|
||||
void setDefaultHandler(){handler= callbackHandlerMonitor;};
|
||||
|
||||
void setHandler(pCallback h){handler=h;};
|
||||
void setNelem(unsigned int n){nelem=n;};
|
||||
void setDataType(chtype dt){ if (dt < DBR_PUT_ACKT) {
|
||||
dataType=dt%(LAST_TYPE+1);} else {
|
||||
cout << "monitorPolicy FUNNY! " << dt << " is an INVALID DATATYPE! " << endl;
|
||||
return;}
|
||||
switch(cafeDbrType) {
|
||||
case CAFENUM::DBR_TIME:
|
||||
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_STS:
|
||||
dbrDataType=(dbf_type_to_DBR_STS (dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
dbrDataType=(dbf_type_to_DBR (dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_CTRL:
|
||||
dbrDataType=(dbf_type_to_DBR_CTRL(dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_GR:
|
||||
dbrDataType=(dbf_type_to_DBR_GR (dataType));
|
||||
break;
|
||||
default:
|
||||
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
|
||||
}
|
||||
};
|
||||
|
||||
void setCafeDbrType( CAFENUM::DBR_TYPE cdt) {if (cdt > DBR_PUT) {
|
||||
cout << "monitorPolicy FUNNY! " << cdt << " is an INVALID CAFENUM::DBR_TYPE! " << endl;
|
||||
return;} else { cafeDbrType=cdt;}
|
||||
//cout << "monitorPolicy Class: " << " cafeDbrType = " << cafeDbrType << endl;
|
||||
//cout << "setDataType: " << dataType << endl;
|
||||
switch(cafeDbrType) {
|
||||
case CAFENUM::DBR_TIME:
|
||||
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_STS:
|
||||
dbrDataType=(dbf_type_to_DBR_STS (dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
dbrDataType=(dbf_type_to_DBR (dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_CTRL:
|
||||
dbrDataType=(dbf_type_to_DBR_CTRL(dataType));
|
||||
break;
|
||||
case CAFENUM::DBR_GR:
|
||||
dbrDataType=(dbf_type_to_DBR_GR (dataType));
|
||||
break;
|
||||
default:
|
||||
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
|
||||
}
|
||||
//cout << "monitorPolicy Class: " << " dbrDataType = " << dbrDataType << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setUserArgs(void * u){userArgs=u;};
|
||||
void setStatus(int s){status=s;};
|
||||
void print() {
|
||||
cout << "-------------------------------" << endl;
|
||||
cout << "Monitor Policy " << endl;
|
||||
cout << "-------------------------------" << endl;
|
||||
cout << "dbrDataType = " << dbr_type_to_text(dbrDataType) << endl;
|
||||
cout << "nelem = " << nelem << endl;
|
||||
cout << "eventID = " << eventID << endl;
|
||||
cout << "monitorID = " << id << endl;
|
||||
cout << "-------------------------------" << endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // POLICIES_H
|
||||
144
include/policyHelper.h
Normal file
144
include/policyHelper.h
Normal file
@@ -0,0 +1,144 @@
|
||||
///
|
||||
/// \file policyHelper.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#ifndef POLICYHELPER_H
|
||||
#define POLICYHELPER_H
|
||||
|
||||
#include <cadef.h>
|
||||
#include "helper.h"
|
||||
#include "defines.h"
|
||||
#include "hashConduit.h"
|
||||
#include "hashConduitGroup.h"
|
||||
#include "conduitFriends.h"
|
||||
|
||||
class PolicyHelper : Helper
|
||||
{
|
||||
private:
|
||||
CAFEStatus cafeStatus;
|
||||
cafeConduit_set::iterator itcs;
|
||||
cafeGroup_set::iterator itgs;
|
||||
public:
|
||||
PolicyHelper(){};
|
||||
~PolicyHelper(){};
|
||||
|
||||
int getChannelGetActionWhenMonitorPolicy(unsigned int _handle, ChannelGetActionWhenMonitorPolicy & awmp);
|
||||
int setChannelGetActionWhenMonitorPolicy(unsigned int _handle, ChannelGetActionWhenMonitorPolicy awmp);
|
||||
int setChannelGetActionWhenMonitorPolicy(ChannelGetActionWhenMonitorPolicy awmp);
|
||||
int setChannelGetActionWhenMonitorPolicyAllHandles(ChannelGetActionWhenMonitorPolicy awmp){
|
||||
return setChannelGetActionWhenMonitorPolicy(awmp);}
|
||||
|
||||
int getChannelGetCacheWaitPolicy(unsigned int _handle, ChannelGetCacheWaitPolicy & cwp);
|
||||
int setChannelGetCacheWaitPolicy(unsigned int _handle, ChannelGetCacheWaitPolicy cwp);
|
||||
int setChannelGetCacheWaitPolicy(ChannelGetCacheWaitPolicy cwp);
|
||||
int setChannelGetCacheWaitPolicyAllHandles(ChannelGetCacheWaitPolicy cwp){
|
||||
return setChannelGetCacheWaitPolicy(cwp);}
|
||||
|
||||
int getChannelRequestDataTypePolicy(unsigned int _handle, ChannelRequestDataTypePolicy &crdtp);
|
||||
int setChannelRequestDataTypePolicy(unsigned int _handle, ChannelRequestDataTypePolicy crdtp);
|
||||
int setChannelRequestDataTypePolicy(ChannelRequestDataTypePolicy crdtp);
|
||||
int setChannelRequestDataTypePolicyAllHandles(ChannelRequestDataTypePolicy crdtp){
|
||||
return setChannelRequestDataTypePolicy(crdtp);}
|
||||
|
||||
int getChannelRequestPolicyGet (unsigned int _handle, ChannelRequestPolicy & crpg);
|
||||
int setChannelRequestPolicyGet (unsigned int _handle, ChannelRequestPolicy crpg);
|
||||
int setChannelRequestPolicyGet (ChannelRequestPolicy crpg);
|
||||
int setChannelRequestPolicyGetAllHandles (ChannelRequestPolicy crpg) {return setChannelRequestPolicyGet (crpg);}
|
||||
|
||||
int getChannelRequestPolicyPut (unsigned int _handle, ChannelRequestPolicy & crpp);
|
||||
int setChannelRequestPolicyPut (unsigned int _handle, ChannelRequestPolicy crpp);
|
||||
int setChannelRequestPolicyPut (ChannelRequestPolicy crpp);
|
||||
int setChannelRequestPolicyPutAllHandles (ChannelRequestPolicy crpp) {return setChannelRequestPolicyPut (crpp);}
|
||||
|
||||
int getChannelTimeoutPolicyGet (unsigned int _handle, ChannelTimeoutPolicy & ctpg);
|
||||
int setChannelTimeoutPolicyGet (unsigned int _handle, ChannelTimeoutPolicy ctpg);
|
||||
|
||||
int getChannelTimeoutPolicyPut (unsigned int _handle, ChannelTimeoutPolicy & ctpp);
|
||||
int setChannelTimeoutPolicyPut (unsigned int _handle, ChannelTimeoutPolicy ctpp);
|
||||
|
||||
|
||||
int setSelfGoverningTimeout(bool b);
|
||||
int setSelfGoverningTimeout(unsigned int _handle, bool b);
|
||||
int setSelfGoverningTimeoutPut(unsigned int _handle, bool p);
|
||||
int setSelfGoverningTimeoutGet(unsigned int _handle, bool g);
|
||||
int getSelfGoverningTimeout(unsigned int _handle, bool &p, bool &g);
|
||||
|
||||
int setSGSelfGoverningTimeout(bool b);
|
||||
int setSGSelfGoverningTimeout(unsigned int _handle, bool b);
|
||||
int setSGSelfGoverningTimeoutPut(unsigned int _handle, bool p);
|
||||
int setSGSelfGoverningTimeoutGet(unsigned int _handle, bool g);
|
||||
int getSGSelfGoverningTimeout(unsigned int _handle, bool &p, bool &g);
|
||||
|
||||
//Short cuts
|
||||
//put, get, put, get
|
||||
int getTimeoutRange (double &p, double &p2, double &g, double &g2) { int stp; int stg;
|
||||
stp=getTimeoutMin(p,g); stg=getTimeoutMax(p2, g2);
|
||||
if (stp!=ICAFE_NORMAL){return stp;} else if(stg!=ICAFE_NORMAL){return stg;}
|
||||
else {return ICAFE_NORMAL;}
|
||||
};
|
||||
|
||||
int getTimeoutMin (double &p, double &g);
|
||||
int getTimeoutMax (double &p, double &g);
|
||||
|
||||
int getTimeout (unsigned int _handle, double &p, double &g);
|
||||
//returns lesser of the two
|
||||
int getTimeout (unsigned int _handle, double &pg) {double p; double g; int st;
|
||||
st=getTimeout(_handle, p, g); pg=std::min(p,g); return st;}
|
||||
int getTimeoutPut(unsigned int _handle, double &p) {double g; return getTimeout(_handle, p, g);}
|
||||
int getTimeoutGet(unsigned int _handle, double &g) {double p; return getTimeout(_handle, p, g);}
|
||||
|
||||
int printTimeout ();
|
||||
int printTimeout (unsigned int _handle);
|
||||
|
||||
int setTimeout (double p, double g); // for all handles put and get separately
|
||||
int setTimeout (double pg){return setTimeout(pg, pg);};
|
||||
int setTimeoutPut(double p) {return setTimeout(p, (double) NULL);};
|
||||
int setTimeoutGet(double g) {return setTimeout((double) NULL, g);};
|
||||
|
||||
int setTimeout (unsigned int _handle, double p, double g);
|
||||
int setTimeout (unsigned int _handle, double pg){return setTimeout(_handle, pg, pg); };
|
||||
int setTimeoutPut(unsigned int _handle, double p) {return setTimeout(_handle, p, (double) NULL);};
|
||||
int setTimeoutGet(unsigned int _handle, double g) {return setTimeout(_handle, (double) NULL, g);};
|
||||
int setTimeoutToDefault(unsigned int _handle);
|
||||
int setTimeoutToDefault();
|
||||
|
||||
//get SGTimeout
|
||||
int getSGTimeoutRange (double &p, double &p2, double &g, double &g2) { int stp; int stg;
|
||||
stp=getSGTimeoutMin(p,g); stg=getSGTimeoutMax(p2, g2);
|
||||
if (stp!=ICAFE_NORMAL){return stp;} else if(stg!=ICAFE_NORMAL){return stg;}
|
||||
else {return ICAFE_NORMAL;}
|
||||
};
|
||||
|
||||
int getSGTimeoutMin (double &p, double &g);
|
||||
int getSGTimeoutMax (double &p, double &g);
|
||||
int printSGTimeout ();
|
||||
int printSGTimeout (unsigned int _handle);
|
||||
|
||||
|
||||
int getSGTimeout (unsigned int _handle, double &p, double &g);
|
||||
//returns lesser of the two
|
||||
int getSGTimeout (unsigned int _handle, double &pg) {double p; double g; int st;
|
||||
st=getSGTimeout(_handle, p, g); pg=std::min(p,g); return st;}
|
||||
int getSGTimeoutPut(unsigned int _handle, double &p) {double g; return getSGTimeout(_handle, p, g);}
|
||||
int getSGTimeoutGet(unsigned int _handle, double &g) {double p; return getSGTimeout(_handle, p, g);}
|
||||
|
||||
|
||||
//set SGTimeout
|
||||
int setSGTimeout (double p, double g); // for all group handles put and get separately
|
||||
int setSGTimeout (double pg){return setSGTimeout(pg, pg);};
|
||||
int setSGTimeoutPut(double p) {return setSGTimeout(p, (double) NULL);};
|
||||
int setSGTimeoutGet(double g) {return setSGTimeout((double) NULL, g);};
|
||||
int setSGTimeout (unsigned int _gHandle, double p, double g);
|
||||
int setSGTimeout (unsigned int _gHandle, double pg){return setSGTimeout(_gHandle, pg, pg); };
|
||||
int setSGTimeoutPut(unsigned int _gHandle, double p) {return setSGTimeout(_gHandle, p, (double) NULL);};
|
||||
int setSGTimeoutGet(unsigned int _gHandle, double g) {return setSGTimeout(_gHandle, (double) NULL, g);};
|
||||
|
||||
int setSGTimeoutToDefault(unsigned int _handle);
|
||||
int setSGTimeoutToDefault();
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
74
include/restorePVGroupXMLParser.h
Normal file
74
include/restorePVGroupXMLParser.h
Normal file
@@ -0,0 +1,74 @@
|
||||
///
|
||||
/// \file restorePVGroupXMLParser.h
|
||||
/// \author Jan Chrin, G. Prekas, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#ifndef RESTOREPVGROUPXMLPARSER_H
|
||||
#define RESTOREPVGROUPXMLPARSER_H
|
||||
|
||||
#include "PVGroup.h"
|
||||
|
||||
|
||||
#include <QtXml/QXmlDefaultHandler>
|
||||
|
||||
|
||||
class restorePVGroupXMLParser : public QXmlDefaultHandler {
|
||||
public:
|
||||
restorePVGroupXMLParser();
|
||||
virtual ~restorePVGroupXMLParser();
|
||||
|
||||
bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts);
|
||||
bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName);
|
||||
bool characters(const QString& ch);
|
||||
|
||||
PVGroup group;
|
||||
private:
|
||||
enum
|
||||
{
|
||||
NotWaiting,
|
||||
WaitingForConfig,
|
||||
WaitingForNPV,
|
||||
WaitingForGroup,
|
||||
WaitingForDescription,
|
||||
WaitingForStatusGroup,
|
||||
WaitingForMember,
|
||||
WaitingForName,
|
||||
WaitingForNelem,
|
||||
WaitingForStatus,
|
||||
WaitingForRule,
|
||||
WaitingForVal,
|
||||
WaitingForSettable
|
||||
} state;
|
||||
|
||||
|
||||
PVDataHolder * pvd;
|
||||
bool settable;
|
||||
unsigned int icount;
|
||||
|
||||
const static QString& tagConfig;
|
||||
const static QString& tagGroup;
|
||||
const static QString& tagNPV;
|
||||
const static QString& tagDescription;
|
||||
const static QString& tagStatusGroup;
|
||||
const static QString& tagMember;
|
||||
const static QString& tagName;
|
||||
const static QString& tagNelem;
|
||||
const static QString& tagStatus;
|
||||
const static QString& tagRule;
|
||||
const static QString& tagVal;
|
||||
const static QString& tagSettable;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* RESTOREPVGROUPXMLPARSER_H */
|
||||
|
||||
#endif
|
||||
|
||||
1
include/stamp-h1
Normal file
1
include/stamp-h1
Normal file
@@ -0,0 +1 @@
|
||||
timestamp for ./include/config.h
|
||||
974
include/statusCodes.h
Normal file
974
include/statusCodes.h
Normal file
@@ -0,0 +1,974 @@
|
||||
///
|
||||
/// \file StatusCodes.h
|
||||
///
|
||||
/// class StatusInfo - contains user defined messages (>ICAFE_STATUS_BASE)
|
||||
/// and ca_message() output string
|
||||
///
|
||||
/// class StatusMap - contains ECA and ECAFE error strings plus ICAFE info strings
|
||||
///
|
||||
/// class Status - contains both above classes by composition
|
||||
///
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: Feb. 2015
|
||||
/// Revised: May 2017
|
||||
/// Added CAFEGlobalAlarmStatus and CAFEGlobalAlarmSeverity
|
||||
/// \version CAFE 1.1.0
|
||||
///
|
||||
/// JC, Dec. 2015, additional methods to CAFEStatus
|
||||
///
|
||||
|
||||
|
||||
#ifndef STATUSCODES_H
|
||||
#define STATUSCODES_H
|
||||
#include <cadef.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <cafeDataType.h>
|
||||
|
||||
|
||||
const unsigned short ICAFE_STATUS_BASE = 600;
|
||||
const unsigned short ICAFE_STATUS_CS = ICAFE_STATUS_BASE;
|
||||
const unsigned short ICAFE_STATUS_CFT = 700; // ca_field_type
|
||||
const unsigned short ICAFE_STATUS_CA_OP = 800;
|
||||
const unsigned short ICAFE_STATUS_ERROR = 1000;
|
||||
const unsigned short ICAFE_FILE_ERROR = 1100;
|
||||
const unsigned short ICAFE_SERVICE_ERROR =1200;
|
||||
const unsigned short ICAFE_LINUX_ERROR = 5000;
|
||||
const unsigned short ICAFE_SUCCESS = ECA_NORMAL;
|
||||
const unsigned short ICAFE_NORMAL = ECA_NORMAL;
|
||||
|
||||
|
||||
|
||||
enum CAFE_CS_STATE { ICAFE_CS_NEVER_CONN=ICAFE_STATUS_CS,
|
||||
ICAFE_CS_PREV_CONN,
|
||||
ICAFE_CS_CONN,
|
||||
ICAFE_CS_CLOSED,
|
||||
ICAFE_CS_DISCONN,
|
||||
ICAFE_CS_UNKNOWN
|
||||
};
|
||||
|
||||
enum CAFE_CFT_STATE{ ICAFE_TYPENOTCONN=ICAFE_STATUS_CFT,
|
||||
ICAFE_RULE_FALSE,
|
||||
ICAFE_BADCOUNT,
|
||||
ICAFE_CALLBACK_NOT_YET_INVOKED,
|
||||
ICAFE_WAITING_FOR_PREV_CALLBACK,
|
||||
ICAFE_CACHE_EMPTY,
|
||||
ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT,
|
||||
ICAFE_MONITOR_DELAYED_AS_CONN_DOWN,
|
||||
ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE,
|
||||
ICAFE_SET_AND_GET_MISMATCH
|
||||
};
|
||||
|
||||
enum CAFE_CC_STATE { ICAFE_CA_OP_GET=ICAFE_STATUS_CA_OP,
|
||||
ICAFE_CA_OP_PUT,
|
||||
ICAFE_CA_OP_CREATE_CHANNEL,
|
||||
ICAFE_CA_OP_ADD_EVENT,
|
||||
ICAFE_CA_OP_CLEAR_EVENT,
|
||||
ICAFE_CA_OP_OTHER,
|
||||
ICAFE_CA_OP_CONN_UP,
|
||||
ICAFE_CA_OP_CONN_DOWN
|
||||
};
|
||||
|
||||
enum CAFE_ERROR_STATE { ECAFE_NODATA=ICAFE_STATUS_ERROR,
|
||||
ECAFE_INVALID_TYPE,
|
||||
ECAFE_BADCOUNT,
|
||||
ECAFE_BADSTR,
|
||||
ECAFE_BADTYPE,
|
||||
ECAFE_NO_CONVERT,
|
||||
ECAFE_NULLCONTEXT,
|
||||
ECAFE_NULLCHID,
|
||||
ECAFE_NULLEVID,
|
||||
ECAFE_UNKNOWN_COLLECTION,
|
||||
ECAFE_EMPTY_COLLECTION,
|
||||
ECAFE_COLLECTION_PREV_DEF,
|
||||
ECAFE_COLLECTION_INVALID_MEMBER,
|
||||
ECAFE_RULE_FALSE,
|
||||
ECAFE_UNKNOWN_GROUP,
|
||||
ECAFE_EMPTY_GROUP,
|
||||
ECAFE_GROUP_PREV_DEF,
|
||||
ECAFE_INVALID_HANDLE,
|
||||
ECAFE_INVALID_GROUP_HANDLE,
|
||||
ECAFE_NORDACCESS,
|
||||
ECAFE_NOWTACCESS,
|
||||
ECAFE_TIMEOUT,
|
||||
ECAFE_CANNOT_OPEN_FILE,
|
||||
ECAFE_INVALID_SWITCH_CASE,
|
||||
ECAFE_PVALIAS_PREV_DEF,
|
||||
ECAFE_PVALIAS_INVALID,
|
||||
ECAFE_PVNAME_PREV_DEF_AS_PVALIAS,
|
||||
ECAFE_DEVICE_ATTRIB_NOT_FOUND,
|
||||
ECAFE_HASH_UNIQUEID_EXISTS,
|
||||
ECAFE_WRONG_CA_CONTEXT,
|
||||
ECAFE_INVALID_CAFENUM_POLICY_TYPE,
|
||||
ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED,
|
||||
ECAFE_INVALID_ENUM_INDEX,
|
||||
ECAFE_PVGROUP_GROUPHANDLE_MISMATCH,
|
||||
ECAFE_TIMEOUT_SET_AND_MATCH,
|
||||
ECAFE_HANDLE_MISMATCH_SET_AND_MATCH
|
||||
};
|
||||
|
||||
enum CAFE_FILE_ERROR { ECAFE_LOAD_COLLECTION=ICAFE_FILE_ERROR,
|
||||
ECAFE_LOAD_GROUP
|
||||
};
|
||||
|
||||
|
||||
enum CAFE_SERVICE_ERROR { ECAFE_BPM_DATA_IS_INVALID=ICAFE_SERVICE_ERROR
|
||||
};
|
||||
//Used by zeromq
|
||||
enum CAFE_LINUX_ERROR { LINUX_EINTR =ICAFE_LINUX_ERROR+4,
|
||||
LINUX_EAGAIN=ICAFE_LINUX_ERROR+11,
|
||||
LINUX_EFAULT=ICAFE_LINUX_ERROR+14,
|
||||
LINUX_ENOTSOCK=ICAFE_LINUX_ERROR+88,
|
||||
LINUX_EPROTONOSUPPORT=ICAFE_LINUX_ERROR+93
|
||||
};
|
||||
|
||||
|
||||
//epicsAlarmConditionStrings = {"NO_ALARM","READ","WRITE","HIHI","HIGH",
|
||||
//"LOLO","LOW","STATE","COS", "COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
|
||||
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS", "WRITE_ACCESS"};
|
||||
|
||||
|
||||
enum EPICS_GLOBAL_ALARM_CONDITION {STAT_NO_ALARM=0, STAT_READ, STAT_WRITE, STAT_HIHI, STAT_HIGH,
|
||||
STAT_LOLO, STAT_LOW, STAT_STATE, STAT_COS, STAT_COMM, STAT_TIMEOUT, STAT_HWLIMIT,
|
||||
STAT_CALC, STAT_SCAN, STAT_LINK,
|
||||
STAT_SOFT, STAT_BAD_SUB, STAT_UDF, STAT_DISABLE, STAT_SIMM, STAT_READ_ACCESS, STAT_WRITE_ACCESS
|
||||
};
|
||||
|
||||
enum EPICS_GLOBAL_ALARM_SEVERITY {SEV_NO_ALARM=0, SEV_MINOR, SEV_MAJOR, SEV_INVALID};
|
||||
|
||||
|
||||
class CAFEGlobalAlarmCondition {
|
||||
typedef std::map<int, std::string> mapIntString;
|
||||
|
||||
private:
|
||||
mapIntString mapAlarmCondition;
|
||||
mapIntString::iterator pos;
|
||||
|
||||
public:
|
||||
CAFEGlobalAlarmCondition() {
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_NO_ALARM, "NO_ALARM"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_READ, "READ"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_WRITE, "WRITE"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_HIHI, "HIHI"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_HIGH, "HIGH"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_LOLO, "LOLO"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_LOW, "LOW"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_STATE, "STATE"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_COS, "COS"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_COMM, "COMM"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_TIMEOUT, "TIMEOUT"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_HWLIMIT, "HWLIMIT"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_CALC, "CALC"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_SCAN, "SCAN"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_LINK, "LINK"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_SOFT, "SOFT"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_BAD_SUB, "BAD_SUB"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_UDF, "UDF"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_DISABLE, "DISABLE"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_SIMM, "SIMM"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_READ_ACCESS, "READ_ACCESS"));
|
||||
mapAlarmCondition.insert(std::make_pair((int) STAT_WRITE_ACCESS, "WRITE_ACCESS"));
|
||||
|
||||
};
|
||||
|
||||
~CAFEGlobalAlarmCondition() {};
|
||||
|
||||
std::string asString (int i) {
|
||||
|
||||
pos = mapAlarmCondition.find(i);
|
||||
if (pos != mapAlarmCondition.end()) {
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
if (i == -1) {
|
||||
oss << "NO DATA" ;
|
||||
return oss.str();
|
||||
}
|
||||
std::cout << "------------------------------------" << std::endl;
|
||||
oss << "INVALID ENUM VALUE: " << i ; //<< --std::endl;
|
||||
std::cout << oss.str();
|
||||
std::cout << " VALID VALUES ARE: " << std::endl;
|
||||
printAll();
|
||||
std::cout << "--------------------------------------" << std::endl;
|
||||
return oss.str();
|
||||
};
|
||||
|
||||
|
||||
int asInt (std::string message) {
|
||||
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
|
||||
|
||||
if (pos->second==message) return pos->first;
|
||||
// String searches such as s.find(s1) return string::npos on failure
|
||||
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
|
||||
}
|
||||
std::cout << "------------------------------------" << std::endl;
|
||||
std::cout << "INVALID INPUT: " << message << " VALID VALUES ARE: " << std::endl;
|
||||
printAll();
|
||||
std::cout << "------------------------------------" << std::endl;
|
||||
return -1;
|
||||
};
|
||||
|
||||
void getStates(std::vector<int> &vecI, std::vector<std::string> &vecS ) {
|
||||
|
||||
vecS.clear(); vecS.reserve(mapAlarmCondition.size());
|
||||
vecI.clear(); vecI.reserve(mapAlarmCondition.size());
|
||||
|
||||
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
|
||||
vecI.push_back(pos->first);
|
||||
vecS.push_back(pos->second);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void printAll() {
|
||||
std::cout << "-------------------" << std::endl;
|
||||
std::cout << "EPICS GLOBAL ALARM CONDITION LIST" << std::endl;
|
||||
std::cout << "-------------------" << std::endl;
|
||||
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
|
||||
if (pos->first < 10) {
|
||||
std::cout << " " << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
else {
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CAFEGlobalAlarmSeverity {
|
||||
typedef std::map<int, std::string> mapIntString;
|
||||
|
||||
private:
|
||||
mapIntString mapAlarmSeverity;
|
||||
mapIntString::iterator pos;
|
||||
|
||||
public:
|
||||
CAFEGlobalAlarmSeverity() {
|
||||
mapAlarmSeverity.insert(std::make_pair((int) SEV_NO_ALARM, "NO_ALARM"));
|
||||
mapAlarmSeverity.insert(std::make_pair((int) SEV_MINOR, "MINOR"));
|
||||
mapAlarmSeverity.insert(std::make_pair((int) SEV_MAJOR, "MAJOR"));
|
||||
mapAlarmSeverity.insert(std::make_pair((int) SEV_INVALID, "INVALID"));
|
||||
};
|
||||
|
||||
~CAFEGlobalAlarmSeverity() {};
|
||||
|
||||
std::string asString (int i) {
|
||||
|
||||
pos = mapAlarmSeverity.find(i);
|
||||
if (pos != mapAlarmSeverity.end()) {
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
|
||||
std::ostringstream oss;
|
||||
if (i == -1) {
|
||||
oss << "NO DATA" ;
|
||||
return oss.str();
|
||||
}
|
||||
std::cout << "--------------------------------------" << std::endl;
|
||||
oss << "INVALID ENUM VALUE: " << i ; //<< std::endl;
|
||||
std::cout << oss.str();
|
||||
std::cout << " VALID VALUES ARE: " << std::endl;
|
||||
printAll();
|
||||
std::cout << "--------------------------------------" << std::endl;
|
||||
return oss.str();
|
||||
};
|
||||
|
||||
|
||||
int asInt (std::string message) {
|
||||
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
|
||||
|
||||
if (pos->second==message) return pos->first;
|
||||
// String searches such as s.find(s1) return string::npos on failure
|
||||
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
|
||||
}
|
||||
std::cout << "--------------------------------------" << std::endl;
|
||||
std::cout << "INVALID INPUT: " << message << " VALID VALUES ARE: " << std::endl;
|
||||
printAll();
|
||||
std::cout << "--------------------------------------" << std::endl;
|
||||
return -1;
|
||||
};
|
||||
|
||||
void getStates(std::vector<int> &vecI, std::vector<std::string> &vecS ) {
|
||||
|
||||
vecS.clear(); vecS.reserve(mapAlarmSeverity.size());
|
||||
vecI.clear(); vecI.reserve(mapAlarmSeverity.size());
|
||||
|
||||
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
|
||||
|
||||
vecI.push_back(pos->first);
|
||||
vecS.push_back(pos->second);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void printAll() {
|
||||
std::cout << "-------------------" << std::endl;
|
||||
std::cout << "EPICS GLOBAL ALARM SEVERITY LIST" << std::endl;
|
||||
std::cout << "-------------------" << std::endl;
|
||||
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* class StatusInfo provides information for user defined error/status codes
|
||||
* and ca defined error/status codes \n
|
||||
* 1 ECA_NORMAL \n
|
||||
* 48 ECA_ALLOCMEM \n
|
||||
* 72 ECA_TOLARGE \n
|
||||
* 80 ECA_TIMEOUT \n
|
||||
* 114 ECA_BADTYPE \n
|
||||
* 142 ECA_INTERNAL \n
|
||||
* 152 ECA_GETFAIL \n
|
||||
* 160 ECA_PUTFAIL \n
|
||||
* 176 ECA_BADCOUNT \n
|
||||
* 186 ECA_BADSTR \n
|
||||
* 192 ECA_DISCONN \n
|
||||
* 200 ECA_DBLCHNL \n
|
||||
* 210 ECA_EVDISALLOW \n
|
||||
* 242 ECA_BADMONID \n
|
||||
* 330 ECA_BADMASK \n
|
||||
* 339 ECA_IODONE \n
|
||||
* 347 ECA_IOINPROGRESS \n
|
||||
* 354 ECA_BADSYNCGRP \n
|
||||
* 362 ECA_PUTCBINPROG \n
|
||||
* 368 ECA_NORDACCESS \n
|
||||
* 376 ECA_NOWTACCESS \n
|
||||
* 386 ECA_ANACHRONISM \n
|
||||
* 392 ECA_NOSEARCHADDR \n
|
||||
* 400 ECA_NOCONVERT \n
|
||||
* 410 ECA_BADCHID \n
|
||||
* 418 ECA_BADFUNCPTR \n
|
||||
* 424 ECA_ISATTACHED \n
|
||||
* 432 ECA_UNAVAILINSERV \n
|
||||
* 440 ECA_CHANDESTROY \n
|
||||
* 450 ECA_BADPRIORITY \n
|
||||
* 458 ECA_NOTTHREADED \n
|
||||
* 464 ECA_16KARRAYCLIENT \n
|
||||
* 472 ECA_CONNSEQTMO \n
|
||||
* 480 ECA_UNRESPTMO \n
|
||||
* 600 ICAFE_CS_NEVER_CONN \n
|
||||
* 601 ICAFE_CS_PREV_CONN \n
|
||||
* 602 ICAFE_CS_CONN \n
|
||||
* 603 ICAFE_CS_CLOSED \n
|
||||
* 604 ICAFE_CS_DISCONN, \n
|
||||
* 605 ICAFE_CS_UNKNOWN \n
|
||||
* 700 ICAFE_TYPENOTCONN \n
|
||||
* 701 ICAFE_RULE_FALSE \n
|
||||
* 702 ICAFE_BADCOUNT \n
|
||||
* 703 ICAFE_CALLBACK_NOT_YET_INVOKED \n
|
||||
* 704 ICAFE_WAITING_FOR_PREV_CALLBACK \n
|
||||
* 705 ICAFE_CACHE_EMPTY \n
|
||||
* 706 ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT \n
|
||||
* 707 ICAFE_MONITOR_DELAYED_AS_CONN_DOWN \n
|
||||
* 708 ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE \n
|
||||
* 709 ICAFE_SET_AND_GET_MISMATCH \n
|
||||
* 806 ICAFE_CA_OP_CONN_UP \n
|
||||
* 807 ICAFE_CA_OP_CONN_DOWN \n
|
||||
* 1000 ECAFE_NODATA \n
|
||||
* 1001 ECAFE_INVALID_TYPE \n
|
||||
* 1002 ECAFE_BADCOUNT \n
|
||||
* 1003 ECAFE_BADSTR \n
|
||||
* 1004 ECAFE_BADTYPE \n
|
||||
* 1005 ECAFE_NO_CONVERT \n
|
||||
* 1006 ECAFE_NULLCONTEXT \n
|
||||
* 1007 ECAFE_NULLCHID \n
|
||||
* 1008 ECAFE_NULLEVID \n
|
||||
* 1009 ECAFE_UNKNOWN_COLLECTION \n
|
||||
* 1010 ECAFE_EMPTY_COLLECTION \n
|
||||
* 1011 ECAFE_COLLECTION_PREV_DEF \n
|
||||
* 1012 ECAFE_COLLECTION_INVALID_MEMBER \n
|
||||
* 1013 ECAFE_RULE_FALSE \n
|
||||
* 1014 ECAFE_UNKNOWN_GROUP \n
|
||||
* 1015 ECAFE_EMPTY_GROUP \n
|
||||
* 1016 ECAFE_GROUP_PREV_DEF \n
|
||||
* 1017 ECAFE_INVALID_HANDLE \n
|
||||
* 1018 ECAFE_INVALID_GROUP_HANDLE \n
|
||||
* 1019 ECAFE_NORDACCESS \n
|
||||
* 1020 ECAFE_NOWTACCESS \n
|
||||
* 1021 ECAFE_TIMEOUT \n
|
||||
* 1022 ECAFE_CANNOT_OPEN_FILE \n
|
||||
* 1023 ECAFE_INVALID_SWITCH_CASE \n
|
||||
* 1024 ECAFE_PVALIAS_INVALID \n
|
||||
* 1025 ECAFE_PVALIAS_PREV_DEF \n
|
||||
* 1026 ECAFE_PVNAME_PREV_DEF_AS_PVALIAS \n
|
||||
* 1027 ECAFE_DEVICE_ATTRIB_NOT_FOUND \n
|
||||
* 1028 ECAFE_HASH_UNIQUEID_EXISTS \n
|
||||
* 1029 ECAFE_WRONG_CA_CONTEXT \n
|
||||
* 1030 ECAFE_INVALID_CAFENUM_POLICY_TYPE \n
|
||||
* 1031 ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED \n
|
||||
* 1032 ECAFE_INVALID_ENUM_INDEX \n
|
||||
* 1033 ECAFE_PVGROUP_GROUPHANDLE_MISMATCH \n
|
||||
* 1034 ECAFE_TIMEOUT_SET_AND_MATCH \n
|
||||
* 1035 ECAFE_HANDLE_MISMATCH_SET_AND_MATCH \n
|
||||
* 1100 ECAFE_LOAD_COLLECTION \n
|
||||
* 1101 ECAFE_LOAD_GROUP \n
|
||||
* 1200 ECAFE_BPM_DATA_IS_INVALID \n
|
||||
* 5004 LINUX_EINTR \n
|
||||
* 5011 LINUX_EGAIN \n
|
||||
* 5014 LINUX_EFAULT \n
|
||||
* 5088 LINUX_ENOTSOCK \n
|
||||
* 5093 LINUX_EPROTONOSUPPORT \n
|
||||
*/
|
||||
class CAFEStatusInfo {
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapStatusInfo;
|
||||
mapLongString::iterator posStatusInfo;
|
||||
|
||||
public:
|
||||
CAFEStatusInfo() {
|
||||
//maximum message length is 80 characters
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "Status of channel connection: channel UP " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "Status of channel connection: channel DOWN! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_NEVER_CONN, "Valid chid; server not found or unavailable " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_PREV_CONN, "Valid chid; previously connected to server " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_CONN, "Valid chid; connected to server " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_CLOSED, "Channel deleted by user " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_DISCONN, "Channel disconnected " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_UNKNOWN, "Unknown state!!! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_TYPENOTCONN, "ca_field_type() channel is disconnected " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_RULE_FALSE, "CAFE collection rule for channel set to false by user " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_BADCOUNT, "nelemClient exceeds nelemNative (max. allowed)! Set nelemClient/nelemRequest to nelemNative "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "Callback for get/set operation has not yet been invoked "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "Callback for previous get/set operation not yet invoked "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "Data buffer is empty; get message to IOC not yet invoked"));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "User supplied callback function not provided when expected "));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "Channel disconnected. Monitor will be started on connection "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "Handle has monitor, hence data retrieved from cache "));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "Set and Get values from SetAndGetMethod do not match"));
|
||||
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_NODATA, "Requested data transfer is of zero length! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_TYPE, "Invalid data type! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_BADCOUNT, "nelemClient exceeds nelemNative (max. allowed)! Set nelemClient/nelemRequest to nelemNative "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_BADSTR, "Empty string for process variable name! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_BADTYPE, "Invalid datatype! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_NO_CONVERT, "set()/get() cannot convert to/from native datatype! " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_NULLCONTEXT, "Error: current context is null; CA not initialized. " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_NULLCHID, "Error: chid is null!! " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_NULLEVID, "Monitor() evid is null! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_UNKNOWN_COLLECTION, "CAFE collection is unknown/unregistered or invalid! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_EMPTY_COLLECTION, "CAFE collection is empty; has no members! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_COLLECTION_PREV_DEF, "CAFE collection with this name already exists! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_COLLECTION_INVALID_MEMBER,"Device is not a member of the CAFE collection! " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_RULE_FALSE, "CAFE rule for channel set to false by user " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_UNKNOWN_GROUP, "CAFE group is unknown/unregistered or invalid! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_EMPTY_GROUP, "CAFE group is empty; has no members! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_GROUP_PREV_DEF, "CAFE group with this name already exists! " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_HANDLE, "Handle does not exist! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_GROUP_HANDLE, "Group handle does not exist! " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_NORDACCESS, "Channel does not have READ access! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_NOWTACCESS, "Channel does not have WRITE access! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_TIMEOUT, "Callback function not activated within specified timeout period " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_CANNOT_OPEN_FILE, "Cannot open file! " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_SWITCH_CASE, "Internal CAFE Error: Invalid option for switch case " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVALIAS_INVALID, "Requested PVAlias is another handle's PV name. Bizarre! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVALIAS_PREV_DEF, "Requested PVAlias already exists! " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVNAME_PREV_DEF_AS_PVALIAS, "PVName clashes with previously defined PVAlias!" ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_DEVICE_ATTRIB_NOT_FOUND, "Deliminator - hence dev/attrib - not found in PV name" ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_HASH_UNIQUEID_EXISTS,"cafeConduit object already inserted (handle exists) "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_WRONG_CA_CONTEXT,"Operation cannot be carried out for this ca_client_context "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_CAFENUM_POLICY_TYPE, "Not a valid CAFENUM type for this policy. See policies.h "));
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED, "See define.sh to change the allowed maximum "));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_ENUM_INDEX, "DBR_ENUM value exceeds the number of enum string options " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVGROUP_GROUPHANDLE_MISMATCH, "PVGroup previously assigned to another group handle " ));
|
||||
|
||||
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_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 " ));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) LINUX_EINTR, "C ERROR CODE IN LINUX: Interrupted system call" ));
|
||||
mapStatusInfo.insert(std::make_pair((int) LINUX_EAGAIN, "C ERROR CODE IN LINUX: Try again" ));
|
||||
mapStatusInfo.insert(std::make_pair((int) LINUX_EFAULT, "C ERROR CODE IN LINUX: Bad address" ));
|
||||
mapStatusInfo.insert(std::make_pair((int) LINUX_ENOTSOCK, "C ERROR CODE IN LINUX: Socket operation on non-socket" ));
|
||||
mapStatusInfo.insert(std::make_pair((int) LINUX_EPROTONOSUPPORT, "C ERROR CODE IN LINUX: Protocol not supported" ));
|
||||
}
|
||||
|
||||
~CAFEStatusInfo() {};
|
||||
|
||||
|
||||
std::string message (int i) {
|
||||
|
||||
if (i<ICAFE_STATUS_BASE) {
|
||||
std::string c= ca_message(i);
|
||||
return c;
|
||||
}
|
||||
else {
|
||||
posStatusInfo = mapStatusInfo.find(i);
|
||||
if (posStatusInfo != mapStatusInfo.end()) {
|
||||
return posStatusInfo->second;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
|
||||
//std::cout << oss.str();
|
||||
|
||||
return oss.str();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
void printAll() {
|
||||
std::cout << "-----------------------" << std::endl;
|
||||
std::cout << "CAFE ERROR MESSAGE LIST" << std::endl;
|
||||
std::cout << "-----------------------" << std::endl;
|
||||
for (posStatusInfo=mapStatusInfo.begin(); posStatusInfo != mapStatusInfo.end(); ++posStatusInfo) {
|
||||
std::cout << posStatusInfo->first << " " << posStatusInfo->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CAFEStatusCode {
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
|
||||
private:
|
||||
mapLongString mapStatusCode;
|
||||
mapLongString::iterator pos;
|
||||
|
||||
public:
|
||||
CAFEStatusCode() {
|
||||
mapStatusCode.insert(std::make_pair(ECA_NORMAL, "SUCCESS: ECA_NORMAL"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_ALLOCMEM, "WARNING: ECA_ALLOCMEM"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_TOLARGE, "WARNING: ECA_TOLARGE"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_TIMEOUT, "WARNING: ECA_TIMEOUT"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADTYPE, "ERROR: ECA_BADTYPE"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_INTERNAL, "FATAL: ECA_INTERNAL"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_GETFAIL, "WARNING: ECA_GETFAIL"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_PUTFAIL, "WARNING: ECA_PUTFAIL"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADCOUNT, "WARNING: ECA_BADCOUNT"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADSTR, "ERROR: ECA_BADSTR"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_DISCONN, "WARNING: ECA_DISCONN"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_DBLCHNL, "WARNING: ECA_DBLCHNL"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_EVDISALLOW, "ERROR: ECA_EVDISALLOW"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADMONID, "ERROR: ECA_BADMONID"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADMASK, "ERROR: ECA_BADMASK"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_IODONE , "INFO: ECA_IODONE "));
|
||||
mapStatusCode.insert(std::make_pair(ECA_IOINPROGRESS, "INFO: ECA_IOINPROGRESS"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADSYNCGRP, "ERROR: ECA_BADSYNCGRP"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_PUTCBINPROG, "ERROR: ECA_PUTCBINPROG"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_NORDACCESS, "WARNING: ECA_NORDACCESS"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_NOWTACCESS, "WARNING: ECA_NOWTACCESS"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_ANACHRONISM, "ERROR: ECA_ANACHRONISM"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_NOSEARCHADDR, "WARNING: ECA_NOSEARCHADDR"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_NOCONVERT, "WARNING: ECA_NOCONVERT"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADCHID, "ERROR: ECA_BADCHID"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADFUNCPTR, "ERROR: ECA_BADFUNCPTR"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_ISATTACHED, "WARNING: ECA_ISATTACHED"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_UNAVAILINSERV, "WARNING: ECA_UNAVAILINSERV"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_CHANDESTROY, "WARNING: ECA_CHANDESTROY"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_BADPRIORITY, "ERROR: ECA_BADPRIORITY"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_NOTTHREADED, "ERROR: ECA_NOTTHREADED"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_16KARRAYCLIENT,"WARNING: ECA_16KARRAYCLIENT"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_CONNSEQTMO, "WARNING: ECA_CONNSEQTMO"));
|
||||
mapStatusCode.insert(std::make_pair(ECA_UNRESPTMO , "WARNING: ECA_UNRESPTMO"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_NEVER_CONN, "CHANNEL STATE: ICAFE_CS_NEVER_CONN" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_PREV_CONN, "CHANNEL STATE: ICAFE_CS_PREV_CONN " ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_CONN, "CHANNEL STATE: ICAFE_CS_CONN" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_CLOSED, "CHANNEL STATE: ICAFE_CS_CLOSED" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_DISCONN, "CHANNEL STATE: ICAFE_CS_DISCONN" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_UNKNOWN, "CHANNEL STATE: ICAFE_CS_UNKNOWN" ));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_TYPENOTCONN, "CHANNEL FIELD TYPE: ICAFE_CFT_TYPENOTCONN"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_RULE_FALSE, "CAFE INFO: ICAFE_RULE_FALSE"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_BADCOUNT, "CAFE INFO: ICAFE_BADCOUNT"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "CAFE_INFO: ICAFE_CALLBACK_NOT_YET_INVOKED"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "CAFE_INFO: ICAFE_WAITING_FOR_PREV_CALLBACK"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "CAFE_INFO:ICAFE_CACHE_EMPTY"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "CAFE_INFO: ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "CHANNEL CONNECTION: ICAFE_CC_OP_CONN_UP" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_CC_OP_CONN_DOWN" ));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_MONITOR_DELAYED_AS_CONN_DOWN"));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "CAFE_INFO: ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE"));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "CAFE_INFO: ICAFE_SET_AND_GET_MISMATCH"));
|
||||
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NODATA, "CAFE ERROR: ECAFE_NODATA"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_BADCOUNT, "CAFE ERROR: ECAFE_BADCOUNT"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_BADSTR, "CAFE ERROR: ECAFE_BADSTR"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_BADTYPE, "CAFE ERROR: ECAFE_BADTYPE"));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NO_CONVERT, "CAFE ERROR: ECAFE_NO_CONVERT"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NULLCONTEXT, "CAFE ERROR: ECAFE_NULLCONTEXT"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NULLCHID, "CAFE ERROR: ECAFE_NULLCHID"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NULLEVID, "CAFE ERROR: ECAFE_NULLEVID"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_UNKNOWN_COLLECTION, "CAFE ERROR: ECAFE_UNKNOWN_COLLECTION"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_EMPTY_COLLECTION, "CAFE ERROR: ECAFE_EMPTY_COLLECTION"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_COLLECTION_PREV_DEF, "CAFE ERROR: ECAFE_COLLECTION_PREV_DEF"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_COLLECTION_INVALID_MEMBER, "CAFE ERROR: ECAFE_COLLECTION_INVALID_MEMBER"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_RULE_FALSE, "CAFE ERROR/INFO: ECAFE_RULE_FALSE"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_UNKNOWN_GROUP, "CAFE ERROR: ECAFE_UNKNOWN_GROUP"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_EMPTY_GROUP, "CAFE ERROR: ECAFE_EMPTY_GROUP"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_GROUP_PREV_DEF, "CAFE ERROR: ECAFE_GROUP_PREV_DEF"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_HANDLE, "CAFE ERROR: ECAFE_INVALID_HANDLE"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_GROUP_HANDLE, "CAFE ERROR: ECAFE_INVALID_GROUP_HANDLE"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NORDACCESS, "CAFE ERROR: ECAFE_NORDACCESS"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NOWTACCESS, "CAFE ERROR: ECAFE_NOWTACCESS"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_TIMEOUT, "CAFE ERROR: ECAFE_TIMEOUT"));
|
||||
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_CANNOT_OPEN_FILE, "CAFE ERROR: ECAFE_CANNOT_OPEN_FILE"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_SWITCH_CASE, "CAFE ERROR: ECAFE_INVALID_SWITCH_CASE"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_PVALIAS_INVALID, "CAFE ERROR: ECAFE_PVALIAS_INVALID"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_PVALIAS_PREV_DEF, "CAFE ERROR: ECAFE_PVALIAS_PREV_DEF"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_PVNAME_PREV_DEF_AS_PVALIAS,"CAFE ERROR: ECAFE_PVNAME_PREV_DEF_AS_PVALIAS"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_DEVICE_ATTRIB_NOT_FOUND,"CAFE ERROR: ECAFE_DEVICE_ATTRIB_NOT_FOUND"));
|
||||
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_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_LOAD_COLLECTION, "CAFE ERROR: ECAFE_LOAD_COLLECTION"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "CAFE ERROR: ECAFE_LOAD_GROUP"));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_BPM_DATA_IS_INVALID, "CAFE_ERROR: ECAFE_BPM_DATA_IS_INVALID" ));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) LINUX_EINTR, "CAFE_ERROR: LINUX_EINTR" ));
|
||||
mapStatusCode.insert(std::make_pair((int) LINUX_EAGAIN, "CAFE_ERROR: LINUX_EAGAIN " ));
|
||||
mapStatusCode.insert(std::make_pair((int) LINUX_EFAULT, "CAFE_ERROR: LINUX_EFAULT" ));
|
||||
mapStatusCode.insert(std::make_pair((int) LINUX_ENOTSOCK, "CAFE_ERROR: LINUX_ENOTSOCK" ));
|
||||
mapStatusCode.insert(std::make_pair((int) LINUX_EPROTONOSUPPORT, "CAFE_ERROR: LINUX_EPROTONOSUPPORT" ));
|
||||
|
||||
};
|
||||
|
||||
~CAFEStatusCode() {};
|
||||
|
||||
std::string message (int i) {
|
||||
|
||||
pos = mapStatusCode.find(i);
|
||||
if (pos != mapStatusCode.end()) {
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
|
||||
//std::cout << oss.str();
|
||||
|
||||
return oss.str();
|
||||
};
|
||||
|
||||
|
||||
void getStates(std::vector<int> &vecI, std::vector<std::string> &vecS ) {
|
||||
|
||||
vecS.clear(); vecS.reserve(mapStatusCode.size());
|
||||
vecI.clear(); vecI.reserve(mapStatusCode.size());
|
||||
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
|
||||
std::size_t found = (pos->second).find(": ");
|
||||
if (found!=std::string::npos) {
|
||||
|
||||
vecS.push_back((pos->second).substr(found+2,(pos->second).length()));
|
||||
}
|
||||
else {
|
||||
vecS.push_back(pos->second);
|
||||
}
|
||||
vecI.push_back(pos->first);
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
std::string msgIDAsString (int i) {
|
||||
|
||||
pos = mapStatusCode.find(i);
|
||||
if (pos != mapStatusCode.end()) {
|
||||
std::size_t found = (pos->second).find(": ");
|
||||
if (found!=std::string::npos) {
|
||||
|
||||
return (pos->second).substr(found+2,(pos->second).length());
|
||||
}
|
||||
else {
|
||||
return pos->second;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
|
||||
//std::cout << oss.str();
|
||||
|
||||
return oss.str();
|
||||
};
|
||||
|
||||
|
||||
int enumIs (std::string message) {
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
|
||||
|
||||
if (pos->second==message) return pos->first;
|
||||
// String searches such as s.find(s1) return string::npos on failure
|
||||
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
bool isTimeout(int statusCodeToCheck) {
|
||||
if (statusCodeToCheck==ECA_TIMEOUT || statusCodeToCheck==ECAFE_TIMEOUT) {
|
||||
return true;
|
||||
}
|
||||
else {return false;}
|
||||
}
|
||||
|
||||
void printAll() {
|
||||
std::cout << "-------------------" << std::endl;
|
||||
std::cout << "CAFE ERROR CODE LIST" << std::endl;
|
||||
std::cout << "-------------------" << std::endl;
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CAFEStatusSeverity {
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
|
||||
private:
|
||||
mapLongString mapStatusSeverity;
|
||||
mapLongString::iterator pos;
|
||||
|
||||
public:
|
||||
CAFEStatusSeverity() {
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_NORMAL, "INFO"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_ALLOCMEM, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_TOLARGE, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_TIMEOUT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADTYPE, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_INTERNAL, "FATAL"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_GETFAIL, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_PUTFAIL, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADCOUNT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADSTR, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_DISCONN, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_DBLCHNL, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_EVDISALLOW, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADMONID, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADMASK, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_IODONE , "INFO"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_IOINPROGRESS, "INFO"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADSYNCGRP, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_PUTCBINPROG, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_NORDACCESS, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_NOWTACCESS, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_ANACHRONISM, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_NOSEARCHADDR, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_NOCONVERT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADCHID, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADFUNCPTR, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_ISATTACHED, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_UNAVAILINSERV, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_CHANDESTROY, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_BADPRIORITY, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_NOTTHREADED, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_16KARRAYCLIENT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_CONNSEQTMO, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair(ECA_UNRESPTMO , "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_NEVER_CONN, "WARN" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_PREV_CONN, "INFO" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_CONN, "INFO" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_CLOSED, "INFO" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_DISCONN, "WARN" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_UNKNOWN, "ERROR" ));
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_TYPENOTCONN, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_RULE_FALSE, "INFO"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_BADCOUNT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "INFO" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "WARN" ));
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "INFO"));
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "WARN"));
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NODATA, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADCOUNT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADSTR, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADTYPE, "ERROR"));
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NO_CONVERT, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NULLCONTEXT, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NULLCHID, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NULLEVID, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_UNKNOWN_COLLECTION, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_EMPTY_COLLECTION, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_COLLECTION_PREV_DEF, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_COLLECTION_INVALID_MEMBER, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_RULE_FALSE, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_UNKNOWN_GROUP, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_EMPTY_GROUP, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_GROUP_PREV_DEF, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_HANDLE, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_GROUP_HANDLE, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NORDACCESS, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NOWTACCESS, "WARN"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_TIMEOUT, "WARN"));
|
||||
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_CANNOT_OPEN_FILE, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_SWITCH_CASE, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVALIAS_INVALID, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVALIAS_PREV_DEF, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVNAME_PREV_DEF_AS_PVALIAS,"ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_DEVICE_ATTRIB_NOT_FOUND,"ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_HASH_UNIQUEID_EXISTS, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_WRONG_CA_CONTEXT, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_CAFENUM_POLICY_TYPE, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_ENUM_INDEX, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVGROUP_GROUPHANDLE_MISMATCH, "ERROR"));
|
||||
|
||||
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_LOAD_COLLECTION, "ERROR"));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "ERROR"));
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BPM_DATA_IS_INVALID, "WARN" ));
|
||||
|
||||
|
||||
};
|
||||
|
||||
~CAFEStatusSeverity() {};
|
||||
|
||||
std::string message (int i) {
|
||||
|
||||
pos = mapStatusSeverity.find(i);
|
||||
if (pos != mapStatusSeverity.end()) {
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
|
||||
//std::cout << oss.str();
|
||||
|
||||
return oss.str();
|
||||
};
|
||||
|
||||
int enumIs (std::string message) {
|
||||
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
|
||||
|
||||
if (pos->second==message) return pos->first;
|
||||
// String searches such as s.find(s1) return string::npos on failure
|
||||
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
void printAll() {
|
||||
std::cout << "-------------------" << std::endl;
|
||||
std::cout << "CAFE STATUS SEVERITY LIST" << std::endl;
|
||||
std::cout << "-------------------" << std::endl;
|
||||
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
//Example
|
||||
//For statusCode=0, we have
|
||||
//severity: INFO
|
||||
//asString: ECA_NORMAL
|
||||
//msgID: ECA_NORMAL
|
||||
//code: SUCCESS: ECA_NORMAL
|
||||
//info: Normal successful completion
|
||||
//message: SUCCESS: ECA_NORMAL Normal successful completion
|
||||
class CAFEStatus {
|
||||
|
||||
public:
|
||||
CAFEStatusSeverity css;
|
||||
CAFEStatusInfo csi;
|
||||
CAFEStatusCode csc;
|
||||
CAFEStatus() {};
|
||||
|
||||
std::string severity(int i) {
|
||||
return (std::string) css.message(i);
|
||||
}
|
||||
|
||||
std::string asString(int i) {
|
||||
return (std::string) csc.msgIDAsString(i);
|
||||
}
|
||||
|
||||
std::string msgID(int i) {
|
||||
return (std::string) csc.msgIDAsString(i);
|
||||
}
|
||||
|
||||
std::string code(int i) {
|
||||
return (std::string) csc.message(i);
|
||||
}
|
||||
|
||||
std::string info(int i) {
|
||||
return (std::string) csi.message(i);
|
||||
}
|
||||
|
||||
std::string message(int i) {
|
||||
std::string strRet="";
|
||||
strRet.append(csc.message(i));
|
||||
strRet.append(" ");
|
||||
strRet.append(csi.message(i));
|
||||
return (std::string) strRet;
|
||||
}
|
||||
|
||||
void report (int i) {
|
||||
std::cout << "------------------" << std::endl;
|
||||
std::cout << "CAFE STATUS REPORT" << std::endl;
|
||||
std::cout << "------------------" << std::endl;
|
||||
std::cout << csc.message(i) << std::endl;
|
||||
std::cout << csi.message(i) << std::endl;
|
||||
std::cout << "------------------" << std::endl;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // STATUSCODES_H
|
||||
2159
include/transpose.h
Normal file
2159
include/transpose.h
Normal file
File diff suppressed because it is too large
Load Diff
830
include/zhelpers.h
Normal file
830
include/zhelpers.h
Normal file
@@ -0,0 +1,830 @@
|
||||
/* =====================================================================
|
||||
zhelpers.h
|
||||
|
||||
Helper header file for example applications.
|
||||
=====================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __ZHELPERS_H_INCLUDED__
|
||||
#define __ZHELPERS_H_INCLUDED__
|
||||
|
||||
#if HAVE_ZEROMQ
|
||||
|
||||
|
||||
// Include a bunch of headers that we will need in the examples
|
||||
|
||||
#include <zmq.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#if (defined (WIN32))
|
||||
# include <time.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
|
||||
// Version checking, and patch up missing constants to match 2.1
|
||||
#if ZMQ_VERSION_MAJOR == 2
|
||||
# error "Please upgrade to ZeroMQ/3.2 for these examples"
|
||||
#endif
|
||||
|
||||
// Provide random number from 0..(num-1)
|
||||
#if (defined (WIN32))
|
||||
# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0))
|
||||
#else
|
||||
# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0))
|
||||
#endif
|
||||
|
||||
#if HAVE_JSON
|
||||
#include <json/json.h>
|
||||
#endif
|
||||
|
||||
#include <cafeService.h>
|
||||
|
||||
|
||||
unsigned short inDumpFlag=2;
|
||||
string hashIs="";
|
||||
string hashOriginal="";
|
||||
unsigned short hashOriginalFlag=0;
|
||||
bool fillBSPV=false;
|
||||
vector<std::string> bsPV;
|
||||
|
||||
// Receive 0MQ string from socket and convert into C string
|
||||
// Caller must free returned string. Returns NULL if the context
|
||||
// is being terminated.
|
||||
static char *
|
||||
s_recv (void *socket) {
|
||||
char buffer [4096];
|
||||
int size = zmq_recv (socket, buffer, 4096, 0); //ZMQ_DONTWAIT);
|
||||
if (size == -1)
|
||||
return NULL;
|
||||
if (size > 4096)
|
||||
size = 4096;
|
||||
buffer [size] = 0;
|
||||
return strdup (buffer);
|
||||
}
|
||||
|
||||
// Convert C string to 0MQ string and send to socket
|
||||
static int
|
||||
s_send (void *socket, char *string) {
|
||||
int size = zmq_send (socket, string, strlen (string), 0);
|
||||
return size;
|
||||
}
|
||||
|
||||
// Sends string as 0MQ string, as multipart non-terminal
|
||||
static int
|
||||
s_sendmore (void *socket, char *string) {
|
||||
int size = zmq_send (socket, string, strlen (string), ZMQ_SNDMORE);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Receives all message parts from socket, prints neatly
|
||||
//
|
||||
static void
|
||||
s_dump (DBPMKeeper & dbpm)
|
||||
{
|
||||
|
||||
if (inDumpFlag==1) {
|
||||
cout << "zeroMQ socket is busy " << endl;
|
||||
cout << "waiting got zmq timeout " << endl;
|
||||
}
|
||||
|
||||
puts ("//START----------------------------------------//");
|
||||
|
||||
void * socket = dbpm.subscriber;
|
||||
|
||||
|
||||
#if HAVE_JSON
|
||||
Json::Value parsedFromString;
|
||||
Json::Reader reader;
|
||||
bool parsingSuccessful;
|
||||
Json::FastWriter fastWriter;
|
||||
|
||||
#endif
|
||||
|
||||
int64_t more; // Multipart detection
|
||||
more = 0;
|
||||
size_t more_size = sizeof (more);
|
||||
|
||||
int bsPVIdx=-1;
|
||||
dbpm.status=ICAFE_NORMAL;
|
||||
|
||||
int nZeroSize=0;
|
||||
|
||||
cout << "df = " << inDumpFlag << endl;
|
||||
|
||||
while (inDumpFlag==1) {
|
||||
cout << "df/ = " << inDumpFlag << endl;
|
||||
cout << " sleeping " << endl;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
int subMessage=0;
|
||||
int nSequentialHeader=0;
|
||||
|
||||
while (1) {
|
||||
inDumpFlag=1;
|
||||
|
||||
// puts ("//WHILE LOOP ----------------------------------------//");
|
||||
//cout << "subMessage " << subMessage << endl;
|
||||
// Process all parts of the message
|
||||
zmq_msg_t message;
|
||||
zmq_msg_init (&message);
|
||||
|
||||
size_t size = zmq_msg_recv (&message, socket, 0);
|
||||
//puts ("//MESSAGE RECEIVED ----------------------------------------//");
|
||||
|
||||
if (size == -1) {
|
||||
cout << " Error is " << zmq_errno() << " " << zmq_strerror(zmq_errno()) << endl;
|
||||
//Resource unavailable means that there is nothing to read now
|
||||
|
||||
zmq_msg_close (&message);
|
||||
dbpm.status=ICAFE_LINUX_ERROR+zmq_errno() ;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
else if (size == 0) {
|
||||
|
||||
//cout << " Data of Zero SIZE for submessage " << subMessage << endl;
|
||||
|
||||
++nZeroSize;
|
||||
|
||||
//zmq_msg_close (&message);
|
||||
//dbpm.status=ECAFE_NODATA;
|
||||
//break;
|
||||
//Comes in pairs; one for val one for timestamp
|
||||
if (nZeroSize%2==1) {
|
||||
++bsPVIdx;
|
||||
|
||||
// cout << " pv with zero size: " << bsPV[bsPVIdx] << endl;
|
||||
|
||||
}
|
||||
|
||||
++subMessage;
|
||||
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
|
||||
// Dump the message as text or binary
|
||||
char *data = (char*)zmq_msg_data (&message);
|
||||
int is_text = 1;
|
||||
int char_nbr;
|
||||
|
||||
//char cmd[5000]="";
|
||||
|
||||
for (char_nbr = 0; char_nbr < size; char_nbr++)
|
||||
if ((unsigned char) data [char_nbr] < 32
|
||||
|| (unsigned char) data [char_nbr] > 127)
|
||||
is_text = 0;
|
||||
|
||||
// printf (" SIZE [%03d] ", size);
|
||||
|
||||
/*
|
||||
if (is_text) {
|
||||
cout << " TEXT +++++++++++ " << endl;
|
||||
}
|
||||
else {
|
||||
cout << " NOT TEXT +++++++++++ " << endl;
|
||||
}
|
||||
|
||||
|
||||
for (char_nbr = 0; char_nbr < size; char_nbr++) {
|
||||
if (is_text) {
|
||||
printf ("%c", data [char_nbr]);
|
||||
//snprintf(cmd + strlen(cmd), (sizeof cmd) - strlen(cmd), "%c", data [char_nbr]);
|
||||
|
||||
}
|
||||
else {
|
||||
printf ("%02X", (unsigned char) data [char_nbr]);
|
||||
//printf ("%d", (unsigned char) data [char_nbr]);
|
||||
|
||||
//snprintf(cmd + strlen(cmd), (sizeof cmd) - strlen(cmd), "%d", (unsigned char)data [char_nbr]);
|
||||
|
||||
//if (data[0] == '\x7') {
|
||||
// cout << " little endian " << endl;
|
||||
//}
|
||||
//else {
|
||||
// cout << "big endian " << endl;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}//for
|
||||
printf ("\n");
|
||||
*/
|
||||
|
||||
|
||||
if (is_text) {
|
||||
parsingSuccessful=reader.parse(data, parsedFromString);
|
||||
if (parsingSuccessful) {
|
||||
Json::StyledWriter styledWriter;
|
||||
//cout << "STYLED: --------------------------------" << endl;
|
||||
//cout << styledWriter.write(parsedFromString) << endl;
|
||||
//cout << "----------------------------------" << endl;
|
||||
cout << parsedFromString["htype"] << endl;
|
||||
|
||||
|
||||
if (fastWriter.write(parsedFromString["htype"]).find("bsr_m-1.1") != std::string::npos) {
|
||||
|
||||
++nSequentialHeader;
|
||||
|
||||
hashIs=parsedFromString["hash"].asString();
|
||||
|
||||
if (hashOriginalFlag<2) {
|
||||
cout << hashIs << " is different to original/// " << hashOriginal << endl;
|
||||
hashOriginal=hashIs;
|
||||
++hashOriginalFlag;
|
||||
fillBSPV=true;
|
||||
}
|
||||
|
||||
if (hashOriginal.compare(hashIs)!=0) {
|
||||
cout << hashIs << " is different to original " << hashOriginal << endl;
|
||||
fillBSPV=true;
|
||||
|
||||
}
|
||||
cout << "p id " << parsedFromString["pulse_id"].asUInt64() << endl;
|
||||
|
||||
//Reset values as a change of hash signifies that data from two pulse ids
|
||||
//is being sent in one zeromq messages
|
||||
|
||||
subMessage=0;
|
||||
|
||||
bsPVIdx=-1;
|
||||
dbpm.status=ICAFE_NORMAL;
|
||||
|
||||
nZeroSize=0;
|
||||
|
||||
|
||||
/*
|
||||
cout << "(1)++++++++++++++++++++++++++++++++++++++++MAIN++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
|
||||
cout << "hash " << parsedFromString["hash"] << endl;
|
||||
cout << "p id " << parsedFromString["pulse_id"].asUInt64() << endl;
|
||||
cout << "g ts " << parsedFromString["global_timestamp"] << endl;
|
||||
cout << "comp " << parsedFromString["dh_compression"] << endl;
|
||||
|
||||
cout << "sec " << parsedFromString["global_timestamp"]["sec"].asUInt() << endl;
|
||||
cout << "nsec " << parsedFromString["global_timestamp"]["ns"].asUInt() << endl;
|
||||
*/
|
||||
|
||||
}
|
||||
else if (fastWriter.write(parsedFromString["htype"]).find("bsr_d-1.1") != std::string::npos) {
|
||||
|
||||
|
||||
|
||||
//if (fillBSPV) {
|
||||
|
||||
bsPV.clear();
|
||||
bsPV.reserve(dbpm.getNPV());
|
||||
/*
|
||||
if (dbpm.getNPV() != parsedFromString["channels"].size() ) {
|
||||
cout << "No of CONFIGURED BPMS: " << dbpm.getNPV()
|
||||
<< " is diffent to that being channeled " << parsedFromString["channels"].size() << endl;
|
||||
bsPV.reserve( max( (size_t) parsedFromString["channels"].size(),dbpm.getNPV()) );
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//cout << "chan " << parsedFromString["channels"] << endl;
|
||||
|
||||
cout << "No of channels " << parsedFromString["channels"].size() << endl;
|
||||
|
||||
cout << "(2)++++++++++++++++++++++++++++++++++++++++HEADER++++++++++++++++++++++++++++++++++++++++++" << endl;
|
||||
|
||||
for (Json::Value::ArrayIndex i=0; i < parsedFromString["channels"].size(); ++ i) {
|
||||
|
||||
//cout << "name " << parsedFromString["channels"][i]["name"].asString() << endl;
|
||||
//cout << "enco " << parsedFromString["channels"][i]["encoding"] << endl;
|
||||
//cout << "type " << parsedFromString["channels"][i]["type"] << endl;
|
||||
|
||||
bsPV.push_back( (parsedFromString["channels"][i]["name"]).asString());
|
||||
}
|
||||
/*
|
||||
cout << "LIST OF PVS " << endl;
|
||||
for (size_t i=0; i< bsPV.size(); ++i ) {
|
||||
cout << i << " // " << bsPV[i].c_str() << " " << endl;
|
||||
}
|
||||
cout << endl;
|
||||
*/
|
||||
|
||||
//cout << "NEW FILL: size of bsPV " << bsPV.size() << endl;
|
||||
fillBSPV=false;
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
cout << "HEADER IS SOMETHING ELSE: " << endl;
|
||||
cout << parsedFromString["htype"] << endl;
|
||||
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//cout << "----------------------------------" << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nSequentialHeader >5) {
|
||||
cout << "WARNING: ZEROMQ SUB-MESSAGE DOES NOT CLOSE " << endl;
|
||||
cout << "WARNING: FORCING CLOSE AND BREAKING FROM LOOP " << endl;
|
||||
zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size);
|
||||
|
||||
zmq_msg_close (&message);
|
||||
cout << "message mulipart --> more == " << more << endl;
|
||||
|
||||
dbpm.status=LINUX_EAGAIN; //ICAFE_LINUX_ERROR +zmq_errno() ;
|
||||
//break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
union foo
|
||||
{
|
||||
char c[sizeof(double)];
|
||||
double d;
|
||||
|
||||
} bar;
|
||||
|
||||
//SIZE 16 is timestamp
|
||||
//SIZE 8 is x,y,Q
|
||||
//SIZE 2 is valid
|
||||
|
||||
if (subMessage > 1430) {
|
||||
cout << " SIZE " << size << " subMessage " << subMessage << endl;
|
||||
cout << "size of bsPV " << bsPV.size() << endl;
|
||||
}
|
||||
|
||||
if (subMessage > 0 && subMessage%2 ==0) {
|
||||
if (size==8) {
|
||||
|
||||
// big endian
|
||||
for (char_nbr = 0; char_nbr < size; char_nbr++) {
|
||||
bar.c[char_nbr]=data[size-1-char_nbr]; // THis works for big engian
|
||||
}
|
||||
// little endian
|
||||
//for (char_nbr = 0; char_nbr < size; char_nbr++) {
|
||||
// bar.c[char_nbr]=data[char_nbr];
|
||||
//}
|
||||
|
||||
|
||||
//cout << "UNION D " << bar.d << endl;
|
||||
|
||||
|
||||
double v; // = (double*) data;
|
||||
memcpy(&v, bar.c, sizeof(double));
|
||||
//cout << " double val " << v << endl;
|
||||
|
||||
//This is BPM Data - value
|
||||
++bsPVIdx;
|
||||
|
||||
if (dbpm.getPVIdx(bsPV[bsPVIdx]) <0) {
|
||||
cout << " WARNING--> THIS CHANNEL WAS NOT REQUESTED IN CONFIGURATION FILE " << endl;
|
||||
cout << " bsPV index = " << bsPVIdx << endl;
|
||||
cout << " pv from bs = " << bsPV[bsPVIdx] << endl;
|
||||
cout << " Illegal index Value =" << dbpm.getPVIdx(bsPV[bsPVIdx]) << endl;
|
||||
cout << " SKIPPING THIS BPM... " << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
dbpm.pvd[dbpm.getPVIdx(bsPV[bsPVIdx])].set(v);
|
||||
|
||||
//cout << " readback of value that was set = " << dbpm.pvd[dbpm.getPVIdx(bsPV[bsPVIdx])].val[0].d << endl;
|
||||
|
||||
}
|
||||
else if (size==2) {
|
||||
unsigned short iv;
|
||||
//memcpy(&iv, cmd, size);
|
||||
//big endian
|
||||
for (size_t n=0; n < size; n++) {
|
||||
iv = (iv << 8) + data[n];
|
||||
}
|
||||
//little endian
|
||||
//for (size_t n = size; n >= 0; n--) {
|
||||
// iv = (iv << 8) + data[n];
|
||||
//}
|
||||
|
||||
//This is BPM Data - VALID/INVALID
|
||||
|
||||
//cout << "uint val (1 means valid) " << iv << endl;
|
||||
|
||||
/*
|
||||
std::copy(data, data + 32, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 8, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 4, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 2, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 1, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
|
||||
*/
|
||||
++bsPVIdx;
|
||||
|
||||
|
||||
if (dbpm.getPVIdx(bsPV[bsPVIdx]) <0) {
|
||||
cout << " WARNING--> THIS CHANNEL WAS NOT REQUESTED IN CONFIGURATION FILE " << endl;
|
||||
cout << " bsPV index = " << bsPVIdx << endl;
|
||||
cout << " pv from bs = " << bsPV[bsPVIdx] << endl;
|
||||
cout << " Illegal index Value =" << dbpm.getPVIdx(bsPV[bsPVIdx]) << endl;
|
||||
cout << " SKIPPING THIS BPM ENUM TYPE " << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (iv==1) {
|
||||
dbpm.pvd[dbpm.getPVIdx(bsPV[bsPVIdx])].set((std::string) "VALID");
|
||||
|
||||
}
|
||||
else {
|
||||
dbpm.pvd[dbpm.getPVIdx(bsPV[bsPVIdx])].set((std::string) "INVALID");
|
||||
}
|
||||
|
||||
//cout << "value DBPM = " << dbpm.pvd[dbpm.getPVIdx(bsPV[bsPVIdx])].val[0].str << endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (subMessage > 1 && subMessage%2 ==1) {
|
||||
//cout << "timestamp " << endl;
|
||||
unsigned int a,b;
|
||||
for (size_t n=0; n < size/2; n++) {
|
||||
a = (a << 8) + data[n];
|
||||
}
|
||||
for (size_t n=size/2; n < size; n++) {
|
||||
b = (b << 8) + data[n];
|
||||
}
|
||||
|
||||
//cout << "a " << a << " b " << b << endl;
|
||||
|
||||
|
||||
if (dbpm.getPVIdx(bsPV[bsPVIdx]) <0) {
|
||||
cout << " WARNING--> THIS CHANNEL WAS NOT REQUESTED IN CONFIGURATION FILE " << endl;
|
||||
cout << " bsPV index = " << bsPVIdx << endl;
|
||||
cout << " pv from bs = " << bsPV[bsPVIdx] << endl;
|
||||
cout << " Illegal index Value =" << dbpm.getPVIdx(bsPV[bsPVIdx]) << endl;
|
||||
cout << " SKIPPING THIS BPM TIMESTAMP " << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
dbpm.pvd[dbpm.getPVIdx(bsPV[bsPVIdx])].ts.secPastEpoch=a;
|
||||
dbpm.pvd[dbpm.getPVIdx(bsPV[bsPVIdx])].ts.nsec=b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//cout << "subMessage above: " << subMessage << endl;
|
||||
|
||||
++subMessage;
|
||||
|
||||
|
||||
} //ifelse
|
||||
|
||||
|
||||
zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size);
|
||||
zmq_msg_close (&message);
|
||||
|
||||
|
||||
|
||||
if (!more) {
|
||||
cout << "subMessage total: " << subMessage << endl;
|
||||
puts ("//------------------------------------END-------------------------------------//");
|
||||
|
||||
break; // Last message part
|
||||
}
|
||||
} //while 1
|
||||
|
||||
inDumpFlag=0;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Receives all message parts from socket, prints neatly
|
||||
//
|
||||
static void
|
||||
s_dump (void *socket)
|
||||
{
|
||||
puts ("//START----------------------------------------//");
|
||||
int subMessage=0;
|
||||
#if HAVE_JSON
|
||||
Json::Value parsedFromString;
|
||||
Json::Reader reader;
|
||||
bool parsingSuccessful;
|
||||
Json::FastWriter fastWriter;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
while (1) {
|
||||
// Process all parts of the message
|
||||
zmq_msg_t message;
|
||||
zmq_msg_init (&message);
|
||||
size_t size = zmq_msg_recv (&message, socket, 0);
|
||||
|
||||
if (size == -1) {
|
||||
cout << " Error is " << zmq_errno() << " " << zmq_strerror(zmq_errno()) << endl;
|
||||
//Resource unavailable means that there is nothing to read now
|
||||
|
||||
zmq_msg_close (&message);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
||||
// Dump the message as text or binary
|
||||
char *data = (char*)zmq_msg_data (&message);
|
||||
int is_text = 1;
|
||||
int char_nbr;
|
||||
|
||||
//char cmd[5000]="";
|
||||
|
||||
for (char_nbr = 0; char_nbr < size; char_nbr++)
|
||||
if ((unsigned char) data [char_nbr] < 32
|
||||
|| (unsigned char) data [char_nbr] > 127)
|
||||
is_text = 0;
|
||||
|
||||
printf ("[%03d] ", size);
|
||||
|
||||
for (char_nbr = 0; char_nbr < size; char_nbr++) {
|
||||
if (is_text) {
|
||||
printf ("%c", data [char_nbr]);
|
||||
//snprintf(cmd + strlen(cmd), (sizeof cmd) - strlen(cmd), "%c", data [char_nbr]);
|
||||
|
||||
}
|
||||
else {
|
||||
printf ("%02X", (unsigned char) data [char_nbr]);
|
||||
//printf ("%d", (unsigned char) data [char_nbr]);
|
||||
|
||||
//snprintf(cmd + strlen(cmd), (sizeof cmd) - strlen(cmd), "%d", (unsigned char)data [char_nbr]);
|
||||
|
||||
//if (data[0] == '\x7') {
|
||||
// cout << " little endian " << endl;
|
||||
//}
|
||||
//else {
|
||||
// cout << "big endian " << endl;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}//for
|
||||
printf ("\n");
|
||||
/*
|
||||
for (char_nbr = 0; char_nbr < size; char_nbr++) {
|
||||
if (is_text) {
|
||||
printf ("%c", data [char_nbr]);
|
||||
snprintf(cmd + strlen(cmd), (sizeof cmd) - strlen(cmd), "%c", data [char_nbr]);
|
||||
}
|
||||
else {
|
||||
printf ("%02X", (unsigned char) data [char_nbr]);
|
||||
snprintf(cmd + strlen(cmd), (sizeof cmd) - strlen(cmd), "%02X", (unsigned char)data [size-1-char_nbr]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (is_text) {
|
||||
parsingSuccessful=reader.parse(data, parsedFromString);
|
||||
if (parsingSuccessful) {
|
||||
Json::StyledWriter styledWriter;
|
||||
cout << "STYLED: --------------------------------" << endl;
|
||||
cout << styledWriter.write(parsedFromString) << endl;
|
||||
cout << "----------------------------------" << endl;
|
||||
cout << parsedFromString["htype"] << endl;
|
||||
|
||||
|
||||
if (fastWriter.write(parsedFromString["htype"]).find("bsr_m-1.1") != std::string::npos) {
|
||||
|
||||
cout << "hash " << parsedFromString["hash"] << endl;
|
||||
cout << "p id " << parsedFromString["pulse_id"].asUInt64() << endl;
|
||||
cout << "g ts " << parsedFromString["global_timestamp"] << endl;
|
||||
cout << "comp " << parsedFromString["dh_compression"] << endl;
|
||||
|
||||
cout << "sec " << parsedFromString["global_timestamp"]["sec"].asUInt() << endl;
|
||||
cout << "nsec " << parsedFromString["global_timestamp"]["ns"].asUInt() << endl;
|
||||
|
||||
|
||||
}
|
||||
else if (fastWriter.write(parsedFromString["htype"]).find("bsr_d-1.1") != std::string::npos) {
|
||||
|
||||
|
||||
|
||||
|
||||
cout << "chan " << parsedFromString["channels"] << endl;
|
||||
|
||||
|
||||
|
||||
for (Json::Value::ArrayIndex i=0; i < parsedFromString["channels"].size(); ++ i) {
|
||||
|
||||
cout << "name " << parsedFromString["channels"][i]["name"] << endl;
|
||||
cout << "enco " << parsedFromString["channels"][i]["encoding"] << endl;
|
||||
cout << "type " << parsedFromString["channels"][i]["type"] << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
cout << "----------------------------------" << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
union foo
|
||||
{
|
||||
char c[sizeof(double)];
|
||||
double d;
|
||||
|
||||
} bar;
|
||||
|
||||
|
||||
|
||||
if (subMessage > 0 && subMessage%2 ==0) {
|
||||
if (size==8) {
|
||||
|
||||
// big endian
|
||||
for (char_nbr = 0; char_nbr < size; char_nbr++) {
|
||||
bar.c[char_nbr]=data[size-1-char_nbr]; // THis works for big engian
|
||||
}
|
||||
// little endian
|
||||
//for (char_nbr = 0; char_nbr < size; char_nbr++) {
|
||||
// bar.c[char_nbr]=data[char_nbr];
|
||||
//}
|
||||
|
||||
|
||||
cout << "UNION D " << bar.d << endl;
|
||||
|
||||
|
||||
double v; // = (double*) data;
|
||||
memcpy(&v, bar.c, sizeof(double));
|
||||
cout << "double val " << v << endl;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (size==2) {
|
||||
unsigned short i;
|
||||
//memcpy(&i, cmd, size);
|
||||
//big endian
|
||||
for (size_t n=0; n < size; n++) {
|
||||
i = (i << 8) + data[n];
|
||||
}
|
||||
//little endian
|
||||
//for (size_t n = size; n >= 0; n--) {
|
||||
// i = (i << 8) + data[n];
|
||||
//}
|
||||
|
||||
|
||||
cout << "uint val " << i << endl;
|
||||
|
||||
/*
|
||||
std::copy(data, data + 32, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 8, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 4, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 2, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
std::copy(data, data + 1, reinterpret_cast<char *>(&i));
|
||||
cout << "uint16 val " << i << endl;
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
else if (subMessage > 1 && subMessage%2 ==1) {
|
||||
cout << "timestamp " << endl;
|
||||
unsigned int a,b;
|
||||
for (size_t n=0; n < size/2; n++) {
|
||||
a = (a << 8) + data[n];
|
||||
}
|
||||
for (size_t n=size/2; n < size; n++) {
|
||||
b = (b << 8) + data[n];
|
||||
}
|
||||
|
||||
cout << "a " << a << " b " << b << endl;
|
||||
}
|
||||
|
||||
++subMessage;
|
||||
|
||||
} //ifelse
|
||||
|
||||
int64_t more; // Multipart detection
|
||||
more = 0;
|
||||
size_t more_size = sizeof (more);
|
||||
zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size);
|
||||
zmq_msg_close (&message);
|
||||
if (!more) {
|
||||
puts ("//END----------------------------------------//");
|
||||
break; // Last message part
|
||||
}
|
||||
} //while 1
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Set simple random printable identity on socket
|
||||
//
|
||||
static void
|
||||
s_set_id (void *socket)
|
||||
{
|
||||
char identity [10];
|
||||
sprintf (identity, "%04X-%04X", randof (0x10000), randof (0x10000));
|
||||
zmq_setsockopt (socket, ZMQ_IDENTITY, identity, strlen (identity));
|
||||
}
|
||||
|
||||
/*
|
||||
// Sleep for a number of milliseconds
|
||||
static void
|
||||
s_sleep (int msecs)
|
||||
{
|
||||
#if (defined (WIN32))
|
||||
Sleep (msecs);
|
||||
#else
|
||||
struct timespec t;
|
||||
t.tv_sec = msecs / 1000;
|
||||
t.tv_nsec = (msecs % 1000) * 1000000;
|
||||
nanosleep (&t, NULL);
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
// Return current system clock as milliseconds
|
||||
static int64_t
|
||||
s_clock (void)
|
||||
{
|
||||
#if (defined (WIN32))
|
||||
SYSTEMTIME st;
|
||||
GetSystemTime (&st);
|
||||
return (int64_t) st.wSecond * 1000 + st.wMilliseconds;
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
return (int64_t) (tv.tv_sec * 1000 + tv.tv_usec / 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Print formatted string to stdout, prefixed by date/time and
|
||||
// terminated with a newline.
|
||||
|
||||
/*
|
||||
static void
|
||||
s_console (const char *format, ...)
|
||||
{
|
||||
time_t curtime = time (NULL);
|
||||
struct tm *loctime = localtime (&curtime);
|
||||
char *formatted = (char*)malloc (20);
|
||||
strftime (formatted, 20, "%y-%m-%d %H:%M:%S ", loctime);
|
||||
printf ("%s", formatted);
|
||||
free (formatted);
|
||||
|
||||
va_list argptr;
|
||||
va_start (argptr, format);
|
||||
vprintf (format, argptr);
|
||||
va_end (argptr);
|
||||
printf ("\n");
|
||||
}
|
||||
*/
|
||||
#endif // __ZHELPERS_H_INCLUDED__
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user