cafe-1.12.5 release
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
* \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 {
|
||||
class PVCtrlHolder : public PVHolder
|
||||
{
|
||||
|
||||
friend class CAFE;
|
||||
friend class Connect;
|
||||
@@ -92,7 +93,8 @@ public:
|
||||
|
||||
val.reset( new CAFE_DATATYPE_UNION[nelem] );
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
val[i].d=0.0;
|
||||
};
|
||||
};
|
||||
@@ -112,7 +114,8 @@ public:
|
||||
{
|
||||
_nelem>0 ? nelem=_nelem : nelem=1;
|
||||
|
||||
if (_nelem>size) {
|
||||
if (_nelem>size)
|
||||
{
|
||||
|
||||
size=_nelem;
|
||||
|
||||
@@ -131,27 +134,31 @@ public:
|
||||
{
|
||||
return units;
|
||||
}
|
||||
|
||||
std::string getUnitsAsString() const
|
||||
{
|
||||
return (std::string) units;
|
||||
}
|
||||
|
||||
/*Defined in PVHolder.h
|
||||
short getNoEnumStrings () const
|
||||
{
|
||||
return noStr;
|
||||
};
|
||||
char * getEnumString(short indx) const
|
||||
{
|
||||
return (char *) strs[indx];
|
||||
return (char *) strs[indx];
|
||||
};
|
||||
|
||||
|
||||
*/
|
||||
|
||||
std::vector<std::string> getEnumStrings() const
|
||||
{
|
||||
|
||||
std::vector<std::string> vEnumStrings;
|
||||
|
||||
vEnumStrings.reserve(noStr>0?noStr:1);
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
for ( short i=0; i<noStr; ++i)
|
||||
{
|
||||
vEnumStrings.push_back(strs[i]);
|
||||
}
|
||||
return vEnumStrings;
|
||||
@@ -161,10 +168,12 @@ public:
|
||||
short getEnumFromString(std::string enumString)
|
||||
{
|
||||
|
||||
short returnValue=-1;
|
||||
short returnValue=INVALID_ENUM_RETURN_VALUE;
|
||||
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
if (strcmp(enumString.c_str(), strs[i])==0) {
|
||||
for ( short i=0; i<noStr; ++i)
|
||||
{
|
||||
if (strcmp(enumString.c_str(), strs[i])==0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -173,19 +182,33 @@ public:
|
||||
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) {
|
||||
for ( short i=0; i<noStr; ++i)
|
||||
{
|
||||
if (strcmp(pvStripped, strs[i])==0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
|
||||
std::cout << "*** Method getEnumFromString(string enumString) ***" << std::endl;
|
||||
std::cout << "The given input string '" << enumString << "' was not recognized! " << std::endl;
|
||||
std::cout << "Valid values are: " << std::endl;
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
std::cout << i << ":" << strs[i] << std::endl;
|
||||
}
|
||||
|
||||
if (dataType==CAFE_ENUM) {
|
||||
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
|
||||
std::cout << "*** Method getEnumFromString(string enumString) ***" << std::endl;
|
||||
std::cout << "The given input string '" << enumString << "' was not recognized! " << std::endl;
|
||||
if (noStr > 0) {
|
||||
std::cout << "Valid values are: " << std::endl;
|
||||
for ( short i=0; i<noStr; ++i)
|
||||
{
|
||||
std::cout << i << ":" << strs[i] << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
|
||||
std::cout << "*** Method getEnumFromString(string enumString) ***" << std::endl;
|
||||
std::cout << "Native DataType " << (CAFEDataTypeCode().asString((CAFE_DATATYPE) dataType)).c_str()
|
||||
<< " is not the enumerated type, DBF_ENUM " << std::endl;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
||||
@@ -194,26 +217,48 @@ public:
|
||||
std::string getStringFromEnum(unsigned short enumValue) const
|
||||
{
|
||||
|
||||
std::string returnValue="";
|
||||
std::string returnValue=INVALID_ENUM_RETURN_STRING;
|
||||
|
||||
if (enumValue<noStr) {
|
||||
if (enumValue<noStr)
|
||||
{
|
||||
return (std::string) strs[enumValue];
|
||||
}
|
||||
else {
|
||||
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
|
||||
std::cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << std::endl;
|
||||
std::cout << "The given input index " << enumValue << " exceeds the number of enum states " << noStr << std::endl;
|
||||
std::cout << "Valid values are: " << std::endl;
|
||||
for ( short i=0; i<noStr; ++i) {
|
||||
std::cout << i << ":" << strs[i] << std::endl;
|
||||
else
|
||||
{
|
||||
if (dataType==CAFE_ENUM) {
|
||||
|
||||
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
|
||||
std::cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << std::endl;
|
||||
std::cout << "The given input index [" << enumValue << "] exceeds the number of enum states " << noStr << std::endl;
|
||||
if (noStr > 0)
|
||||
{
|
||||
std::cout << "Valid values are: " << std::endl;
|
||||
for ( short i=0; i<noStr; ++i)
|
||||
{
|
||||
std::cout << i << ":" << strs[i] << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
|
||||
std::cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << std::endl;
|
||||
std::cout << "Native DataType " << (CAFEDataTypeCode().asString((CAFE_DATATYPE) dataType)).c_str()
|
||||
<< " is not the enumerated type, DBF_ENUM " << std::endl;
|
||||
}
|
||||
|
||||
if (enumValue<MAX_ENUM_STATES) {
|
||||
return returnValue;
|
||||
|
||||
/*
|
||||
if (enumValue<MAX_ENUM_STATES)
|
||||
{
|
||||
return (std::string) strs[enumValue];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return returnValue;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +391,8 @@ public:
|
||||
std::cout << "------------------------------------------" << std::endl;
|
||||
std::cout << "PVCtrlHolder:" << std::endl;
|
||||
std::cout << "processVariable= " << pv << std::endl;
|
||||
if (strcmp(pvAlias,pv)) {
|
||||
if (strcmp(pvAlias,pv))
|
||||
{
|
||||
std::cout << "pvAlias = " << pvAlias << std::endl;
|
||||
}
|
||||
std::cout << "device = " << device << std::endl;
|
||||
@@ -354,7 +400,8 @@ public:
|
||||
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) {
|
||||
if (dataType!=CAFE_NO_ACCESS || dataType != CAFE_TYPENOTCONN)
|
||||
{
|
||||
std::cout << "nelem = " << nelem << std::endl;
|
||||
|
||||
//std::cout << "alarmStatus = " << alarmStatus << " [" << acond.asString(alarmStatus)<< "]" << std::endl;
|
||||
@@ -377,66 +424,79 @@ public:
|
||||
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;
|
||||
}
|
||||
//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 {
|
||||
//}
|
||||
//else {
|
||||
if (dataType==CAFE_ENUM)
|
||||
{
|
||||
std::cout << "NoStr (ENUM) = " << noStr << std::endl;
|
||||
std::cout << "strs (ENUM) = " ;
|
||||
for (short i=0; i< noStr; ++i) {
|
||||
for (short i=0; i< noStr; ++i)
|
||||
{
|
||||
std::cout << "{" << strs[i] << "} " ;
|
||||
}
|
||||
std::cout <<std::endl;
|
||||
}
|
||||
|
||||
std::cout << "status = " << cafeStatusCode.message(status).c_str() << std::endl;
|
||||
if(nelem>0) {
|
||||
if(nelem>0)
|
||||
{
|
||||
std::cout << "value(s) = " ;
|
||||
}
|
||||
|
||||
switch (dataType) {
|
||||
switch (dataType)
|
||||
{
|
||||
case CAFE_STRING:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) {
|
||||
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 ) {
|
||||
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 ) {
|
||||
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 ) {
|
||||
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 ) {
|
||||
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 ) {
|
||||
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 ) {
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i )
|
||||
{
|
||||
std::cout << val[i].d << " [" << i << "] " ;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* \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 {
|
||||
class PVDataHolder : public PVHolder
|
||||
{
|
||||
|
||||
friend class CAFE;
|
||||
friend class PVGroup;
|
||||
@@ -38,8 +39,8 @@ public:
|
||||
bool hasTS;
|
||||
etsNorm _etsNorm;
|
||||
etsDate _etsDate;
|
||||
TMwdayText tmDay;
|
||||
TMmonthpText tmMonth;
|
||||
TMwdayText tmDay;
|
||||
TMmonthpText tmMonth;
|
||||
|
||||
//Derived class does not inherit constructors
|
||||
PVDataHolder(unsigned int _sizeOfArray)
|
||||
@@ -67,7 +68,8 @@ public:
|
||||
|
||||
val.reset( new CAFE_DATATYPE_UNION[nelem] );
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
val[i].d=0.0;
|
||||
};
|
||||
};
|
||||
@@ -121,7 +123,8 @@ public:
|
||||
void setHasTS(bool t)
|
||||
{
|
||||
hasTS=t;
|
||||
if (t) {
|
||||
if (t)
|
||||
{
|
||||
hasAlarm=t; //TS will also retrieve alarmStatus
|
||||
}
|
||||
return;
|
||||
@@ -137,7 +140,8 @@ public:
|
||||
|
||||
_nelem>0 ? nelem=_nelem : nelem=1;
|
||||
|
||||
if (nelem>size) {
|
||||
if (nelem>size)
|
||||
{
|
||||
size=nelem;
|
||||
val.reset( new CAFE_DATATYPE_UNION[size] );
|
||||
}
|
||||
@@ -150,7 +154,7 @@ public:
|
||||
return ts;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
etsNorm getEpicsTimeStampAsUInt32()
|
||||
{
|
||||
@@ -166,7 +170,8 @@ public:
|
||||
|
||||
//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) {
|
||||
if(ts.nsec >= 1000000000)
|
||||
{
|
||||
std::cout << "OVERFLOW IN gets.nsec CORRECTED for epicsTime converter " << std::endl;
|
||||
ts.nsec=0;
|
||||
}
|
||||
@@ -181,11 +186,11 @@ public:
|
||||
_etsDate.min = local.ansi_tm.tm_min;
|
||||
_etsDate.sec = local.ansi_tm.tm_sec;
|
||||
_etsDate.nsec = (unsigned long) ts.nsec;
|
||||
|
||||
_etsDate.wday = local.ansi_tm.tm_wday;
|
||||
_etsDate.yday = local.ansi_tm.tm_yday;
|
||||
_etsDate.isdst = local.ansi_tm.tm_isdst;
|
||||
|
||||
|
||||
_etsDate.wday = local.ansi_tm.tm_wday;
|
||||
_etsDate.yday = local.ansi_tm.tm_yday;
|
||||
_etsDate.isdst = local.ansi_tm.tm_isdst;
|
||||
|
||||
return _etsDate;
|
||||
}
|
||||
|
||||
@@ -205,47 +210,49 @@ public:
|
||||
_etsDate.min = local->tm_min;
|
||||
_etsDate.sec = local->tm_sec;
|
||||
_etsDate.nsec = (unsigned long) ts.nsec;
|
||||
|
||||
_etsDate.wday = local->tm_wday;
|
||||
_etsDate.yday = local->tm_yday;
|
||||
_etsDate.isdst = local->tm_isdst;
|
||||
|
||||
|
||||
_etsDate.wday = local->tm_wday;
|
||||
_etsDate.yday = local->tm_yday;
|
||||
_etsDate.isdst = local->tm_isdst;
|
||||
|
||||
return _etsDate;
|
||||
}
|
||||
|
||||
|
||||
std::string getEpicsTimeStampAsString() {
|
||||
|
||||
std::string getEpicsTimeStampAsString()
|
||||
{
|
||||
|
||||
time_t t= ts.secPastEpoch;
|
||||
struct tm * local;
|
||||
local=localtime(&t);
|
||||
char buf[40];
|
||||
local->tm_year=local->tm_year+20; //EPICS Time is 20 years out!
|
||||
strftime (buf,80,"%b %d, %Y %T.",local);
|
||||
std::string date=(std::string) buf;
|
||||
|
||||
char buft[10];
|
||||
sprintf(buft,"%d",ts.nsec);
|
||||
date.append((std::string) buft);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
std::string getBSTimeStampAsString() {
|
||||
|
||||
char buf[40];
|
||||
local->tm_year=local->tm_year+20; //EPICS Time is 20 years out!
|
||||
strftime (buf,80,"%b %d, %Y %T.",local);
|
||||
std::string date=(std::string) buf;
|
||||
|
||||
char buft[10];
|
||||
sprintf(buft,"%d",ts.nsec);
|
||||
date.append((std::string) buft);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
std::string getBSTimeStampAsString()
|
||||
{
|
||||
|
||||
time_t t= ts.secPastEpoch;
|
||||
|
||||
struct tm * local;
|
||||
local=localtime(&t);
|
||||
char buf[40];
|
||||
strftime (buf,80,"%b %d, %Y %T.",local);
|
||||
std::string date=(std::string) buf;
|
||||
char buft[10];
|
||||
sprintf(buft,"%d",ts.nsec);
|
||||
date.append((std::string) buft);
|
||||
|
||||
return date;
|
||||
}
|
||||
char buf[40];
|
||||
strftime (buf,80,"%b %d, %Y %T.",local);
|
||||
std::string date=(std::string) buf;
|
||||
char buft[10];
|
||||
sprintf(buft,"%d",ts.nsec);
|
||||
date.append((std::string) buft);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -257,7 +264,8 @@ public:
|
||||
void print(unsigned int nelemToPrint)
|
||||
{
|
||||
nelemToPrint=std::min(nelemToPrint,nelem);
|
||||
if (strcmp(pv,"")==0) {
|
||||
if (strcmp(pv,"")==0)
|
||||
{
|
||||
std::cout << "Process Variable NOT ASSIGNED!" << std::endl;
|
||||
std::cout << "Variable has not been applied to a get operation!" << std::endl;
|
||||
return;
|
||||
@@ -268,7 +276,8 @@ public:
|
||||
|
||||
|
||||
std::cout << "processVariable= " << pv << std::endl;
|
||||
if (strcmp(pvAlias,pv) && strcmp(pvAlias,"")) {
|
||||
if (strcmp(pvAlias,pv) && strcmp(pvAlias,""))
|
||||
{
|
||||
std::cout << "pvAlias = " << pvAlias << std::endl;
|
||||
}
|
||||
std::cout << "device = " << device << std::endl;
|
||||
@@ -280,34 +289,41 @@ public:
|
||||
|
||||
//std::cout << "dataType = " << CAFEDataTypeCode.message(dataType).c_str() << std::endl;
|
||||
|
||||
if (dataType != CAFE_NO_ACCESS && dataType != CAFE_TYPENOTCONN) {
|
||||
if (dataType != CAFE_NO_ACCESS && dataType != CAFE_TYPENOTCONN)
|
||||
{
|
||||
std::cout << "nelem = ";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "nelem = ";
|
||||
}
|
||||
std::cout << nelem;
|
||||
std::cout << std::endl;
|
||||
if(!rule) {
|
||||
if(!rule)
|
||||
{
|
||||
std::cout << "rule (0=false) = " << rule <<std::endl;
|
||||
}
|
||||
|
||||
if (dbr_type_is_STS(dbrDataType) || dbr_type_is_TIME(dbrDataType) ) {
|
||||
if (dbr_type_is_STS(dbrDataType) || dbr_type_is_TIME(dbrDataType) )
|
||||
{
|
||||
|
||||
std::cout << "alarmStatus = " << acond.asString(alarmStatus) << " (" << alarmStatus << ")" << std::endl;
|
||||
std::cout << "alarmSeverity = " << aseve.asString(alarmSeverity) << " (" <<alarmSeverity << ")" << std::endl;
|
||||
|
||||
if (dbr_type_is_TIME(dbrDataType)) {
|
||||
if (dbr_type_is_TIME(dbrDataType))
|
||||
{
|
||||
std::cout << "timeStamp = " << ts.secPastEpoch << " sec. and " << ts.nsec << " nsec" << std::endl;
|
||||
}
|
||||
}
|
||||
if(beamEventNo!=0) {
|
||||
if(beamEventNo!=0)
|
||||
{
|
||||
std::cout << "pulseID = " << beamEventNo << std::endl;
|
||||
};
|
||||
std::cout << "status = " << cafeStatusCode.message(status).c_str() << " (" << status << ") " << std::endl;
|
||||
std::cout << "value(s) = " ;
|
||||
|
||||
switch (dataType) {
|
||||
switch (dataType)
|
||||
{
|
||||
case CAFE_STRING:
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].str << " [" << i << "] " ;
|
||||
break;
|
||||
@@ -318,7 +334,8 @@ public:
|
||||
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 ) {
|
||||
for (unsigned int i=0; i <nelemToPrint; ++i )
|
||||
{
|
||||
std::cout <<
|
||||
getAsString(i) << " (" << val[i].us << ")" << " [" << i << "] " ;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* class MemberMap
|
||||
* maps string to index
|
||||
*/
|
||||
class MemberMap {
|
||||
class MemberMap
|
||||
{
|
||||
typedef std::map<long, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapNameIndex;
|
||||
@@ -47,9 +48,11 @@ public:
|
||||
helper.removeLeadingAndTrailingSpaces(_Name.c_str(), pvStripped);
|
||||
std::string Name=pvStripped;
|
||||
|
||||
for (pos=mapNameIndex.begin(); pos != mapNameIndex.end(); ++pos) {
|
||||
for (pos=mapNameIndex.begin(); pos != mapNameIndex.end(); ++pos)
|
||||
{
|
||||
|
||||
if (pos->second==Name) {
|
||||
if (pos->second==Name)
|
||||
{
|
||||
return pos->first;
|
||||
}
|
||||
// String searches such as s.find(s1) return string::npos on failure
|
||||
@@ -66,7 +69,8 @@ public:
|
||||
* This class is the holder of PVDataHolder objects associated with
|
||||
* of group of handles
|
||||
*/
|
||||
class PVGroup {
|
||||
class PVGroup
|
||||
{
|
||||
friend class Connect;
|
||||
friend class CAFE;
|
||||
//if HAVE_LIBQTXML
|
||||
@@ -103,9 +107,10 @@ public:
|
||||
{
|
||||
return pvdata;
|
||||
};
|
||||
PVDataHolder getPVData(unsigned int idx) throw(std::out_of_range)
|
||||
PVDataHolder getPVData(unsigned int idx) noexcept(false) //throw(std::out_of_range)
|
||||
{
|
||||
if(isIndexOutOfRange(idx)) {
|
||||
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;
|
||||
@@ -115,13 +120,15 @@ public:
|
||||
};
|
||||
void setHasAlarm(bool h)
|
||||
{
|
||||
for (unsigned int i=0; i<npv; ++i) {
|
||||
for (unsigned int i=0; i<npv; ++i)
|
||||
{
|
||||
pvdata[i].setHasAlarm(h);
|
||||
}
|
||||
}
|
||||
void setHasTS(bool h)
|
||||
{
|
||||
for (unsigned int i=0; i<npv; ++i) {
|
||||
for (unsigned int i=0; i<npv; ++i)
|
||||
{
|
||||
pvdata[i].setHasTS(h);
|
||||
}
|
||||
}
|
||||
@@ -231,11 +238,13 @@ public:
|
||||
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) {
|
||||
if (statusGroup!=ICAFE_NORMAL)
|
||||
{
|
||||
CAFEStatus cstat;
|
||||
cstat.report(statusGroup);
|
||||
}
|
||||
for (unsigned int i=0; i<npvToPrint; ++i) {
|
||||
for (unsigned int i=0; i<npvToPrint; ++i)
|
||||
{
|
||||
std::cout << "------------------------------------------" << std::endl;
|
||||
std::cout << "Element [" << i << "] of " << npvToPrint << " in group: " << name << std::endl;
|
||||
pvdata[i].print();
|
||||
@@ -248,11 +257,13 @@ public:
|
||||
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) {
|
||||
if (statusGroup!=ICAFE_NORMAL)
|
||||
{
|
||||
CAFEStatus cstat;
|
||||
cstat.report(statusGroup);
|
||||
}
|
||||
for (unsigned int i=0; i<npvToPrint; ++i) {
|
||||
for (unsigned int i=0; i<npvToPrint; ++i)
|
||||
{
|
||||
std::cout << "------------------------------------------" << std::endl;
|
||||
std::cout << "Element [" << i << "] of " << npvToPrint << " in group: " << name << std::endl;
|
||||
pvdata[i].print(std::min(maxNelemWF,pvdata[i].getNelem()));
|
||||
@@ -263,9 +274,12 @@ public:
|
||||
{
|
||||
unsigned int npvToPrint=npv;
|
||||
bool iErrorFound=false;
|
||||
for (unsigned int i=0; i<npvToPrint; ++i) {
|
||||
if (pvdata[i].getStatus() != ICAFE_NORMAL) {
|
||||
if(!iErrorFound) {
|
||||
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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
/* Generated by Cython 0.29.2 */
|
||||
|
||||
#ifndef __PYX_HAVE__PyCafe
|
||||
#define __PYX_HAVE__PyCafe
|
||||
|
||||
@@ -5,24 +7,35 @@
|
||||
#ifndef __PYX_HAVE_API__PyCafe
|
||||
|
||||
#ifndef __PYX_EXTERN_C
|
||||
#ifdef __cplusplus
|
||||
#define __PYX_EXTERN_C extern "C"
|
||||
#else
|
||||
#define __PYX_EXTERN_C extern
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#define __PYX_EXTERN_C extern "C"
|
||||
#else
|
||||
#define __PYX_EXTERN_C extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DL_IMPORT
|
||||
#define DL_IMPORT(_T) _T
|
||||
#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);
|
||||
__PYX_EXTERN_C void cy_data_event_handler_wrapper(void *, unsigned int, std::string, PVDataHolder);
|
||||
__PYX_EXTERN_C void cy_ctrl_event_handler_wrapper(void *, unsigned int, std::string, PVCtrlHolder);
|
||||
__PYX_EXTERN_C void cy_event_handler_wrapper(void *, unsigned int, std::string);
|
||||
__PYX_EXTERN_C void cy_connect_handler_wrapper(void *, unsigned int, std::string, int);
|
||||
__PYX_EXTERN_C void py_cb_wrapper(PVDataHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C void py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C void py_cb_handle_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C void py_cb_handle_monid_wrapper(unsigned int, unsigned long);
|
||||
__PYX_EXTERN_C void py_cb_handle_get_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C void py_cb_handle_put_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C void py_cb_handle_open_wrapper(unsigned int, int);
|
||||
__PYX_EXTERN_C void py_cb_handle_connect_wrapper(unsigned int, std::string, int);
|
||||
|
||||
#endif /* !__PYX_HAVE_API__PyCafe */
|
||||
|
||||
/* WARNING: the interface of the module init function changed in CPython 3.5. */
|
||||
/* It now returns a PyModuleDef instance instead of a PyModule instance. */
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyMODINIT_FUNC initPyCafe(void);
|
||||
#else
|
||||
|
||||
@@ -16,6 +16,10 @@ 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
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_handle_open_wrapper)(unsigned int, int) = 0;
|
||||
#define py_cb_handle_open_wrapper __pyx_api_f_6PyCafe_py_cb_handle_open_wrapper
|
||||
static void (*__pyx_api_f_6PyCafe_py_cb_handle_connect_wrapper)(unsigned int, std::string, int) = 0;
|
||||
#define py_cb_handle_connect_wrapper __pyx_api_f_6PyCafe_py_cb_handle_connect_wrapper
|
||||
#if !defined(__Pyx_PyIdentifier_FromString)
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
|
||||
@@ -48,7 +52,8 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
|
||||
{
|
||||
PyObject *d = 0;
|
||||
PyObject *cobj = 0;
|
||||
union {
|
||||
union
|
||||
{
|
||||
void (*fp)(void);
|
||||
void *p;
|
||||
} tmp;
|
||||
@@ -56,14 +61,16 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
|
||||
if (!d)
|
||||
goto bad;
|
||||
cobj = PyDict_GetItemString(d, funcname);
|
||||
if (!cobj) {
|
||||
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)) {
|
||||
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));
|
||||
@@ -78,11 +85,13 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
|
||||
goto bad;
|
||||
s1 = desc;
|
||||
s2 = sig;
|
||||
while (*s1 != '\0' && *s1 == *s2) {
|
||||
while (*s1 != '\0' && *s1 == *s2)
|
||||
{
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
if (*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);
|
||||
@@ -114,6 +123,8 @@ static int import_PyCafe(void)
|
||||
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;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_handle_open_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_open_wrapper, "void (unsigned int, int)") < 0) goto bad;
|
||||
if (__Pyx_ImportFunction(module, "py_cb_handle_connect_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_connect_wrapper, "void (unsigned int, std::string, int)") < 0) goto bad;
|
||||
Py_DECREF(module);
|
||||
module = 0;
|
||||
return 0;
|
||||
|
||||
123
include/bitshuffle/bitshuffle.h
Normal file
123
include/bitshuffle/bitshuffle.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Bitshuffle - Filter for improving compression of typed binary data.
|
||||
*
|
||||
* This file is part of Bitshuffle
|
||||
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
|
||||
* Website: http://www.github.com/kiyo-masui/bitshuffle
|
||||
* Created: 2014
|
||||
*
|
||||
* See LICENSE file for details about copyright and rights to use.
|
||||
*
|
||||
*
|
||||
* Header File
|
||||
*
|
||||
* Worker routines return an int64_t which is the number of bytes processed
|
||||
* if positive or an error code if negative.
|
||||
*
|
||||
* Error codes:
|
||||
* -1 : Failed to allocate memory.
|
||||
* -11 : Missing SSE.
|
||||
* -12 : Missing AVX.
|
||||
* -80 : Input size not a multiple of 8.
|
||||
* -81 : block_size not multiple of 8.
|
||||
* -91 : Decompression error, wrong number of bytes processed.
|
||||
* -1YYY : Error internal to compression routine with error code -YYY.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BITSHUFFLE_H
|
||||
#define BITSHUFFLE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "bitshuffle_core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ---- bshuf_compress_lz4_bound ----
|
||||
*
|
||||
* Bound on size of data compressed with *bshuf_compress_lz4*.
|
||||
*
|
||||
* Parameters
|
||||
* ----------
|
||||
* size : number of elements in input
|
||||
* elem_size : element size of typed data
|
||||
* block_size : Process in blocks of this many elements. Pass 0 to
|
||||
* select automatically (recommended).
|
||||
*
|
||||
* Returns
|
||||
* -------
|
||||
* Bound on compressed data size.
|
||||
*
|
||||
*/
|
||||
size_t bshuf_compress_lz4_bound(const size_t size,
|
||||
const size_t elem_size, size_t block_size);
|
||||
|
||||
|
||||
/* ---- bshuf_compress_lz4 ----
|
||||
*
|
||||
* Bitshuffled and compress the data using LZ4.
|
||||
*
|
||||
* Transpose within elements, in blocks of data of *block_size* elements then
|
||||
* compress the blocks using LZ4. In the output buffer, each block is prefixed
|
||||
* by a 4 byte integer giving the compressed size of that block.
|
||||
*
|
||||
* Output buffer must be large enough to hold the compressed data. This could
|
||||
* be in principle substantially larger than the input buffer. Use the routine
|
||||
* *bshuf_compress_lz4_bound* to get an upper limit.
|
||||
*
|
||||
* Parameters
|
||||
* ----------
|
||||
* in : input buffer, must be of size * elem_size bytes
|
||||
* out : output buffer, must be large enough to hold data.
|
||||
* size : number of elements in input
|
||||
* elem_size : element size of typed data
|
||||
* block_size : Process in blocks of this many elements. Pass 0 to
|
||||
* select automatically (recommended).
|
||||
*
|
||||
* Returns
|
||||
* -------
|
||||
* number of bytes used in output buffer, negative error-code if failed.
|
||||
*
|
||||
*/
|
||||
int64_t bshuf_compress_lz4(const void* in, void* out, const size_t size, const size_t
|
||||
elem_size, size_t block_size);
|
||||
|
||||
|
||||
/* ---- bshuf_decompress_lz4 ----
|
||||
*
|
||||
* Undo compression and bitshuffling.
|
||||
*
|
||||
* Decompress data then un-bitshuffle it in blocks of *block_size* elements.
|
||||
*
|
||||
* To properly unshuffle bitshuffled data, *size*, *elem_size* and *block_size*
|
||||
* must patch the parameters used to compress the data.
|
||||
*
|
||||
* NOT TO BE USED WITH UNTRUSTED DATA: This routine uses the function
|
||||
* LZ4_decompress_fast from LZ4, which does not protect against maliciously
|
||||
* formed datasets. By modifying the compressed data, this function could be
|
||||
* coerced into leaving the boundaries of the input buffer.
|
||||
*
|
||||
* Parameters
|
||||
* ----------
|
||||
* in : input buffer
|
||||
* out : output buffer, must be of size * elem_size bytes
|
||||
* size : number of elements in input
|
||||
* elem_size : element size of typed data
|
||||
* block_size : Process in blocks of this many elements. Pass 0 to
|
||||
* select automatically (recommended).
|
||||
*
|
||||
* Returns
|
||||
* -------
|
||||
* number of bytes consumed in *input* buffer, negative error-code if failed.
|
||||
*
|
||||
*/
|
||||
int64_t bshuf_decompress_lz4(const void* in, void* out, const size_t size,
|
||||
const size_t elem_size, size_t block_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // BITSHUFFLE_H
|
||||
156
include/bitshuffle/bitshuffle_core.h
Normal file
156
include/bitshuffle/bitshuffle_core.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Bitshuffle - Filter for improving compression of typed binary data.
|
||||
*
|
||||
* This file is part of Bitshuffle
|
||||
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
|
||||
* Website: http://www.github.com/kiyo-masui/bitshuffle
|
||||
* Created: 2014
|
||||
*
|
||||
* See LICENSE file for details about copyright and rights to use.
|
||||
*
|
||||
*
|
||||
* Header File
|
||||
*
|
||||
* Worker routines return an int64_t which is the number of bytes processed
|
||||
* if positive or an error code if negative.
|
||||
*
|
||||
* Error codes:
|
||||
* -1 : Failed to allocate memory.
|
||||
* -11 : Missing SSE.
|
||||
* -12 : Missing AVX.
|
||||
* -80 : Input size not a multiple of 8.
|
||||
* -81 : block_size not multiple of 8.
|
||||
* -91 : Decompression error, wrong number of bytes processed.
|
||||
* -1YYY : Error internal to compression routine with error code -YYY.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BITSHUFFLE_CORE_H
|
||||
#define BITSHUFFLE_CORE_H
|
||||
|
||||
// We assume GNU g++ defining `__cplusplus` has stdint.h
|
||||
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199900L) || defined(__cplusplus)
|
||||
#include <stdint.h>
|
||||
#else
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef long long int64_t;
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
// These are usually set in the setup.py.
|
||||
#ifndef BSHUF_VERSION_MAJOR
|
||||
#define BSHUF_VERSION_MAJOR 0
|
||||
#define BSHUF_VERSION_MINOR 3
|
||||
#define BSHUF_VERSION_POINT 4
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* --- bshuf_using_SSE2 ----
|
||||
*
|
||||
* Whether routines where compiled with the SSE2 instruction set.
|
||||
*
|
||||
* Returns
|
||||
* -------
|
||||
* 1 if using SSE2, 0 otherwise.
|
||||
*
|
||||
*/
|
||||
int bshuf_using_SSE2(void);
|
||||
|
||||
|
||||
/* ---- bshuf_using_AVX2 ----
|
||||
*
|
||||
* Whether routines where compiled with the AVX2 instruction set.
|
||||
*
|
||||
* Returns
|
||||
* -------
|
||||
* 1 if using AVX2, 0 otherwise.
|
||||
*
|
||||
*/
|
||||
int bshuf_using_AVX2(void);
|
||||
|
||||
|
||||
/* ---- bshuf_default_block_size ----
|
||||
*
|
||||
* The default block size as function of element size.
|
||||
*
|
||||
* This is the block size used by the blocked routines (any routine
|
||||
* taking a *block_size* argument) when the block_size is not provided
|
||||
* (zero is passed).
|
||||
*
|
||||
* The results of this routine are guaranteed to be stable such that
|
||||
* shuffled/compressed data can always be decompressed.
|
||||
*
|
||||
* Parameters
|
||||
* ----------
|
||||
* elem_size : element size of data to be shuffled/compressed.
|
||||
*
|
||||
*/
|
||||
size_t bshuf_default_block_size(const size_t elem_size);
|
||||
|
||||
|
||||
/* ---- bshuf_bitshuffle ----
|
||||
*
|
||||
* Bitshuffle the data.
|
||||
*
|
||||
* Transpose the bits within elements, in blocks of *block_size*
|
||||
* elements.
|
||||
*
|
||||
* Parameters
|
||||
* ----------
|
||||
* in : input buffer, must be of size * elem_size bytes
|
||||
* out : output buffer, must be of size * elem_size bytes
|
||||
* size : number of elements in input
|
||||
* elem_size : element size of typed data
|
||||
* block_size : Do transpose in blocks of this many elements. Pass 0 to
|
||||
* select automatically (recommended).
|
||||
*
|
||||
* Returns
|
||||
* -------
|
||||
* number of bytes processed, negative error-code if failed.
|
||||
*
|
||||
*/
|
||||
int64_t bshuf_bitshuffle(const void* in, void* out, const size_t size,
|
||||
const size_t elem_size, size_t block_size);
|
||||
|
||||
|
||||
/* ---- bshuf_bitunshuffle ----
|
||||
*
|
||||
* Unshuffle bitshuffled data.
|
||||
*
|
||||
* Untranspose the bits within elements, in blocks of *block_size*
|
||||
* elements.
|
||||
*
|
||||
* To properly unshuffle bitshuffled data, *size*, *elem_size* and *block_size*
|
||||
* must match the parameters used to shuffle the data.
|
||||
*
|
||||
* Parameters
|
||||
* ----------
|
||||
* in : input buffer, must be of size * elem_size bytes
|
||||
* out : output buffer, must be of size * elem_size bytes
|
||||
* size : number of elements in input
|
||||
* elem_size : element size of typed data
|
||||
* block_size : Do transpose in blocks of this many elements. Pass 0 to
|
||||
* select automatically (recommended).
|
||||
*
|
||||
* Returns
|
||||
* -------
|
||||
* number of bytes processed, negative error-code if failed.
|
||||
*
|
||||
*/
|
||||
int64_t bshuf_bitunshuffle(const void* in, void* out, const size_t size,
|
||||
const size_t elem_size, size_t block_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // BITSHUFFLE_CORE_H
|
||||
75
include/bitshuffle/bitshuffle_internals.h
Normal file
75
include/bitshuffle/bitshuffle_internals.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Bitshuffle - Filter for improving compression of typed binary data.
|
||||
*
|
||||
* This file is part of Bitshuffle
|
||||
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
|
||||
* Website: http://www.github.com/kiyo-masui/bitshuffle
|
||||
* Created: 2014
|
||||
*
|
||||
* See LICENSE file for details about copyright and rights to use.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BITSHUFFLE_INTERNALS_H
|
||||
#define BITSHUFFLE_INTERNALS_H
|
||||
|
||||
// We assume GNU g++ defining `__cplusplus` has stdint.h
|
||||
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199900L) || defined(__cplusplus)
|
||||
#include <stdint.h>
|
||||
#else
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef long long int64_t;
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "iochain.h"
|
||||
|
||||
|
||||
// Constants.
|
||||
#ifndef BSHUF_MIN_RECOMMEND_BLOCK
|
||||
#define BSHUF_MIN_RECOMMEND_BLOCK 128
|
||||
#define BSHUF_BLOCKED_MULT 8 // Block sizes must be multiple of this.
|
||||
#define BSHUF_TARGET_BLOCK_SIZE_B 8192
|
||||
#endif
|
||||
|
||||
|
||||
// Macros.
|
||||
#define CHECK_ERR_FREE(count, buf) if (count < 0) { free(buf); return count; }
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ---- Utility functions for internal use only ---- */
|
||||
|
||||
int64_t bshuf_trans_bit_elem(const void* in, void* out, const size_t size,
|
||||
const size_t elem_size);
|
||||
|
||||
/* Read a 32 bit unsigned integer from a buffer big endian order. */
|
||||
uint32_t bshuf_read_uint32_BE(const void* buf);
|
||||
|
||||
/* Write a 32 bit unsigned integer to a buffer in big endian order. */
|
||||
void bshuf_write_uint32_BE(void* buf, uint32_t num);
|
||||
|
||||
int64_t bshuf_untrans_bit_elem(const void* in, void* out, const size_t size,
|
||||
const size_t elem_size);
|
||||
|
||||
/* Function definition for worker functions that process a single block. */
|
||||
typedef int64_t (*bshufBlockFunDef)(ioc_chain* C_ptr,
|
||||
const size_t size, const size_t elem_size);
|
||||
|
||||
/* Wrap a function for processing a single block to process an entire buffer in
|
||||
* parallel. */
|
||||
int64_t bshuf_blocked_wrap_fun(bshufBlockFunDef fun, const void* in, void* out,
|
||||
const size_t size, const size_t elem_size, size_t block_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // BITSHUFFLE_INTERNALS_H
|
||||
59
include/bitshuffle/bshuf_h5filter.h
Normal file
59
include/bitshuffle/bshuf_h5filter.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Bitshuffle HDF5 filter
|
||||
*
|
||||
* This file is part of Bitshuffle
|
||||
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
|
||||
* Website: http://www.github.com/kiyo-masui/bitshuffle
|
||||
* Created: 2014
|
||||
*
|
||||
* See LICENSE file for details about copyright and rights to use.
|
||||
*
|
||||
*
|
||||
* Header File
|
||||
*
|
||||
* Filter Options
|
||||
* --------------
|
||||
* block_size (option slot 0) : interger (optional)
|
||||
* What block size to use (in elements not bytes). Default is 0,
|
||||
* for which bitshuffle will pick a block size with a target of 8kb.
|
||||
* Compression (option slot 1) : 0 or BSHUF_H5_COMPRESS_LZ4
|
||||
* Whether to apply LZ4 compression to the data after bitshuffling.
|
||||
* This is much faster than applying compression as a second filter
|
||||
* because it is done when the small block of data is already in the
|
||||
* L1 cache.
|
||||
*
|
||||
* For LZ4 compression, the compressed format of the data is the same as
|
||||
* for the normal LZ4 filter described in
|
||||
* http://www.hdfgroup.org/services/filters/HDF5_LZ4.pdf.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BSHUF_H5FILTER_H
|
||||
#define BSHUF_H5FILTER_H
|
||||
|
||||
#define H5Z_class_t_vers 2
|
||||
#include "hdf5.h"
|
||||
|
||||
|
||||
#define BSHUF_H5FILTER 32008
|
||||
|
||||
|
||||
#define BSHUF_H5_COMPRESS_LZ4 2
|
||||
|
||||
|
||||
extern H5Z_class_t bshuf_H5Filter[1];
|
||||
|
||||
|
||||
/* ---- bshuf_register_h5filter ----
|
||||
*
|
||||
* Register the bitshuffle HDF5 filter within the HDF5 library.
|
||||
*
|
||||
* Call this before using the bitshuffle HDF5 filter from C unless
|
||||
* using dynamically loaded filters.
|
||||
*
|
||||
*/
|
||||
int bshuf_register_h5filter(void);
|
||||
|
||||
|
||||
#endif // BSHUF_H5FILTER_H
|
||||
94
include/bitshuffle/iochain.h
Normal file
94
include/bitshuffle/iochain.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* IOchain - Distribute a chain of dependant IO events amoung threads.
|
||||
*
|
||||
* This file is part of Bitshuffle
|
||||
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
|
||||
* Website: http://www.github.com/kiyo-masui/bitshuffle
|
||||
* Created: 2014
|
||||
*
|
||||
* See LICENSE file for details about copyright and rights to use.
|
||||
*
|
||||
*
|
||||
* Header File
|
||||
*
|
||||
* Similar in concept to a queue. Each task includes reading an input
|
||||
* and writing output, but the location of the input/output (the pointers)
|
||||
* depend on the previous item in the chain.
|
||||
*
|
||||
* This is designed for parallelizing blocked compression/decompression IO,
|
||||
* where the destination of a compressed block depends on the compressed size
|
||||
* of all previous blocks.
|
||||
*
|
||||
* Implemented with OpenMP locks.
|
||||
*
|
||||
*
|
||||
* Usage
|
||||
* -----
|
||||
* - Call `ioc_init` in serial block.
|
||||
* - Each thread should create a local variable *size_t this_iter* and
|
||||
* pass its address to all function calls. Its value will be set
|
||||
* inside the functions and is used to identify the thread.
|
||||
* - Each thread must call each of the `ioc_get*` and `ioc_set*` methods
|
||||
* exactly once per iteration, starting with `ioc_get_in` and ending
|
||||
* with `ioc_set_next_out`.
|
||||
* - The order (`ioc_get_in`, `ioc_set_next_in`, *work*, `ioc_get_out`,
|
||||
* `ioc_set_next_out`, *work*) is most efficient.
|
||||
* - Have each thread call `ioc_end_pop`.
|
||||
* - `ioc_get_in` is blocked until the previous entry's
|
||||
* `ioc_set_next_in` is called.
|
||||
* - `ioc_get_out` is blocked until the previous entry's
|
||||
* `ioc_set_next_out` is called.
|
||||
* - There are no blocks on the very first iteration.
|
||||
* - Call `ioc_destroy` in serial block.
|
||||
* - Safe for num_threads >= IOC_SIZE (but less efficient).
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IOCHAIN_H
|
||||
#define IOCHAIN_H
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define IOC_SIZE 33
|
||||
|
||||
|
||||
typedef struct ioc_ptr_and_lock {
|
||||
#ifdef _OPENMP
|
||||
omp_lock_t lock;
|
||||
#endif
|
||||
void *ptr;
|
||||
} ptr_and_lock;
|
||||
|
||||
typedef struct ioc_const_ptr_and_lock {
|
||||
#ifdef _OPENMP
|
||||
omp_lock_t lock;
|
||||
#endif
|
||||
const void *ptr;
|
||||
} const_ptr_and_lock;
|
||||
|
||||
|
||||
typedef struct ioc_chain {
|
||||
#ifdef _OPENMP
|
||||
omp_lock_t next_lock;
|
||||
#endif
|
||||
size_t next;
|
||||
const_ptr_and_lock in_pl[IOC_SIZE];
|
||||
ptr_and_lock out_pl[IOC_SIZE];
|
||||
} ioc_chain;
|
||||
|
||||
|
||||
void ioc_init(ioc_chain *C, const void *in_ptr_0, void *out_ptr_0);
|
||||
void ioc_destroy(ioc_chain *C);
|
||||
const void * ioc_get_in(ioc_chain *C, size_t *this_iter);
|
||||
void ioc_set_next_in(ioc_chain *C, size_t* this_iter, void* in_ptr);
|
||||
void * ioc_get_out(ioc_chain *C, size_t *this_iter);
|
||||
void ioc_set_next_out(ioc_chain *C, size_t *this_iter, void* out_ptr);
|
||||
|
||||
#endif // IOCHAIN_H
|
||||
|
||||
331
include/cafe.h
331
include/cafe.h
@@ -7,6 +7,7 @@
|
||||
#ifndef CAFE_H
|
||||
#define CAFE_H
|
||||
|
||||
#include <hashConduit.h>
|
||||
#include <connect.h>
|
||||
#include <conduitEventHandlerArgs.h>
|
||||
#include <instant.h>
|
||||
@@ -25,7 +26,8 @@ using namespace CAFEBS;
|
||||
* \class CAFE
|
||||
* \brief Methods for synchronous and asynchronous interactions
|
||||
*/
|
||||
class CAFE : public Connect {
|
||||
class CAFE : public Connect
|
||||
{
|
||||
private:
|
||||
Instant<dbr_string_t> cafeSoluble;
|
||||
Instant<dbr_float_t> cafeFrappuccino;
|
||||
@@ -63,8 +65,8 @@ public:
|
||||
channelRequestPolicyMasterPut.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
|
||||
CAFENUM::NO_WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITHOUT_CALLBACK)
|
||||
|
||||
//channelRequestPolicyMasterGet.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
|
||||
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITHOUT_CALLBACK);
|
||||
// channelRequestPolicyMasterGet.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
|
||||
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); // WITHOUT_CALLBACK);
|
||||
//channelRequestPolicyMasterGetCtrl.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
|
||||
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITH_CALLBACK_DEFAULT);
|
||||
};
|
||||
@@ -146,13 +148,16 @@ public:
|
||||
{
|
||||
unsigned int handle;
|
||||
status=ICAFE_NORMAL;
|
||||
try {
|
||||
try
|
||||
{
|
||||
status = open(pv, handle);
|
||||
}
|
||||
catch (CAFEException_open & e) {
|
||||
catch (CAFEException_open & e)
|
||||
{
|
||||
return e.pvEx.statusCode;
|
||||
}
|
||||
if (status == ICAFE_NORMAL) {
|
||||
if (status == ICAFE_NORMAL)
|
||||
{
|
||||
status=getWFAsString(handle, message);
|
||||
}
|
||||
return status;
|
||||
@@ -163,13 +168,16 @@ public:
|
||||
{
|
||||
unsigned int handle;
|
||||
status=ICAFE_NORMAL;
|
||||
try {
|
||||
try
|
||||
{
|
||||
status = open(pv, handle);
|
||||
}
|
||||
catch (CAFEException_open & e) {
|
||||
catch (CAFEException_open & e)
|
||||
{
|
||||
return e.pvEx.statusCode;
|
||||
}
|
||||
if (status == ICAFE_NORMAL) {
|
||||
if (status == ICAFE_NORMAL)
|
||||
{
|
||||
status=getWFAsStringCache(handle, message);
|
||||
}
|
||||
return status;
|
||||
@@ -182,26 +190,40 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
int getAllChannelInfo(unsigned int handle, ChannelRegalia & channelInfo, PVCtrlHolder & pvc, PVDataHolder &pvd, std::string & desc);
|
||||
int getChannelDataStore(unsigned int handle, ChannelDataStore & cds);
|
||||
int getAllChannelInfo(unsigned int handle, ChannelRegalia & channelInfo, PVCtrlHolder & pvc, PVDataHolder &pvd, std::string & desc);
|
||||
int getChannelDataStore(unsigned int handle, ChannelDataStore & cds);
|
||||
|
||||
int supplementHandles();
|
||||
int supplementHandlesV(std::vector<unsigned int> hV);
|
||||
int supplementHandle(unsigned int handle) {
|
||||
std::vector<unsigned int> hV;
|
||||
hV.push_back(handle);
|
||||
return supplementHandlesV(hV);
|
||||
}
|
||||
int supplementHandle(unsigned int handle)
|
||||
{
|
||||
std::vector<unsigned int> hV;
|
||||
hV.push_back(handle);
|
||||
return supplementHandlesV(hV);
|
||||
}
|
||||
int addWidget(unsigned int _handle, void * widget)
|
||||
{
|
||||
return handleHelper.addWidget(_handle, widget);
|
||||
}
|
||||
|
||||
int removeWidget (unsigned int _handle, void * widget)
|
||||
{
|
||||
return handleHelper.removeWidget(_handle, widget);
|
||||
}
|
||||
|
||||
int getWidgets(unsigned int _handle, std::vector<void *> & widgetV)
|
||||
{
|
||||
return handleHelper.getWidgets(_handle, widgetV);
|
||||
}
|
||||
|
||||
#if HAVE_ZEROMQ
|
||||
int calcDBPMStatus(int, int, std::string);
|
||||
int initBSwithCA(CAFEBS::BSDataHolder &bsd);
|
||||
int setBS2CA_Step1(CAFEBS::BSDataHolder &bsd);
|
||||
int setBS2CA_Step2(CAFEBS::BSDataHolder &bsd);
|
||||
int setBS2CA_Step3(CAFEBS::BSDataHolder &bsd);
|
||||
|
||||
int setBS2CAGroup(CAFEBS::BSDataHolder &bsd);
|
||||
int setBS2CA(CAFEBS::BSDataHolder &bsd);
|
||||
int setBS(CAFEBS::BSDataHolder &bsd, bool closeCA);
|
||||
|
||||
int setBS(CAFEBS::BSDataHolder &bsd);
|
||||
int getBS(CAFEBS::BSDataHolder &bsd);
|
||||
int closeBS(CAFEBS::BSDataHolder &bsd);
|
||||
int setPulseIDBufferSize(unsigned int _handle, unsigned short _bsize)
|
||||
@@ -219,22 +241,25 @@ public:
|
||||
}
|
||||
int getDBPM(DBPMKeeper &dbpm);
|
||||
int readDBPMOffsets(DBPMKeeper &dbpm);
|
||||
#if HAVE_LIBQTXML
|
||||
int prepareDBPM(std::vector<std::string> &_glist, std::vector<unsigned int> &_hV, std::vector<std::string> &dev, std::vector<float> &pos) ;
|
||||
int prepareDBPM(std::vector<std::string> &_glist, std::vector<unsigned int> &_hV, std::map<float, std::string> &posDev) ;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
//Standard BLOCKING get
|
||||
//0+
|
||||
int get(const unsigned int handle, std::string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
|
||||
{
|
||||
unsigned int nn=handleHelper.getNelemClient(handle);
|
||||
if (nn==0) {
|
||||
if (nn==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
//check on handle number before proceeding!
|
||||
dbr_string_t * _val = new dbr_string_t[nn];
|
||||
status=cafeSoluble.get(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -244,12 +269,14 @@ public:
|
||||
int get(const unsigned int handle, std::string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
|
||||
{
|
||||
unsigned int nn=handleHelper.getNelemClient(handle);
|
||||
if (nn==0) {
|
||||
if (nn==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t * _val = new dbr_string_t[nn];
|
||||
status=cafeSoluble.get(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -259,12 +286,14 @@ public:
|
||||
int get(const unsigned int handle, std::string * valStr)
|
||||
{
|
||||
unsigned int nn=handleHelper.getNelemClient(handle);
|
||||
if (nn==0) {
|
||||
if (nn==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t * _val = new dbr_string_t[nn];
|
||||
status=cafeSoluble.get(handle, DBR_STRING, _val);
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -367,7 +396,10 @@ public:
|
||||
{
|
||||
return cafeDoppio.get (handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
//Arrays
|
||||
|
||||
|
||||
|
||||
//Arrays -user allocates space
|
||||
int getCharArray(const unsigned int handle, dbr_char_t * _val)
|
||||
{
|
||||
return cafeCappuccino.get (handle, DBR_CHAR, _val);
|
||||
@@ -405,17 +437,20 @@ public:
|
||||
return cafeSoluble.get(handle, DBR_STRING, _val);
|
||||
};
|
||||
|
||||
|
||||
//0
|
||||
//single values
|
||||
int getString(const unsigned int handle, std::string & valStr) //0+
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_STRING, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -425,12 +460,14 @@ public:
|
||||
int get(const unsigned int handle, std::string & valStr) //0+
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_STRING, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -440,12 +477,14 @@ public:
|
||||
int get(const unsigned int handle, std::string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //0
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -456,12 +495,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //0
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -472,12 +513,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //0
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -487,12 +530,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_string_t & _val) //0
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_STRING, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
sprintf(_val, val[0]);
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -502,12 +547,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_string_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //0
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
sprintf(_val, val[0]);
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -518,12 +565,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //0
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1]= {""};
|
||||
status=cafeSoluble.get(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
sprintf(_val, val[0]);
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -533,12 +582,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_short_t & _val) //1
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_short_t val[1]= {0};
|
||||
status=cafeSchale.get(handle, DBR_SHORT, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -547,12 +598,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_short_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //1
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_short_t val[1]= {0};
|
||||
status=cafeSchale.get(handle, DBR_STS_SHORT, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -562,12 +615,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //1
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_short_t val[1]= {0};
|
||||
status=cafeSchale.get(handle, DBR_TIME_SHORT, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -576,12 +631,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_float_t &_val) //2
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_float_t val[1]= {0};
|
||||
status=cafeFrappuccino.get(handle, DBR_FLOAT, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -590,12 +647,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_float_t &_val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //2
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_float_t val[1]= {0};
|
||||
status=cafeFrappuccino.get(handle, DBR_STS_FLOAT, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -605,12 +664,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //2
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_float_t val[1]= {0};
|
||||
status=cafeFrappuccino.get(handle, DBR_TIME_FLOAT, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -619,12 +680,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_enum_t & _val) //3
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_enum_t val[1]= {0};
|
||||
status=cafeEspresso.get(handle, DBR_ENUM, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -633,12 +696,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_enum_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //3
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_enum_t val[1]= {0};
|
||||
status=cafeEspresso.get(handle, DBR_STS_ENUM, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -648,12 +713,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //3
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_enum_t val[1]= {0};
|
||||
status=cafeEspresso.get(handle, DBR_TIME_ENUM, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -662,12 +729,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_char_t & _val) //4
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_char_t val[1]= {0};
|
||||
status=cafeCappuccino.get(handle, DBR_CHAR, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -676,12 +745,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_char_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //4
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_char_t val[1]= {0};
|
||||
status=cafeCappuccino.get(handle, DBR_STS_CHAR, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -691,12 +762,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //4
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_char_t val[1]= {0};
|
||||
status=cafeCappuccino.get(handle, DBR_TIME_CHAR, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -705,12 +778,14 @@ public:
|
||||
int getLong(const unsigned int handle, dbr_long_t & _val) //5
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_long_t val[1]= {0};
|
||||
status=cafeLatte.get(handle, DBR_LONG, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -719,12 +794,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_long_t & _val) //5
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_long_t val[1]= {0};
|
||||
status=cafeLatte.get(handle, DBR_LONG, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -734,12 +811,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //5
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_long_t val[1]= {0};
|
||||
status=cafeLatte.get(handle, DBR_STS_LONG, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -749,12 +828,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //5
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_long_t val[1]= {0};
|
||||
status=cafeLatte.get(handle, DBR_TIME_LONG, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -764,12 +845,14 @@ public:
|
||||
int get(const unsigned int handle, long long & _val) //5+ long long
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
long long val[1]= {0};
|
||||
status=CAFE::get(handle, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -779,12 +862,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //5+ long long
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
long long val[1]= {0};
|
||||
status=CAFE::get(handle, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -794,12 +879,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //5+ long long
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
long long val[1]= {0};
|
||||
status=CAFE::get(handle, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -809,12 +896,14 @@ public:
|
||||
int getDouble(const unsigned int handle, dbr_double_t & _val) //6
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_double_t val[1]= {0};
|
||||
status=cafeDoppio.get(handle, DBR_DOUBLE, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -823,12 +912,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_double_t & _val) //6
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_double_t val[1]= {0};
|
||||
status=cafeDoppio.get(handle, DBR_DOUBLE, val);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -837,12 +928,14 @@ public:
|
||||
int get(const unsigned int handle, dbr_double_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //6
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_double_t val[1]= {0};
|
||||
status=cafeDoppio.get(handle, DBR_STS_DOUBLE, val, alarmStatus, alarmSeverity);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -852,12 +945,14 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //6
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_double_t val[1]= {0};
|
||||
status=cafeDoppio.get(handle, DBR_TIME_DOUBLE, val, alarmStatus, alarmSeverity, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
_val=val[0];
|
||||
}
|
||||
CAFE::setNelemToPrevious(handle, nelemPrevious);
|
||||
@@ -1001,6 +1096,24 @@ public:
|
||||
return cafeDoppio.set (handle, DBR_DOUBLE, _val);
|
||||
};
|
||||
|
||||
/* NOT REQUIRED
|
||||
int setStringWF(const unsigned int handle, std::string wfStr) {
|
||||
dbr_char_t * wfChar = new dbr_char_t[wfStr.size()];
|
||||
unsigned short iCount = 0;
|
||||
for (std::string::size_type i=0; i < wfStr.size(); ++i) {
|
||||
if (wfStr[i].compare("\\") == 0 ) {
|
||||
wfChar[iCount] = '\n';
|
||||
++i;
|
||||
}
|
||||
else {
|
||||
wfChar[iCount] = wfStr[i]
|
||||
}
|
||||
++iCount;
|
||||
}
|
||||
return cafeCappuccino.set (handle, DBR_CHAR, wfChar);
|
||||
delete [] wfChar;
|
||||
}
|
||||
*/
|
||||
|
||||
//set for PythonTypes
|
||||
//0
|
||||
@@ -1051,7 +1164,7 @@ public:
|
||||
return set (handle, _val);
|
||||
};
|
||||
//5
|
||||
int setLong(const unsigned int handle, const dbr_long_t _val)
|
||||
int setLong(const unsigned int handle, const dbr_long_t _val)
|
||||
{
|
||||
return set (handle, _val);
|
||||
};
|
||||
@@ -1071,7 +1184,8 @@ public:
|
||||
int set(const unsigned int handle, std::string _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1];
|
||||
@@ -1088,7 +1202,8 @@ public:
|
||||
int set(const unsigned int handle, const dbr_string_t _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_string_t val[1];
|
||||
@@ -1101,7 +1216,8 @@ public:
|
||||
int set(const unsigned int handle, const dbr_short_t _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_short_t val[1];
|
||||
@@ -1114,7 +1230,8 @@ public:
|
||||
int set(const unsigned int handle, const dbr_float_t _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_float_t val[1];
|
||||
@@ -1127,7 +1244,8 @@ public:
|
||||
int set(const unsigned int handle, const dbr_enum_t _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_enum_t val[1];
|
||||
@@ -1140,7 +1258,8 @@ public:
|
||||
int set(const unsigned int handle, const dbr_char_t _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_char_t val[1];
|
||||
@@ -1153,7 +1272,8 @@ public:
|
||||
int set(const unsigned int handle, const dbr_long_t _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_long_t val[1];
|
||||
@@ -1166,15 +1286,18 @@ public:
|
||||
int set(const unsigned int handle, const long long _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
if (_val <= LONG_MAX) {
|
||||
if (_val <= LONG_MAX)
|
||||
{
|
||||
dbr_long_t val[1];
|
||||
val[0]=_val;
|
||||
status=CAFE::set(handle, val);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dbr_double_t val[1];
|
||||
val[0]=_val;
|
||||
status=CAFE::set(handle, val);
|
||||
@@ -1186,7 +1309,8 @@ public:
|
||||
int set(const unsigned int handle, const dbr_double_t _val)
|
||||
{
|
||||
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
|
||||
if (nelemPrevious==0) {
|
||||
if (nelemPrevious==0)
|
||||
{
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
dbr_double_t val[1];
|
||||
@@ -1321,7 +1445,8 @@ public:
|
||||
std::vector<unsigned int> closeDisconnectedChannelsFromWithinGroupV(const unsigned int groupHandle)
|
||||
{
|
||||
std::vector<unsigned int> dhV=handleHelper.getDisconnectedHandlesFromWithinGroupV(groupHandle);
|
||||
if (dhV.size() >0) {
|
||||
if (dhV.size() >0)
|
||||
{
|
||||
closeChannelsKeepHandles(dhV);
|
||||
}
|
||||
return dhV;
|
||||
|
||||
@@ -79,17 +79,22 @@ int getCachePVArrayNoWait (std::vector<unsigned int> handleV, PVDataHolder * pv
|
||||
{
|
||||
|
||||
int overallStatus=ICAFE_NORMAL;
|
||||
for (size_t i=0; i< (size_t) handleV.size(); ++i) {
|
||||
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) {
|
||||
//std::cout << "handle= " << handleV[i] << " pvFromHandle= " << CAFE::getPVFromHandle(handleV[i]) << " status= " << pvd[i].getStatus() << " val= " << pvd[i].getAsString() << std::endl;
|
||||
if (status!=ICAFE_NORMAL)
|
||||
{
|
||||
resetCallbackGet(handleV[i]);
|
||||
if(overallStatus==ICAFE_NORMAL) {
|
||||
if(overallStatus==ICAFE_NORMAL)
|
||||
{
|
||||
overallStatus=status;
|
||||
}
|
||||
}
|
||||
if (pvd[i].getStatus() !=ICAFE_NORMAL) {
|
||||
if(overallStatus==ICAFE_NORMAL) {
|
||||
if (pvd[i].getStatus() !=ICAFE_NORMAL)
|
||||
{
|
||||
if(overallStatus==ICAFE_NORMAL)
|
||||
{
|
||||
overallStatus=pvd[i].getStatus();
|
||||
}
|
||||
}
|
||||
@@ -259,7 +264,8 @@ int getCacheStringArray(const unsigned int handle, std::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) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -269,7 +275,8 @@ int getCache(const unsigned int handle, std::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) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -279,7 +286,8 @@ int getCache(const unsigned int handle, std::string * valStr, dbr_short_t &al
|
||||
{
|
||||
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) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -289,7 +297,8 @@ int getCache(const unsigned int handle, std::string * valStr, dbr_short_t &al
|
||||
{
|
||||
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) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -302,7 +311,8 @@ int getCacheString(const unsigned int handle, std::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) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
@@ -314,7 +324,8 @@ int getCache(const unsigned int handle, std::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) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
@@ -325,7 +336,8 @@ int getCache(const unsigned int handle, std::string & valStr, dbr_short_t &ala
|
||||
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) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
@@ -337,7 +349,8 @@ int getCache(const unsigned int handle, std::string & valStr,
|
||||
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) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
valStr=val[0];
|
||||
}
|
||||
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
|
||||
@@ -396,7 +409,8 @@ int getCache(const unsigned int *handleArray, unsigned int nelem, std::strin
|
||||
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) {
|
||||
for (unsigned int i=0; i< nelem; ++i)
|
||||
{
|
||||
valStr[i]=val[i];
|
||||
}
|
||||
delete [] val;
|
||||
@@ -408,7 +422,8 @@ int getCache(const unsigned int *handleArray, unsigned int nelem, std::strin
|
||||
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) {
|
||||
for (unsigned int i=0; i< nelem; ++i)
|
||||
{
|
||||
valStr[i]=val[i];
|
||||
}
|
||||
delete [] val;
|
||||
@@ -418,7 +433,8 @@ int getCache (const unsigned int *handleArray, unsigned int nelem, std::strin
|
||||
{
|
||||
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) {
|
||||
for (unsigned int i=0; i< nelem; ++i)
|
||||
{
|
||||
valStr[i]=val[i];
|
||||
}
|
||||
delete [] val;
|
||||
@@ -740,7 +756,8 @@ int getCache(const char * pv, std::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) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -751,7 +768,8 @@ int getCache(const char * pv, std::string * valStr, dbr_short_t &alarmStatus,
|
||||
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) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
@@ -762,7 +780,8 @@ int getCache(const char * pv, std::string * valStr, dbr_short_t &alarmStatus,
|
||||
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) {
|
||||
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
|
||||
{
|
||||
valStr[i]=_val[i];
|
||||
}
|
||||
delete [] _val;
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
* method getAsString() converts CTYPE to string \n
|
||||
*
|
||||
*/
|
||||
template <class CTYPE> class CAFEConvert {
|
||||
template <class CTYPE> class CAFEConvert
|
||||
{
|
||||
private:
|
||||
CTYPE returnVal[1];
|
||||
public:
|
||||
@@ -55,20 +56,25 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (CAFE_DATATYPE dt, CAFE_D
|
||||
// Valid for all types that have numeric_limits support
|
||||
// (brackets required) to avoid compiler error should isnan also be a native macro
|
||||
|
||||
switch (dt) {
|
||||
switch (dt)
|
||||
{
|
||||
case CAFE_DOUBLE:
|
||||
if ( (boost::math::isnan)((CTYPE) val.d) ) {
|
||||
if ( (boost::math::isnan)((CTYPE) val.d) )
|
||||
{
|
||||
returnVal[0]= (CTYPE) val.d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
returnVal[0]= (CTYPE) 0;
|
||||
}
|
||||
break;
|
||||
case CAFE_FLOAT:
|
||||
if ( (boost::math::isnan)((CTYPE) val.f) ) {
|
||||
if ( (boost::math::isnan)((CTYPE) val.f) )
|
||||
{
|
||||
returnVal[0]= (CTYPE) val.f;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
returnVal[0]= 0;
|
||||
}
|
||||
break;
|
||||
@@ -135,7 +141,8 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (unsigned int index, CAFE
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::get(index, dt, val[])"
|
||||
|
||||
switch (dt) {
|
||||
switch (dt)
|
||||
{
|
||||
case CAFE_DOUBLE:
|
||||
returnVal[0]= (CTYPE) val[index].d;
|
||||
break;
|
||||
@@ -213,30 +220,38 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getStringFromEnum (unsigned i
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStr; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
for (unsigned int j=0; j<noStr; ++j)
|
||||
{
|
||||
if (strcmp(stig[j],"")==0)
|
||||
{
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
|
||||
if (noStr==noEmptyStrings) {
|
||||
std::cout << "*** WARNING FROM " << __METHOD__ << " *** " << std::endl;
|
||||
std::cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << std::endl;
|
||||
std::cout << "BADLY CONFIGURED EPICS RECORD. " << std::endl;
|
||||
}
|
||||
// Some developers do not populate enum string values
|
||||
//if (noStr==noEmptyStrings)
|
||||
//{
|
||||
// std::cout << "*** WARNING FROM " << __METHOD__ << " *** " << std::endl;
|
||||
// std::cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << std::endl;
|
||||
// std::cout << "BADLY CONFIGURED EPICS RECORD. " << std::endl;
|
||||
//}
|
||||
|
||||
|
||||
if (index < noStr && noStr!=noEmptyStrings) {
|
||||
if (index < noStr && noStr!=noEmptyStrings)
|
||||
{
|
||||
sprintf(returnVal[0], "%s", stig[val[index].us] );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
sprintf(returnVal[0], "%d", val[index].us );
|
||||
if ( val[index].us>= noStr) {
|
||||
if ( val[index].us>= noStr)
|
||||
{
|
||||
std::cout << "*** WARNING FROM " << __METHOD__ << " *** " << std::endl;
|
||||
std::cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << std::endl;
|
||||
std::cout << "VALUE (unsigned short) = " << val[index].us << std::endl;
|
||||
std::cout << "NO OF ENUMERATED STRINGS = " << noStr << " WITH VALUES: " << std::endl;
|
||||
for (unsigned int j=0; j<noStr; ++j) {
|
||||
for (unsigned int j=0; j<noStr; ++j)
|
||||
{
|
||||
std::cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
@@ -259,7 +274,8 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (unsigned int index
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::getString(nelem, dt, val[])"
|
||||
|
||||
switch (dt) {
|
||||
switch (dt)
|
||||
{
|
||||
case CAFE_STRING:
|
||||
sprintf(returnVal[0], "%s", val[index].str);
|
||||
break;
|
||||
@@ -329,7 +345,8 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (CAFE_DATATYPE dt,
|
||||
{
|
||||
#define __METHOD__ "CAFEConvert<CTYPE>::getString(dt, val[])"
|
||||
|
||||
switch (dt) {
|
||||
switch (dt)
|
||||
{
|
||||
case CAFE_STRING:
|
||||
sprintf(returnVal[0], "%s", val.str);
|
||||
break;
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
enum CAFE_DATATYPE {
|
||||
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
|
||||
@@ -34,7 +35,8 @@ enum CAFE_DATATYPE {
|
||||
* Provides methods to convert between
|
||||
* the CAFE_DATATYPES and text equivalent
|
||||
*/
|
||||
class CAFEDataTypeCode {
|
||||
class CAFEDataTypeCode
|
||||
{
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapDataType;
|
||||
@@ -97,12 +99,13 @@ public:
|
||||
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 << "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;
|
||||
std::cout << "------------------" << std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
@@ -110,7 +113,8 @@ public:
|
||||
/**
|
||||
* A union of CAFE primitive datatypes
|
||||
*/
|
||||
union CAFE_DATATYPE_UNION {
|
||||
union CAFE_DATATYPE_UNION
|
||||
{
|
||||
dbr_string_t str;
|
||||
dbr_short_t s;
|
||||
dbr_float_t f;
|
||||
@@ -124,4 +128,5 @@ typedef CAFE_DATATYPE_UNION * CAFE_DATATYPE_UNION_SEQ;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
#include <map>
|
||||
#include <cafeDataType.h>
|
||||
|
||||
class CafeDataTypeHelper {
|
||||
class CafeDataTypeHelper
|
||||
{
|
||||
private:
|
||||
CAFE_DATATYPE_UNION cdu;
|
||||
CAFE_DATATYPE dataType;
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
|
||||
#include <cadef.h>
|
||||
|
||||
namespace CAFENUM {
|
||||
namespace CAFENUM
|
||||
{
|
||||
|
||||
/**
|
||||
* Data request buffer types \n
|
||||
* i.e. whether PRIMITIVE, STS, TIME, GR or CTRL
|
||||
*/
|
||||
enum DBR_TYPE {
|
||||
enum DBR_TYPE
|
||||
{
|
||||
DBR_PRIMITIVE,
|
||||
DBR_PLAIN=DBR_PRIMITIVE,
|
||||
DBR_STS,
|
||||
@@ -33,7 +35,8 @@ enum DBR_TYPE {
|
||||
/**
|
||||
* Define enum type to flush io after creating channels
|
||||
*/
|
||||
enum ChannelFlushSendBufferPolicyKind {
|
||||
enum ChannelFlushSendBufferPolicyKind
|
||||
{
|
||||
WITH_FLUSH_IO,
|
||||
WITH_PEND_IO, // needs timeout duration
|
||||
WITH_PEND_EVENT, // needs timeout duration
|
||||
@@ -44,7 +47,8 @@ enum ChannelFlushSendBufferPolicyKind {
|
||||
/**
|
||||
* Define enum type defining when to flush io after creating channels
|
||||
*/
|
||||
enum ChannelWhenToFlushSendBufferPolicyKind {
|
||||
enum ChannelWhenToFlushSendBufferPolicyKind
|
||||
{
|
||||
FLUSH_AUTOMATIC=0,
|
||||
FLUSH_NOW=FLUSH_AUTOMATIC,
|
||||
FLUSH_AFTER_EACH_CHANNEL_CREATION=FLUSH_NOW, // instantly
|
||||
@@ -61,16 +65,16 @@ enum ChannelWhenToFlushSendBufferPolicyKind {
|
||||
* an independent virtual circuit, and associated data structures, is
|
||||
* created for each priority that is used on a particular server
|
||||
*/
|
||||
enum ChannelServerDispatchPriority {
|
||||
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_VERYLOW =CA_PRIORITY_MIN+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
|
||||
|
||||
CA_SERVER_DISPATCH_PRIORITY_MAX =CA_PRIORITY_MAX,
|
||||
CA_SERVER_DISPATCH_PRIORITY_DEFAULT =CA_PRIORITY_MAX
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +83,8 @@ enum ChannelServerDispatchPriority {
|
||||
* Meant for use within callbacks to ensure that cache operations
|
||||
* are never blocked
|
||||
*/
|
||||
enum ChannelGetCacheWaitPolicyKind {
|
||||
enum ChannelGetCacheWaitPolicyKind
|
||||
{
|
||||
GET_CACHE_NO_CHECK=0,
|
||||
GET_CACHE_NO_WAIT,
|
||||
GET_CACHE_NOW =GET_CACHE_NO_WAIT,
|
||||
@@ -92,7 +97,8 @@ enum ChannelGetCacheWaitPolicyKind {
|
||||
* monitor is in place
|
||||
*
|
||||
*/
|
||||
enum ChannelGetActionWhenMonitorPolicyKind {
|
||||
enum ChannelGetActionWhenMonitorPolicyKind
|
||||
{
|
||||
GET_FROM_CACHE,
|
||||
GET_FROM_IOC
|
||||
};
|
||||
@@ -102,7 +108,8 @@ enum ChannelGetActionWhenMonitorPolicyKind {
|
||||
* Blocking can be achieved with or without callback.
|
||||
* Callback can further be supplied by the user
|
||||
*/
|
||||
enum ChannelRequestPolicyKind {
|
||||
enum ChannelRequestPolicyKind
|
||||
{
|
||||
WITHOUT_CALLBACK,
|
||||
WITH_CALLBACK_DEFAULT,
|
||||
WITH_CALLBACK_USER_SUPPLIED
|
||||
@@ -113,7 +120,8 @@ enum ChannelRequestPolicyKind {
|
||||
* Enum type defining level of datatype conversion at the IOC
|
||||
*
|
||||
*/
|
||||
enum ChannelRequestDataTypePolicyKind {
|
||||
enum ChannelRequestDataTypePolicyKind
|
||||
{
|
||||
NATIVE_DATATYPE,
|
||||
LOWEST_DATATYPE // The smaller in byte size of type requested and native datatype
|
||||
};
|
||||
@@ -124,7 +132,8 @@ enum ChannelRequestDataTypePolicyKind {
|
||||
* from a message sent with a callback, whether it be
|
||||
* user supplied or the CAFE default.
|
||||
*/
|
||||
enum ChannelWaitForResponsePolicyKind {
|
||||
enum ChannelWaitForResponsePolicyKind
|
||||
{
|
||||
BLOCKING=0,
|
||||
WAIT=BLOCKING,
|
||||
NON_BLOCKING=1,
|
||||
@@ -132,7 +141,8 @@ enum ChannelWaitForResponsePolicyKind {
|
||||
};
|
||||
|
||||
|
||||
enum StatusMessageKind {
|
||||
enum StatusMessageKind
|
||||
{
|
||||
NO_MESSAGE,
|
||||
PRE_REQUEST,
|
||||
FROM_REQUEST,
|
||||
@@ -141,7 +151,8 @@ enum StatusMessageKind {
|
||||
FROM_MESSAGE
|
||||
};
|
||||
|
||||
enum CallbackProgressKind {
|
||||
enum CallbackProgressKind
|
||||
{
|
||||
NOT_INITIATED,
|
||||
PENDING,
|
||||
COMPLETE
|
||||
|
||||
@@ -123,10 +123,12 @@ int match(std::string valSet, unsigned int handleMatch,
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -139,10 +141,12 @@ int match(std::string valSet, unsigned int handleMatch,
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -170,10 +174,12 @@ int match(dbr_string_t valSet, unsigned int handleMatch,
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -186,10 +192,12 @@ int match(dbr_string_t valSet, unsigned int handleMatch,
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -269,16 +277,19 @@ int matchMany(std::vector<std::string> valSetV, std::vector<unsigned int> handle
|
||||
std::istringstream ss;
|
||||
dbr_double_t d=0;
|
||||
dbr_double_t toleranceDouble = 0;
|
||||
for (size_t i=0; i< valSetV.size(); ++i) {
|
||||
for (size_t i=0; i< valSetV.size(); ++i)
|
||||
{
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(valSetV[i]);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
valSetDoubleV.push_back(d);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -293,10 +304,12 @@ int matchMany(std::vector<std::string> valSetV, std::vector<unsigned int> handle
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -380,16 +393,19 @@ int setAndMatchMany(std::vector<unsigned int> handleSetV, std::vector<std::strin
|
||||
std::istringstream ss;
|
||||
dbr_double_t d=0;
|
||||
dbr_double_t toleranceDouble = 0;
|
||||
for (size_t i=0; i< valSetV.size(); ++i) {
|
||||
for (size_t i=0; i< valSetV.size(); ++i)
|
||||
{
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(valSetV[i]);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
valSetDoubleV.push_back(d);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -404,10 +420,12 @@ int setAndMatchMany(std::vector<unsigned int> handleSetV, std::vector<std::strin
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -515,16 +533,19 @@ int gameSetAndMatch(std::vector<unsigned int> handleSetV, std::vector<std::strin
|
||||
std::istringstream ss;
|
||||
dbr_double_t d=0;
|
||||
dbr_double_t toleranceDouble = 0;
|
||||
for (size_t i=0; i< valSetV.size(); ++i) {
|
||||
for (size_t i=0; i< valSetV.size(); ++i)
|
||||
{
|
||||
d=0;
|
||||
ss.clear();
|
||||
ss.str(valSetV[i]);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
valSetDoubleV.push_back(d);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -539,10 +560,12 @@ int gameSetAndMatch(std::vector<unsigned int> handleSetV, std::vector<std::strin
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -618,10 +641,12 @@ int setAndMatch(const unsigned int handleSet, dbr_string_t valSet, const unsigne
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -634,10 +659,12 @@ int setAndMatch(const unsigned int handleSet, dbr_string_t valSet, const unsigne
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -662,10 +689,12 @@ int setAndMatch(const unsigned int handleSet, std::string valSet, const unsigned
|
||||
ss.str(valSet);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
valSetDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
@@ -678,10 +707,12 @@ int setAndMatch(const unsigned int handleSet, std::string valSet, const unsigned
|
||||
ss.str(tolerance);
|
||||
ss>>d;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
if ( !ss.fail())
|
||||
{
|
||||
toleranceDouble=d;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __METHOD__ << __LINE__ << std::endl;
|
||||
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
|
||||
std::cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
int get(const unsigned int _handle, std::vector<std::string> & V); //0
|
||||
int get(const unsigned int _handle, std::vector<short> & V); //1
|
||||
int get(const unsigned int _handle, std::vector<float> & V); //2
|
||||
@@ -19,6 +20,16 @@ int get(const unsigned int _handle, std::vector<unsigned char> & V); //4
|
||||
int get(const unsigned int _handle, std::vector<dbr_long_t> & V); //5
|
||||
int get(const unsigned int _handle, std::vector<long long> & V); //5
|
||||
int get(const unsigned int _handle, std::vector<double> & V); //6
|
||||
|
||||
int getStringVector(const unsigned int _handle, std::vector<std::string> & V) {return get(_handle, V);}; //0
|
||||
int getShortVector(const unsigned int _handle, std::vector<short> & V) {return get(_handle, V);}; //1
|
||||
int getFloatVector(const unsigned int _handle, std::vector<float> & V) {return get(_handle, V);}; //2
|
||||
int getUShortVector(const unsigned int _handle, std::vector<unsigned short> & V) {return get(_handle, V);};//3
|
||||
int getUCharVector(const unsigned int _handle, std::vector<unsigned char> & V) {return get(_handle, V);}; //4
|
||||
int getLongVector(const unsigned int _handle, std::vector<dbr_long_t> & V) {return get(_handle, V);}; //5
|
||||
int getLongLongVector(const unsigned int _handle, std::vector<long long> & V) {return get(_handle, V);}; //5
|
||||
int getDoubleVector(const unsigned int _handle, std::vector<double> & V) {return get(_handle, V);}; //6
|
||||
|
||||
int get(const unsigned int _handle, std::vector<std::string> & V,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//0
|
||||
int get(const unsigned int _handle, std::vector<short> & V,
|
||||
@@ -171,6 +182,7 @@ int getScalars(std::vector<unsigned int> handleV, std::vector<dbr_double_t> & V
|
||||
|
||||
|
||||
|
||||
|
||||
int getCacheVStr(std::vector<unsigned int> handleV, std::vector<std::string> & V, std::vector<int> &statusV)
|
||||
{
|
||||
return getCache(handleV, V, statusV);
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
//if HAVE_LIBQTXML - needed for externsions
|
||||
#if HAVE_LIBQTXML //- needed for externsions
|
||||
int loadCollectionsFromXML(const char * collectionsFile);
|
||||
int loadGroupsFromXML (const char * groupsFile);
|
||||
int restoreFromXML(const char * snapshotFile);
|
||||
//endif
|
||||
#endif
|
||||
|
||||
int snapshot2XML (PVGroup pg);
|
||||
void openGroupXMLFile(std::string fileName);
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
* Provides methods to convert between
|
||||
* the CA_OP_xx and text equivalent
|
||||
*/
|
||||
class CAOPCodes {
|
||||
class CAOPCodes
|
||||
{
|
||||
typedef std::map<int, std::string> mapIntString;
|
||||
private:
|
||||
mapIntString mapDataType;
|
||||
@@ -62,7 +63,8 @@ public:
|
||||
std::cout << "------------------" << std::endl;
|
||||
std::cout << "CA_OP_LIST" << std::endl;
|
||||
std::cout << "-----------------" << std::endl;
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
|
||||
{
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "-----------------" << std::endl;
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
* Struct defining channel properties and connection status for use in Conduit container
|
||||
*
|
||||
*/
|
||||
class ChannelRegalia {
|
||||
class ChannelRegalia
|
||||
{
|
||||
private:
|
||||
CAFEStatus cafeStatus;
|
||||
public:
|
||||
@@ -164,13 +165,16 @@ public:
|
||||
};
|
||||
std::string getConnectionStateAsString()
|
||||
{
|
||||
if(connectionState==CA_OP_CONN_UP) {
|
||||
if(connectionState==CA_OP_CONN_UP)
|
||||
{
|
||||
return "CA_OP_CONN_UP";
|
||||
}
|
||||
else if(connectionState==CA_OP_CONN_DOWN) {
|
||||
else if(connectionState==CA_OP_CONN_DOWN)
|
||||
{
|
||||
return "CA_OP_CONN_DOWN";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return "CA_OP_CONN is UNKNOWN: THIS SHOULD NEVER APPEAR!";
|
||||
}
|
||||
};
|
||||
@@ -204,21 +208,23 @@ public:
|
||||
* Struct defining channel properties and connection status for use in displays
|
||||
*
|
||||
*/
|
||||
class ChannelDataStore {
|
||||
class ChannelDataStore
|
||||
{
|
||||
public:
|
||||
|
||||
std::string description;
|
||||
ChannelRegalia info;
|
||||
PVDataHolder pvd;
|
||||
PVCtrlHolder pvc;
|
||||
|
||||
ChannelDataStore() {
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::string description;
|
||||
ChannelRegalia info;
|
||||
PVDataHolder pvd;
|
||||
PVCtrlHolder pvc;
|
||||
|
||||
ChannelDataStore()
|
||||
{
|
||||
|
||||
|
||||
};
|
||||
|
||||
~ChannelDataStore() {};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -228,7 +234,8 @@ public:
|
||||
* Stores strings for Enum datatypes
|
||||
*
|
||||
*/
|
||||
class ChannelEnumStrings {
|
||||
class ChannelEnumStrings
|
||||
{
|
||||
public:
|
||||
friend struct change_eventHandlerArgs;
|
||||
private:
|
||||
@@ -244,7 +251,8 @@ public:
|
||||
{
|
||||
std::vector<std::string> optionsV;
|
||||
optionsV.reserve(noOptions);
|
||||
for ( short i=0; i<noOptions; ++i) {
|
||||
for ( short i=0; i<noOptions; ++i)
|
||||
{
|
||||
optionsV.push_back(options[i]);
|
||||
}
|
||||
return optionsV;
|
||||
@@ -256,7 +264,8 @@ public:
|
||||
* Stores device/attribute pairing
|
||||
*
|
||||
*/
|
||||
class ChannelDeviceAttribute {
|
||||
class ChannelDeviceAttribute
|
||||
{
|
||||
private:
|
||||
std::string pv;
|
||||
std::string device;
|
||||
@@ -271,18 +280,21 @@ public:
|
||||
pv=_pv;
|
||||
deliminator=_deliminator;
|
||||
short posOfSeparator=pv.find_first_of(deliminator);
|
||||
if (posOfSeparator<0) {
|
||||
if (posOfSeparator<0)
|
||||
{
|
||||
device="";
|
||||
attribute="";
|
||||
return ECAFE_DEVICE_ATTRIB_NOT_FOUND;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
device= pv.substr(0,posOfSeparator);
|
||||
attribute=pv.substr(posOfSeparator+1,pv.size());
|
||||
//Check for .VAL and remove
|
||||
//Check for .VAL and remove
|
||||
std::size_t found = attribute.find(".");
|
||||
if (found != std::string::npos) {
|
||||
attribute=attribute.substr(0, found);
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
attribute=attribute.substr(0, found);
|
||||
}
|
||||
}
|
||||
return ICAFE_NORMAL;
|
||||
@@ -323,7 +335,8 @@ public:
|
||||
* 0. Struct defining channel datatype/nelem executed by CAFE for use in Conduit container
|
||||
*
|
||||
*/
|
||||
class ChannelRequestMetaData {
|
||||
class ChannelRequestMetaData
|
||||
{
|
||||
public:
|
||||
friend struct change_connectionHandlerArgs;
|
||||
friend struct change_dataBufferSize_CTRL;
|
||||
@@ -377,7 +390,8 @@ public:
|
||||
void setDbrTypesFromCafeDbrType(CAFENUM::DBR_TYPE cd)
|
||||
{
|
||||
cafeDbrType=cd;
|
||||
switch(cafeDbrType) {
|
||||
switch(cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
dbrDataType = dbf_type_to_DBR_TIME(dataType);
|
||||
break;
|
||||
@@ -457,7 +471,8 @@ public:
|
||||
* -1. Struct defining channel datatype/nelem requested by client for use in Conduit container
|
||||
*
|
||||
*/
|
||||
class ChannelRequestMetaDataClient: public ChannelRequestMetaData {
|
||||
class ChannelRequestMetaDataClient: public ChannelRequestMetaData
|
||||
{
|
||||
public:
|
||||
|
||||
//protected:
|
||||
@@ -478,7 +493,8 @@ public:
|
||||
* messageStatus = requestStatus or messageStatus=callbackStatus (if policy WITH_CALLBACK)
|
||||
*
|
||||
*/
|
||||
class ChannelRequestStatus {
|
||||
class ChannelRequestStatus
|
||||
{
|
||||
|
||||
private:
|
||||
int preRequestStatus; // current status of channel
|
||||
@@ -550,16 +566,20 @@ public:
|
||||
{
|
||||
hasCallbackInitiated=hasInit;
|
||||
hasCallbackTriggered=hasTrig;
|
||||
if ( hasInit && !hasTrig) {
|
||||
if ( hasInit && !hasTrig)
|
||||
{
|
||||
callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::PENDING;
|
||||
}
|
||||
else if (!hasInit && hasTrig) {
|
||||
else if (!hasInit && hasTrig)
|
||||
{
|
||||
callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::COMPLETE;
|
||||
}
|
||||
else if (!hasInit && !hasTrig) {
|
||||
else if (!hasInit && !hasTrig)
|
||||
{
|
||||
callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::NOT_INITIATED;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "CAFE INTERNAL POLICY ERROR" << std::endl;
|
||||
std::cout << "ChannelRequestStatus::setCallbackKind gives an INVALID callbackProgressKind" << std::endl;
|
||||
}
|
||||
|
||||
@@ -13,31 +13,31 @@
|
||||
#include <config.h>
|
||||
#include <cadef.h>
|
||||
|
||||
|
||||
#include <channelRegalia.h>
|
||||
#include <PVDataHolder.h>
|
||||
#include <PVCtrlHolder.h>
|
||||
#include <policies.h>
|
||||
#include <deque>
|
||||
|
||||
#if HAVE_PYTHON_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
|
||||
|
||||
using namespace boost::posix_time;
|
||||
|
||||
/**
|
||||
* Principal constructor has:\n
|
||||
* \param _pv process variable
|
||||
* \param _ccc ca_client_context
|
||||
*/
|
||||
class Conduit {
|
||||
class Conduit
|
||||
{
|
||||
public:
|
||||
friend struct change_alarmStatus;
|
||||
friend struct change_alarmSeverity;
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
friend struct change_accessWrite;
|
||||
|
||||
friend struct change_beamEventNo;
|
||||
|
||||
|
||||
friend struct change_channelDeviceAttribute;
|
||||
friend struct change_channelID;
|
||||
friend struct change_channelRegalia;
|
||||
@@ -99,6 +99,9 @@ public:
|
||||
friend struct change_monitorAction;
|
||||
friend struct change_monitorActionClear;
|
||||
friend struct change_monitorActionErase;
|
||||
|
||||
friend struct change_monitorPolicy;
|
||||
|
||||
friend struct change_monitorPolicyErase;
|
||||
friend struct change_monitorPolicyInsert;
|
||||
|
||||
@@ -108,12 +111,24 @@ public:
|
||||
//friend struct change_rule;
|
||||
|
||||
friend struct change_pvAlias;
|
||||
#if HAVE_PYTHON_H
|
||||
friend struct change_pyOpenCallbackFlag;
|
||||
#endif
|
||||
|
||||
friend struct change_status;
|
||||
|
||||
friend struct change_supplementHandle;
|
||||
|
||||
friend struct change_supplementDescription;
|
||||
friend struct change_supplementAlarmSeverity;
|
||||
friend struct change_usrArgs;
|
||||
|
||||
friend struct change_widgetInsert;
|
||||
friend struct change_widgetErase;
|
||||
|
||||
friend struct change_pyGetCallbackFn;
|
||||
friend struct change_pyPutCallbackFn;
|
||||
friend struct change_pyConnectCallbackFn;
|
||||
|
||||
friend struct free_dataBuffers;
|
||||
|
||||
friend class Connect;
|
||||
@@ -141,20 +156,19 @@ private:
|
||||
union db_access_val * putBuffer;
|
||||
union db_access_val * stsackBuffer;
|
||||
|
||||
//struct connection_handler_args connectionHandlerArgs;
|
||||
//struct event_handler_args eventHandlerArgs;
|
||||
|
||||
short alarmStatus;
|
||||
short alarmSeverity;
|
||||
epicsTimeStamp ts;
|
||||
|
||||
//New Oct. 2018
|
||||
std::string desc;
|
||||
//short hhsv;
|
||||
//short hsv;
|
||||
//short lsv;
|
||||
//short llsv;
|
||||
alarmSeverityStruct aSevStruct;
|
||||
bool hasDesc;
|
||||
bool hasAlarmSevStruct;
|
||||
|
||||
alarmSeverityStruct aSevStruct;
|
||||
bool hasDesc;
|
||||
bool hasAlarmSevStruct;
|
||||
|
||||
void * usrArgs; //Filled in conduitEventHandlerArgs.h; used by getUsrArgsAsUInt in CyCafe
|
||||
|
||||
@@ -164,7 +178,7 @@ private:
|
||||
|
||||
//Reserved
|
||||
unsigned long long beamEventNo;
|
||||
|
||||
|
||||
std:: deque<PVDataHolder> dequePulseID;
|
||||
|
||||
std::map<unsigned long long, PVDataHolder> mapPulseID;
|
||||
@@ -217,11 +231,23 @@ private:
|
||||
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;
|
||||
#if HAVE_PYTHON_H
|
||||
//void * PyEventHandler() const;
|
||||
//void * PyEventHandler(unsigned int) const;
|
||||
//void * PyDataEventHandler() const;
|
||||
//void * PyCtrlEventHandler() const;
|
||||
|
||||
void * CyEventHandler() const;
|
||||
void * CyDataEventHandler() const;
|
||||
void * CyCtrlEventHandler() const;
|
||||
|
||||
bool pyOpenCallbackFlag;
|
||||
|
||||
void * pyGetCallbackFn;
|
||||
void * pyPutCallbackFn;
|
||||
void * pyConnectCallbackFn;
|
||||
std::vector<void *> pyConnectCallbackVector;
|
||||
|
||||
#endif
|
||||
|
||||
int putWithCallback(pCallback callbackHandlerPut) const;
|
||||
@@ -240,6 +266,8 @@ private:
|
||||
//map<unsigned long,MonitorPolicy> lump;
|
||||
//map<unsigned long,MonitorPolicy>::iterator ilump;
|
||||
|
||||
|
||||
|
||||
////MonitorPolicy mpBase;
|
||||
std::vector<MonitorPolicy> mpV;
|
||||
std::vector<MonitorPolicy> mpInWaitingV;
|
||||
@@ -249,12 +277,42 @@ private:
|
||||
|
||||
std::vector<std::string> monitorAction;
|
||||
|
||||
std::vector<void *> widgetV;
|
||||
|
||||
|
||||
bool hasNewData; // used by HandleHelper.getMonitorAction();
|
||||
|
||||
public:
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
void * PyGetHandler() const;
|
||||
void * PyPutHandler() const;
|
||||
bool getPyOpenCallbackFlag() const
|
||||
{
|
||||
return pyOpenCallbackFlag;
|
||||
}
|
||||
//void * PyOpenHandler() const; //make public so that it can be called from a callback fn
|
||||
void * PyConnectHandler() const; //make public so that it can be called from a callback fn
|
||||
|
||||
|
||||
void * getPyGetCallbackFn(void) const
|
||||
{
|
||||
return pyGetCallbackFn;
|
||||
};
|
||||
void * getPyPutCallbackFn(void) const
|
||||
{
|
||||
return pyPutCallbackFn;
|
||||
};
|
||||
void * getPyConnectCallbackFn(void) const
|
||||
{
|
||||
return pyConnectCallbackFn;
|
||||
};
|
||||
|
||||
std::vector<void *> getPyConnectCallbackVector(void) const
|
||||
{
|
||||
return pyConnectCallbackVector;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Conduit(void );
|
||||
@@ -277,20 +335,27 @@ public:
|
||||
|
||||
int status;
|
||||
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const Conduit& e)
|
||||
{
|
||||
os<< "handle=" << e.handle<<" pv=" << e.pv<< std::endl;
|
||||
return os;
|
||||
};
|
||||
|
||||
//struct connection_handler_args getConnectionHandlerArgs(void) const{
|
||||
// return connectionHandlerArgs;
|
||||
//};
|
||||
|
||||
|
||||
//struct event_handler_args getEventHandlerArgs(void) const {
|
||||
// return eventHandlerArgs;
|
||||
//};
|
||||
|
||||
bool getPyCafe() const
|
||||
{
|
||||
return pyCafeFlag;
|
||||
};
|
||||
|
||||
|
||||
|
||||
bool operator<(const Conduit& c)const
|
||||
{
|
||||
return handle<c.handle;
|
||||
@@ -305,6 +370,11 @@ public:
|
||||
return channelDeviceAttribute.getAttribute();
|
||||
};
|
||||
|
||||
const char * getClassName(void) const
|
||||
{
|
||||
return channelRegalia.className;
|
||||
};
|
||||
|
||||
const char * getHostName(void) const
|
||||
{
|
||||
return channelRegalia.hostName;
|
||||
@@ -317,7 +387,7 @@ public:
|
||||
std::string getDescription(void) const
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
epicsTimeStamp getTimeStamp(void) const
|
||||
{
|
||||
@@ -349,44 +419,64 @@ public:
|
||||
}
|
||||
alarmSeverityStruct getAlarmSeverityStruct(void) const
|
||||
{
|
||||
return aSevStruct;
|
||||
return aSevStruct;
|
||||
}
|
||||
|
||||
bool hasDescription(void) const
|
||||
{
|
||||
return hasDesc;
|
||||
}
|
||||
|
||||
bool hasAlarmSeverityStruct(void) const
|
||||
{
|
||||
return hasAlarmSevStruct;
|
||||
}
|
||||
|
||||
|
||||
bool hasDescription(void) const
|
||||
{
|
||||
return hasDesc;
|
||||
}
|
||||
|
||||
bool hasAlarmSeverityStruct(void) const
|
||||
{
|
||||
return hasAlarmSevStruct;
|
||||
}
|
||||
|
||||
bool hasAlarmSeverity(void) const
|
||||
{
|
||||
if (aSevStruct.hhsv>SEV_NO_ALARM && aSevStruct.hhsv<=SEV_INVALID) {return true;}
|
||||
else if (aSevStruct.hsv>SEV_NO_ALARM && aSevStruct.hsv<=SEV_INVALID) {return true;}
|
||||
else if (aSevStruct.lsv>SEV_NO_ALARM && aSevStruct.lsv<=SEV_INVALID) {return true;}
|
||||
else if (aSevStruct.llsv>SEV_NO_ALARM && aSevStruct.llsv<=SEV_INVALID) {return true;}
|
||||
if (!hasAlarmSevStruct)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (aSevStruct.hhsv>SEV_NO_ALARM && aSevStruct.hhsv<=SEV_INVALID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (aSevStruct.hsv>SEV_NO_ALARM && aSevStruct.hsv<=SEV_INVALID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (aSevStruct.lsv>SEV_NO_ALARM && aSevStruct.lsv<=SEV_INVALID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (aSevStruct.llsv>SEV_NO_ALARM && aSevStruct.llsv<=SEV_INVALID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string getAlarmStatusAsString(void) const
|
||||
{
|
||||
if (alarmStatus>-1 && alarmStatus<ALARM_STATUS_STRING_LENGTH) {
|
||||
if (alarmStatus>-1 && alarmStatus<ALARM_STATUS_STRING_LENGTH)
|
||||
{
|
||||
return (std::string) epicsAlarmConditionStrings[alarmStatus];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "alarmStatusValue=" << alarmStatus << " is not within the valid range of 0-3!" << std::endl;
|
||||
return (std::string) "ALARM_UNKNOWN";
|
||||
}
|
||||
}
|
||||
std::string getAlarmSeverityAsString(void) const
|
||||
{
|
||||
if (alarmSeverity>-1 && alarmSeverity<ALARM_SEVERITY_STRING_LENGTH) {
|
||||
if (alarmSeverity>-1 && alarmSeverity<ALARM_SEVERITY_STRING_LENGTH)
|
||||
{
|
||||
return (std::string) epicsAlarmSeverityStrings[alarmSeverity];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "alarmStatusSeverity=" << alarmSeverity << " is not within the valid range of 0-21!" << std::endl;
|
||||
return (std::string) "SEVERITY_UNKNOWN";
|
||||
}
|
||||
@@ -411,6 +501,7 @@ public:
|
||||
return beamEventNo;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
PVDataHolder getPVDataFromPulseID(unsigned long long globalPulseID) const {
|
||||
PVDataHolder pvd;
|
||||
@@ -519,18 +610,20 @@ public:
|
||||
|
||||
int getPVDataHolder(PVDataHolder &) const ;
|
||||
int getPVCtrlHolder(PVCtrlHolder &) const ;
|
||||
|
||||
|
||||
std::string getUnits(void) const {
|
||||
|
||||
|
||||
std::string getUnits(void) const
|
||||
{
|
||||
PVCtrlHolder pvc;
|
||||
getPVCtrlHolder(pvc);
|
||||
return pvc.getUnitsAsString();
|
||||
return pvc.getUnitsAsString();
|
||||
};
|
||||
|
||||
short getPrecision(void) const {
|
||||
|
||||
short getPrecision(void) const
|
||||
{
|
||||
PVCtrlHolder pvc;
|
||||
getPVCtrlHolder(pvc);
|
||||
return pvc.getPrecision();
|
||||
return pvc.getPrecision();
|
||||
};
|
||||
|
||||
//bool getRule(void) const {return rule;};
|
||||
@@ -621,10 +714,38 @@ public:
|
||||
//ChannelRequestMetaDataRepository getChannelRequestMetaPrimitiveRepository(void) const {return channelRequestMetaPrimitiveRepository;}; //1
|
||||
|
||||
////MonitorPolicy getMonitorPolicy(void) const {return mpBase;};
|
||||
|
||||
|
||||
MonitorPolicy getMonitorPolicy(unsigned int monitor_id) const
|
||||
{
|
||||
|
||||
bool mpidFound=false;
|
||||
|
||||
//Iterate
|
||||
for (size_t i=0; i< mpV.size(); ++i)
|
||||
{
|
||||
if ( mpV[i].getID() == monitor_id)
|
||||
{
|
||||
mpidFound=true;
|
||||
return mpV[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!mpidFound)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << std::endl;
|
||||
std::cout << "getMonitorPolicyVector(monitor_id): " << monitor_id << " NOT FOUND! " << std::endl;
|
||||
std::cout << "Could not modify entry!" << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<MonitorPolicy> getMonitorPolicyVector(void) const
|
||||
{
|
||||
return mpV;
|
||||
};
|
||||
|
||||
|
||||
std::vector<MonitorPolicy> getMonitorPolicyInWaitingVector(void) const
|
||||
{
|
||||
return mpInWaitingV;
|
||||
@@ -634,6 +755,12 @@ public:
|
||||
{
|
||||
return monitorAction;
|
||||
};
|
||||
|
||||
std::vector<void *> getWidgetV(void) const
|
||||
{
|
||||
return std::vector<void *>(widgetV);
|
||||
};
|
||||
|
||||
bool getHasNewData(void) const
|
||||
{
|
||||
return hasNewData;
|
||||
|
||||
@@ -16,33 +16,37 @@
|
||||
* Friend to Conduit/CAFEGroup records the connection_handler_args struct from callback fns
|
||||
* in hash table
|
||||
*/
|
||||
struct change_connectionHandlerArgs {
|
||||
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.connectionHandlerArgs = new_connectionHandlerArgs;
|
||||
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.
|
||||
|
||||
//std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
|
||||
//connectFlag
|
||||
if (new_connectionHandlerArgs.op == CA_OP_CONN_UP) {
|
||||
if (new_connectionHandlerArgs.op == CA_OP_CONN_UP)
|
||||
{
|
||||
|
||||
//std::cout << " change_connectionHandlerArgs: bytesize UP " << c.channelRequestMetaData.byteSize << std::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);
|
||||
c.channelRegalia.hostName = (const char *) ca_host_name (new_connectionHandlerArgs.chid);
|
||||
|
||||
if (c.channelRegalia.channelID != new_connectionHandlerArgs.chid) {
|
||||
if (c.channelRegalia.channelID != new_connectionHandlerArgs.chid)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "Internal CAFE WARNING for handle : " << c.handle << std::endl;
|
||||
std::cout << "Channel ID has changed from " << c.channelRegalia.channelID
|
||||
@@ -65,7 +69,8 @@ struct change_connectionHandlerArgs {
|
||||
// Check if c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN or not!
|
||||
|
||||
|
||||
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
|
||||
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;
|
||||
@@ -73,7 +78,8 @@ struct change_connectionHandlerArgs {
|
||||
|
||||
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
|
||||
//but will be overwritten by whatever the client needs
|
||||
switch (c.channelRequestMetaDataClient.cafeDbrType) {
|
||||
switch (c.channelRequestMetaDataClient.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
|
||||
break;
|
||||
@@ -104,7 +110,8 @@ struct change_connectionHandlerArgs {
|
||||
|
||||
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
|
||||
//cafeDbrType can only be overwritten by an explicit method invocation
|
||||
switch (c.channelRequestMetaData.cafeDbrType) {
|
||||
switch (c.channelRequestMetaData.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
|
||||
break;
|
||||
@@ -127,16 +134,19 @@ struct change_connectionHandlerArgs {
|
||||
//No of elements for Ctrl Buffers
|
||||
unsigned int nelem_ctrl_buffer=1;
|
||||
|
||||
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_CTRL_BUFFER) {
|
||||
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_CTRL_BUFFER)
|
||||
{
|
||||
nelem_ctrl_buffer = DEFAULT_NELEM_FOR_CTRL_BUFFER;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
nelem_ctrl_buffer = c.channelRegalia.nelem;
|
||||
}
|
||||
|
||||
//ctrl data CLIENT
|
||||
//Ctrl data requested by Client
|
||||
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
|
||||
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;
|
||||
@@ -144,7 +154,8 @@ struct change_connectionHandlerArgs {
|
||||
|
||||
//cafeDbrType first filled with CAFENUM:DBR_CTRL on initialization
|
||||
//but will be overwritten by whatever the client needs
|
||||
switch (c.channelRequestMetaCtrlClient.cafeDbrType) {
|
||||
switch (c.channelRequestMetaCtrlClient.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_CTRL:
|
||||
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
|
||||
break;
|
||||
@@ -168,7 +179,8 @@ struct change_connectionHandlerArgs {
|
||||
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) {
|
||||
switch (c.channelRequestMetaCtrl.cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_CTRL:
|
||||
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
|
||||
break;
|
||||
@@ -186,10 +198,12 @@ struct change_connectionHandlerArgs {
|
||||
//No of elements for STSACK Buffers
|
||||
unsigned int nelem_stsack_buffer;
|
||||
|
||||
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_STSACK_BUFFER) {
|
||||
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_STSACK_BUFFER)
|
||||
{
|
||||
nelem_stsack_buffer = DEFAULT_NELEM_FOR_STSACK_BUFFER;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
nelem_stsack_buffer = c.channelRegalia.nelem;
|
||||
}
|
||||
|
||||
@@ -213,7 +227,8 @@ struct change_connectionHandlerArgs {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
if ( c.channelRegalia.nelem>1) {
|
||||
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));
|
||||
@@ -225,7 +240,8 @@ struct change_connectionHandlerArgs {
|
||||
c.channelRegalia.cafeConnectionState = ICAFE_CS_CONN;
|
||||
c.status = ICAFE_CA_OP_CONN_UP;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
//nativeType not known on disconnect!!
|
||||
|
||||
@@ -234,7 +250,7 @@ struct change_connectionHandlerArgs {
|
||||
c.channelRequestStatusPut.setCallbackKind(false, true); //fake completion
|
||||
c.channelRegalia.cafeConnectionState =ICAFE_CS_DISCONN;
|
||||
c.channelRegalia.connectFlag = false;
|
||||
c.status = ICAFE_CA_OP_CONN_DOWN;
|
||||
c.status = ICAFE_CA_OP_CONN_DOWN;
|
||||
|
||||
}
|
||||
|
||||
@@ -251,7 +267,8 @@ private:
|
||||
* 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 {
|
||||
struct change_dataBufferSize_CTRL
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_CTRL"
|
||||
change_dataBufferSize_CTRL (const chtype & new_ctrlTypeBuffer): new_ctrlTypeBuffer(new_ctrlTypeBuffer) {}
|
||||
|
||||
@@ -263,11 +280,13 @@ struct change_dataBufferSize_CTRL {
|
||||
|
||||
bool allocateMemory=false ;
|
||||
|
||||
if(c.ctrlBuffer==NULL) {
|
||||
if(c.ctrlBuffer==NULL)
|
||||
{
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
else if ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) > c.channelRequestMetaCtrl.getByteSize() ) {
|
||||
else if ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) > c.channelRequestMetaCtrl.getByteSize() )
|
||||
{
|
||||
std::cout << "ctrlBuffer already exists= " << c.ctrlBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << std::endl;
|
||||
std::cout << "Freeing and reallocating ctrlBuffer" << std::endl;
|
||||
@@ -275,14 +294,16 @@ struct change_dataBufferSize_CTRL {
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
if (allocateMemory)
|
||||
{
|
||||
//std::cout << "sizeof c.ctrlBuffer " << dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) << std::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) {
|
||||
if (c.ctrlBuffer==0)
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
@@ -300,7 +321,8 @@ private:
|
||||
* 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 {
|
||||
struct change_dataBufferSize_PRIMITIVE
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
|
||||
change_dataBufferSize_PRIMITIVE (const chtype & new_dataTypeBufferNative): new_dataTypeBufferNative(new_dataTypeBufferNative) {}
|
||||
|
||||
@@ -309,12 +331,14 @@ struct change_dataBufferSize_PRIMITIVE {
|
||||
|
||||
bool allocateMemory=false ;
|
||||
|
||||
if(c.putBuffer==NULL) {
|
||||
if(c.putBuffer==NULL)
|
||||
{
|
||||
allocateMemory=true;
|
||||
}
|
||||
else if ( dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
|
||||
c.channelRequestMetaPrimitive.getNelem())
|
||||
> c.channelRequestMetaPrimitive.getByteSize() ) {
|
||||
> c.channelRequestMetaPrimitive.getByteSize() )
|
||||
{
|
||||
std::cout << "putBuffer already exists= " << c.putBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << std::endl;
|
||||
std::cout << "Freeing and reallocating putBuffer" << std::endl;
|
||||
@@ -322,7 +346,8 @@ struct change_dataBufferSize_PRIMITIVE {
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
if (allocateMemory)
|
||||
{
|
||||
//std::cout << "sizeof c.putBuffer " << dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
|
||||
// c.channelRequestMetaPrimitive.getNelem()) << std::endl;
|
||||
c.putBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
|
||||
@@ -333,7 +358,8 @@ struct change_dataBufferSize_PRIMITIVE {
|
||||
c.channelRequestMetaPrimitive.getNelem());
|
||||
}
|
||||
|
||||
if (c.putBuffer==0) {
|
||||
if (c.putBuffer==0)
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
@@ -353,7 +379,8 @@ private:
|
||||
* 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 {
|
||||
struct change_dataBufferSize_STSACK
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_STSACK"
|
||||
change_dataBufferSize_STSACK () {}
|
||||
|
||||
@@ -362,14 +389,16 @@ struct change_dataBufferSize_STSACK {
|
||||
|
||||
bool allocateMemory=false ;
|
||||
|
||||
if(c.stsackBuffer==NULL) {
|
||||
if(c.stsackBuffer==NULL)
|
||||
{
|
||||
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
else if ( dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
|
||||
c.channelRequestMetaSTSACK.getNelem())
|
||||
> c.channelRequestMetaSTSACK.getByteSize() ) {
|
||||
> c.channelRequestMetaSTSACK.getByteSize() )
|
||||
{
|
||||
std::cout << "stsackBuffer already exists= " << c.stsackBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << std::endl;
|
||||
std::cout << "Freeing and reallocating putBuffer" << std::endl;
|
||||
@@ -377,7 +406,8 @@ struct change_dataBufferSize_STSACK {
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
if (allocateMemory)
|
||||
{
|
||||
//std::cout << "sizeof c.stsackBuffer " << dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
|
||||
// c.channelRequestMetaSTSACK.getNelem()) << std::endl;
|
||||
c.stsackBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
|
||||
@@ -397,7 +427,8 @@ struct change_dataBufferSize_STSACK {
|
||||
* 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 {
|
||||
struct change_dataBufferSize_TIME
|
||||
{
|
||||
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
|
||||
|
||||
change_dataBufferSize_TIME (const chtype & new_dataTypeBuffer): new_dataTypeBuffer(new_dataTypeBuffer) {}
|
||||
@@ -411,12 +442,14 @@ struct change_dataBufferSize_TIME {
|
||||
bool allocateMemory=false ;
|
||||
|
||||
|
||||
if(c.dataBuffer==NULL) {
|
||||
if(c.dataBuffer==NULL)
|
||||
{
|
||||
|
||||
allocateMemory=true;
|
||||
}
|
||||
|
||||
else if ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) > c.channelRequestMetaData.getByteSize() ) {
|
||||
else if ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) > c.channelRequestMetaData.getByteSize() )
|
||||
{
|
||||
std::cout << "dataBuffer already exists= " << c.dataBuffer << " for channel " << c.pv
|
||||
<< " with handle " << c.handle << std::endl;
|
||||
std::cout << "Freeing and reallocating dataBuffer" << std::endl;
|
||||
@@ -428,14 +461,16 @@ struct change_dataBufferSize_TIME {
|
||||
|
||||
}
|
||||
|
||||
if (allocateMemory) {
|
||||
if (allocateMemory)
|
||||
{
|
||||
//std::cout << "sizeof c.dataBuffer " << dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) << std::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) {
|
||||
if (c.dataBuffer==NULL)
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
@@ -453,7 +488,8 @@ private:
|
||||
/**
|
||||
* Friend to CAFEConduit/CAFEGroup - releases resources
|
||||
*/
|
||||
struct free_dataBuffers {
|
||||
struct free_dataBuffers
|
||||
{
|
||||
free_dataBuffers () {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -461,19 +497,23 @@ struct free_dataBuffers {
|
||||
|
||||
//std::cout << "c.handle=" << c.handle << " " << c.pv << std::endl;
|
||||
|
||||
if(c.dataBuffer) {
|
||||
if(c.dataBuffer)
|
||||
{
|
||||
free(c.dataBuffer); // _TIME data buffer for ca_get
|
||||
}
|
||||
|
||||
if(c.ctrlBuffer) {
|
||||
if(c.ctrlBuffer)
|
||||
{
|
||||
free(c.ctrlBuffer); // _CTRL data buffer for ca_get
|
||||
}
|
||||
|
||||
if(c.stsackBuffer) {
|
||||
if(c.stsackBuffer)
|
||||
{
|
||||
free(c.stsackBuffer); // _STSACK_STRING data buffer for ca_get
|
||||
}
|
||||
|
||||
if(c.putBuffer) {
|
||||
if(c.putBuffer)
|
||||
{
|
||||
free(c.putBuffer); // data buffer for ca_put
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
* Friend to Conduit/CAFEGroup permitting the event_handler_args.dbr data from callback fn
|
||||
* to be recorded in hash table
|
||||
*/
|
||||
struct change_eventHandlerArgs {
|
||||
struct change_eventHandlerArgs
|
||||
{
|
||||
#define __METHOD__ "change_eventHandlerArgs"
|
||||
change_eventHandlerArgs (const struct event_handler_args & new_eventHandlerArgs) :
|
||||
new_eventHandlerArgs(new_eventHandlerArgs) {}
|
||||
@@ -25,11 +26,14 @@ struct change_eventHandlerArgs {
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
//c.eventHandlerArgs = new_eventHandlerArgs;
|
||||
c.status= new_eventHandlerArgs.status;
|
||||
if(c.status!=ECA_NORMAL) return;
|
||||
|
||||
if(c.status!=ECA_NORMAL) {
|
||||
std::cout << __METHOD__ << " STATUS IS " << c.status << std::endl;
|
||||
std::cout << __METHOD__ << " return from method enforced " << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Helper helper;
|
||||
|
||||
@@ -39,8 +43,6 @@ struct change_eventHandlerArgs {
|
||||
//Let is do comparison!
|
||||
CAFENUM::DBR_TYPE dbrTypeClass=helper.convertToCAFEDbrTypeClass(new_eventHandlerArgs.type);
|
||||
|
||||
|
||||
|
||||
c.usrArgs = new_eventHandlerArgs.usr;
|
||||
c.dataType= requestedT;
|
||||
c.dbrDataType= bufferType;
|
||||
@@ -49,16 +51,20 @@ struct change_eventHandlerArgs {
|
||||
c.hasNewData=true; //flag used by getMonitorAction for CAFE extensions!
|
||||
|
||||
|
||||
if (new_eventHandlerArgs.type < DBR_GR_STRING) {
|
||||
if (new_eventHandlerArgs.type < DBR_GR_STRING)
|
||||
{
|
||||
bufferType = dbf_type_to_DBR_TIME(requestedT);
|
||||
}
|
||||
else if (new_eventHandlerArgs.type < DBR_PUT_ACKT) {
|
||||
else if (new_eventHandlerArgs.type < DBR_PUT_ACKT)
|
||||
{
|
||||
bufferType = dbf_type_to_DBR_CTRL(requestedT);
|
||||
}
|
||||
else if (new_eventHandlerArgs.type < (LAST_BUFFER_TYPE+1)) {
|
||||
else if (new_eventHandlerArgs.type < (LAST_BUFFER_TYPE+1))
|
||||
{
|
||||
// keep default
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
std::cout << "CAFE INTERNAL FUNNY: UNKNOWN event_handler_args.type= "
|
||||
<< new_eventHandlerArgs.type << std::endl;
|
||||
@@ -70,8 +76,8 @@ struct change_eventHandlerArgs {
|
||||
unsigned int navailable = nrequired;
|
||||
|
||||
|
||||
|
||||
switch(dbrTypeClass) {
|
||||
switch(dbrTypeClass)
|
||||
{
|
||||
case CAFENUM::DBR_STSACK:
|
||||
navailable = c.channelRequestMetaSTSACK.byteSize;
|
||||
c.channelRequestMetaSTSACK.nelem = new_eventHandlerArgs.count;
|
||||
@@ -83,9 +89,7 @@ struct change_eventHandlerArgs {
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
case CAFENUM::DBR_STS:
|
||||
case CAFENUM::DBR_TIME:
|
||||
navailable = c.channelRequestMetaData.byteSize; //
|
||||
|
||||
|
||||
navailable = c.channelRequestMetaData.byteSize;
|
||||
|
||||
c.channelRequestMetaData.nelem = new_eventHandlerArgs.count;
|
||||
c.channelRequestMetaData.dataType = requestedT;
|
||||
@@ -94,7 +98,8 @@ struct change_eventHandlerArgs {
|
||||
c.channelRequestMetaData.usrArg = new_eventHandlerArgs.usr; //c.channelRequestMetaDataClient.usrArg;
|
||||
|
||||
//Do this check here already
|
||||
if (nrequired > navailable) {
|
||||
if (nrequired > navailable)
|
||||
{
|
||||
c.channelRequestMetaData.byteSize = nrequired;
|
||||
|
||||
}
|
||||
@@ -107,7 +112,8 @@ struct change_eventHandlerArgs {
|
||||
c.channelRequestMetaCtrl.dbrDataType = new_eventHandlerArgs.type;
|
||||
c.channelRequestMetaCtrl.cafeDbrType = dbrTypeClass;
|
||||
c.channelRequestMetaCtrl.usrArg = new_eventHandlerArgs.usr; //c.channelRequestMetaDataClient.usrArg;
|
||||
if (nrequired > navailable) {
|
||||
if (nrequired > navailable)
|
||||
{
|
||||
c.channelRequestMetaCtrl.byteSize = nrequired;
|
||||
}
|
||||
break;
|
||||
@@ -122,9 +128,8 @@ struct change_eventHandlerArgs {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (nrequired > navailable) {
|
||||
if (nrequired > navailable)
|
||||
{
|
||||
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
std::cout << "CHANGE OF BUFFER SIZE: FROM " << navailable << " bytes TO " << nrequired << " bytes" << std::endl;
|
||||
@@ -133,13 +138,16 @@ struct change_eventHandlerArgs {
|
||||
<< " type=" << dbr_type_to_text(new_eventHandlerArgs.type) << std::endl;
|
||||
|
||||
//check DataBuffers
|
||||
switch(dbrTypeClass) {
|
||||
switch(dbrTypeClass)
|
||||
{
|
||||
case CAFENUM::DBR_STSACK: //value is of type dbr_string_t
|
||||
|
||||
if (c.stsackBuffer!=NULL) {
|
||||
if (c.stsackBuffer!=NULL)
|
||||
{
|
||||
free(c.stsackBuffer);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
std::cout << "CAFE INTERNAL FUNNY: HOW CAN stsackBuffer NOT ALREADY EXIST?" << std::endl;
|
||||
std::cout << "CREATING stsackBuffer " << std::endl;
|
||||
@@ -148,7 +156,8 @@ struct change_eventHandlerArgs {
|
||||
c.stsackBuffer = (db_access_val *) malloc (nrequired);
|
||||
|
||||
|
||||
if (c.stsackBuffer==NULL) {
|
||||
if (c.stsackBuffer==NULL)
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
@@ -166,7 +175,8 @@ struct change_eventHandlerArgs {
|
||||
case CAFENUM::DBR_TIME:
|
||||
|
||||
// Check that buffer is large enough! Do not expect this part ever to be invoked
|
||||
if (c.dataBuffer != NULL) {
|
||||
if (c.dataBuffer != NULL)
|
||||
{
|
||||
|
||||
// Only re-allocate buffer if the number of native elements has increased without the
|
||||
// the callback function first being called. i.e. nelemNative was changed on the fly!
|
||||
@@ -174,7 +184,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
free(c.dataBuffer);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
std::cout << "CAFE INTERNAL FUNNY: HOW CAN dataBuffer NOT ALREADY EXIST?" << std::endl;
|
||||
std::cout << "CREATING dataBuffer " << std::endl;
|
||||
@@ -182,7 +193,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
c.dataBuffer = (db_access_val *) malloc (nrequired);
|
||||
|
||||
if (c.dataBuffer==NULL) {
|
||||
if (c.dataBuffer==NULL)
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
@@ -196,7 +208,8 @@ struct change_eventHandlerArgs {
|
||||
case CAFENUM::DBR_CTRL:
|
||||
|
||||
// Check that buffer is large enough! Do not expect this part ever to be invoked
|
||||
if (c.ctrlBuffer != NULL) {
|
||||
if (c.ctrlBuffer != NULL)
|
||||
{
|
||||
|
||||
// Only re-allocate buffer if the number of native elements has increased without the
|
||||
// the callback function first being called. i.e. nelemNative was changed on the fly!
|
||||
@@ -204,7 +217,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
free(c.ctrlBuffer);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
std::cout << "CAFE INTERNAL FUNNY: HOW CAN dataBuffer NOT ALREADY EXIST?" << std::endl;
|
||||
std::cout << "CREATING dataBuffer " << std::endl;
|
||||
@@ -212,7 +226,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
c.ctrlBuffer = (db_access_val *) malloc (nrequired);
|
||||
|
||||
if (c.ctrlBuffer==NULL) {
|
||||
if (c.ctrlBuffer==NULL)
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
|
||||
printf ("Exiting CAFE");
|
||||
@@ -234,13 +249,18 @@ struct change_eventHandlerArgs {
|
||||
} // if new buffer size required
|
||||
|
||||
|
||||
if (new_eventHandlerArgs.count > 0) {
|
||||
if ((unsigned int) new_eventHandlerArgs.count > c.channelRegalia.nelem) {
|
||||
if (new_eventHandlerArgs.count > 0)
|
||||
{
|
||||
if ((unsigned int) new_eventHandlerArgs.count > c.channelRegalia.nelem)
|
||||
{
|
||||
c.channelRegalia.nelem = (unsigned int) new_eventHandlerArgs.count;
|
||||
}
|
||||
}
|
||||
|
||||
switch(dbrTypeClass) {
|
||||
|
||||
|
||||
switch(dbrTypeClass)
|
||||
{
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
//c.hasAlarmStatus =false;
|
||||
//c.hasAlarmSeverity=false;
|
||||
@@ -300,10 +320,12 @@ struct change_eventHandlerArgs {
|
||||
|
||||
//Now fill buffers
|
||||
|
||||
switch(new_eventHandlerArgs.type) {
|
||||
switch(new_eventHandlerArgs.type)
|
||||
{
|
||||
case DBR_DOUBLE: //6
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->doubleval)+i))
|
||||
= (*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->doubleval)+i));
|
||||
}
|
||||
@@ -312,7 +334,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_FLOAT: // 2
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->fltval)+i))
|
||||
= (dbr_float_t) (*(&( ( (union db_access_val *) new_eventHandlerArgs.dbr)->fltval)+i));
|
||||
}
|
||||
@@ -322,7 +345,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_LONG: // 5
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->longval)+i))
|
||||
= (*(&(( (union db_access_val *) new_eventHandlerArgs.dbr)->longval)+i));
|
||||
}
|
||||
@@ -330,7 +354,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_SHORT: // 1
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->shrtval)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->shrtval)+i));
|
||||
}
|
||||
@@ -338,7 +363,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STRING: // 0
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
strcpy ((*(&((c.dataBuffer)->strval)+i)),
|
||||
(*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->strval)+i)) );
|
||||
}
|
||||
@@ -346,7 +372,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_ENUM: // 3
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->enmval)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->enmval)+i));
|
||||
}
|
||||
@@ -354,7 +381,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CHAR: // 4
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->charval)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->charval)+i));
|
||||
}
|
||||
@@ -363,7 +391,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STS_DOUBLE: // 13
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->sdblval.value)+i))
|
||||
= (*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->sdblval.value)+i));
|
||||
}
|
||||
@@ -377,7 +406,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STS_FLOAT: // 9
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->sfltval.value)+i))
|
||||
= (dbr_float_t) (*(&( ( (union db_access_val *) new_eventHandlerArgs.dbr)->sfltval.value)+i));
|
||||
}
|
||||
@@ -392,7 +422,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STS_LONG: // 12
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->slngval.value)+i))
|
||||
= (*(&(( (union db_access_val *) new_eventHandlerArgs.dbr)->slngval.value)+i));
|
||||
}
|
||||
@@ -407,7 +438,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STS_SHORT: // 8
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->sshrtval.value)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->sshrtval.value)+i));
|
||||
}
|
||||
@@ -420,7 +452,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STS_STRING: // 7
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
strcpy ((*(&((c.dataBuffer)->sstrval.value)+i)),
|
||||
(*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->sstrval.value)+i)) );
|
||||
}
|
||||
@@ -434,7 +467,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STS_ENUM: // 10
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->senmval.value)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->senmval.value)+i));
|
||||
}
|
||||
@@ -448,7 +482,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_STS_CHAR: // 11
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->schrval.value)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->schrval.value)+i));
|
||||
}
|
||||
@@ -463,7 +498,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_TIME_DOUBLE: // 20
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->tdblval.value)+i))
|
||||
= (*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->tdblval.value)+i));
|
||||
}
|
||||
@@ -481,7 +517,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_TIME_FLOAT: //16
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
|
||||
(*(&((c.dataBuffer)->tfltval.value)+i))
|
||||
= (dbr_float_t) (*(&( ( (union db_access_val *) new_eventHandlerArgs.dbr)->tfltval.value)+i));
|
||||
@@ -501,7 +538,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_TIME_LONG: //19
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->tlngval.value)+i))
|
||||
= (*(&(( (union db_access_val *) new_eventHandlerArgs.dbr)->tlngval.value)+i));
|
||||
}
|
||||
@@ -516,7 +554,8 @@ struct change_eventHandlerArgs {
|
||||
break;
|
||||
|
||||
case DBR_TIME_SHORT:
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->tshrtval.value)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tshrtval.value)+i));
|
||||
}
|
||||
@@ -533,7 +572,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_TIME_STRING: //14
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
strcpy ((*(&((c.dataBuffer)->tstrval.value)+i)),
|
||||
(*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tstrval.value)+i)) );
|
||||
}
|
||||
@@ -551,7 +591,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_TIME_ENUM: //17
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->tenmval.value)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tenmval.value)+i));
|
||||
}
|
||||
@@ -569,7 +610,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_TIME_CHAR: //18
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.dataBuffer)->tchrval.value)+i))
|
||||
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tchrval.value)+i));
|
||||
|
||||
@@ -585,7 +627,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CTRL_DOUBLE: //34
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->cdblval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cdblval.value)+i));
|
||||
}
|
||||
@@ -622,7 +665,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CTRL_LONG: //33
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->clngval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->clngval.value)+i));
|
||||
}
|
||||
@@ -663,7 +707,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CTRL_CHAR: //32
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->gchrval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cchrval.value)+i));
|
||||
}
|
||||
@@ -704,7 +749,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CTRL_ENUM: //31
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->cenmval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cenmval.value)+i));
|
||||
}
|
||||
@@ -738,7 +784,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CTRL_FLOAT: //30
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->cfltval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cfltval.value)+i));
|
||||
}
|
||||
@@ -784,7 +831,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CTRL_SHORT: //29
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->gshrtval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cshrtval.value)+i));
|
||||
}
|
||||
@@ -826,7 +874,9 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_CTRL_STRING: //28
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
strcpy( (*(&((c.ctrlBuffer)->cstrval.value)+i)),
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cstrval.value)+i)));
|
||||
}
|
||||
@@ -839,11 +889,13 @@ struct change_eventHandlerArgs {
|
||||
//c.alarmStatus =((struct dbr_sts_string *) new_eventHandlerArgs.dbr)->status;
|
||||
//c.alarmSeverity=((struct dbr_sts_string *) new_eventHandlerArgs.dbr)->severity;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case DBR_GR_DOUBLE: //27
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->gdblval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gdblval.value)+i));
|
||||
}
|
||||
@@ -883,7 +935,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_GR_LONG: //26
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->glngval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->glngval.value)+i));
|
||||
}
|
||||
@@ -920,7 +973,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_GR_CHAR: //25
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->gchrval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gchrval.value)+i));
|
||||
}
|
||||
@@ -957,7 +1011,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_GR_ENUM: //24
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->genmval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->genmval.value)+i));
|
||||
}
|
||||
@@ -992,7 +1047,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_GR_FLOAT: //23
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->gfltval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gfltval.value)+i));
|
||||
}
|
||||
@@ -1034,7 +1090,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_GR_SHORT: //22
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
(*(&((c.ctrlBuffer)->gshrtval.value)+i)) =
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gshrtval.value)+i));
|
||||
}
|
||||
@@ -1071,7 +1128,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
case DBR_GR_STRING: //21
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
strcpy( (*(&((c.ctrlBuffer)->gstrval.value)+i)),
|
||||
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gstrval.value)+i)));
|
||||
}
|
||||
@@ -1102,7 +1160,8 @@ struct change_eventHandlerArgs {
|
||||
// (*(&(((struct dbr_stsack_string *) new_eventHandlerArgs.dbr)->value)+0))
|
||||
// << std::endl;
|
||||
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
|
||||
for (long i=0; i<new_eventHandlerArgs.count; ++i)
|
||||
{
|
||||
strcpy ((*(&((c.stsackBuffer)->sastrval.value)+i)),
|
||||
(*(&(((struct dbr_stsack_string *) new_eventHandlerArgs.dbr)->value)+i)) );
|
||||
//std::cout << " VAL " << (*(&((c.stsackBuffer)->sastrval.value)+i)) << " [" << i << "] ";
|
||||
@@ -1169,7 +1228,8 @@ struct change_eventHandlerArgs {
|
||||
|
||||
//Do this to prevent overflow error in epicsTime time(ts) routines!
|
||||
//This bad number can occur in timeouts
|
||||
if(c.ts.nsec>1000000000) {
|
||||
if(c.ts.nsec>1000000000)
|
||||
{
|
||||
c.ts.nsec=0;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to STS recorded in hash table
|
||||
*/
|
||||
struct change_alarmStatus {
|
||||
struct change_alarmStatus
|
||||
{
|
||||
change_alarmStatus (const dbr_short_t & new_alarmStatus): new_alarmStatus(new_alarmStatus) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -28,7 +29,8 @@ struct change_alarmStatus {
|
||||
private:
|
||||
dbr_short_t new_alarmStatus;
|
||||
};
|
||||
struct change_alarmSeverity {
|
||||
struct change_alarmSeverity
|
||||
{
|
||||
change_alarmSeverity (const dbr_short_t & new_alarmSeverity): new_alarmSeverity(new_alarmSeverity) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -41,7 +43,8 @@ struct change_alarmSeverity {
|
||||
private:
|
||||
dbr_short_t new_alarmSeverity;
|
||||
};
|
||||
struct change_epicsTimeStamp {
|
||||
struct change_epicsTimeStamp
|
||||
{
|
||||
change_epicsTimeStamp (const epicsTimeStamp & new_epicsTimeStamp): new_epicsTimeStamp(new_epicsTimeStamp) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -50,7 +53,8 @@ struct change_epicsTimeStamp {
|
||||
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) {
|
||||
if(c.ts.nsec>1000000000)
|
||||
{
|
||||
c.ts.nsec=0;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -64,7 +68,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
|
||||
*/
|
||||
struct change_accessRead {
|
||||
struct change_accessRead
|
||||
{
|
||||
change_accessRead (const unsigned int & new_accessRead): new_accessRead(new_accessRead) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -82,7 +87,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
|
||||
*/
|
||||
struct change_accessWrite {
|
||||
struct change_accessWrite
|
||||
{
|
||||
change_accessWrite (const unsigned int & new_accessWrite): new_accessWrite(new_accessWrite) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -101,7 +107,8 @@ private:
|
||||
* Friend toConduit/CAFEGroup permitting the access_rights_handler_args struct from callback fns
|
||||
* to be recorded in hash table
|
||||
*/
|
||||
struct change_accessRightsHandlerArgs {
|
||||
struct change_accessRightsHandlerArgs
|
||||
{
|
||||
change_accessRightsHandlerArgs (const struct access_rights_handler_args & new_accessRightsHandlerArgs):
|
||||
new_accessRightsHandlerArgs(new_accessRightsHandlerArgs) {}
|
||||
|
||||
@@ -111,6 +118,8 @@ struct change_accessRightsHandlerArgs {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
c.channelRegalia.accessRead = new_accessRightsHandlerArgs.ar.read_access;
|
||||
c.channelRegalia.accessWrite= new_accessRightsHandlerArgs.ar.write_access;
|
||||
//std::cout << "change_accessRightsHandlerArgs " << new_accessRightsHandlerArgs.ar.read_access << new_accessRightsHandlerArgs.ar.write_access << std:: endl;
|
||||
//std::cout << "change_accessRightsHandlerArgs " << c.channelRegalia.accessRead << c.channelRegalia.accessWrite << std:: endl;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
@@ -122,7 +131,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit permitting pulse_id f to be set in hash table
|
||||
*/
|
||||
struct change_beamEventNo {
|
||||
struct change_beamEventNo
|
||||
{
|
||||
change_beamEventNo (const unsigned long long & new_beamEventNo): new_beamEventNo(new_beamEventNo) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -134,10 +144,14 @@ private:
|
||||
unsigned long long new_beamEventNo;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
|
||||
*/
|
||||
struct change_channelDeviceAttribute {
|
||||
struct change_channelDeviceAttribute
|
||||
{
|
||||
change_channelDeviceAttribute (const ChannelDeviceAttribute & new_channelDeviceAttribute):
|
||||
new_channelDeviceAttribute(new_channelDeviceAttribute) {}
|
||||
|
||||
@@ -155,7 +169,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup records the channelID in hash table
|
||||
*/
|
||||
struct change_channelID {
|
||||
struct change_channelID
|
||||
{
|
||||
change_channelID (const chid & new_channelID): new_channelID(new_channelID) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -173,7 +188,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelGetActionWhenMonitorPolicy in hash table
|
||||
*/
|
||||
struct change_channelGetActionWhenMonitorPolicy {
|
||||
struct change_channelGetActionWhenMonitorPolicy
|
||||
{
|
||||
change_channelGetActionWhenMonitorPolicy (
|
||||
const ChannelGetActionWhenMonitorPolicy & new_channelGetActionWhenMonitorPolicy):
|
||||
new_channelGetActionWhenMonitorPolicy(new_channelGetActionWhenMonitorPolicy) {}
|
||||
@@ -191,7 +207,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelGetCacheWaitPolicy in hash table
|
||||
*/
|
||||
struct change_channelGetCacheWaitPolicy {
|
||||
struct change_channelGetCacheWaitPolicy
|
||||
{
|
||||
change_channelGetCacheWaitPolicy (
|
||||
const ChannelGetCacheWaitPolicy & new_channelGetCacheWaitPolicy):
|
||||
new_channelGetCacheWaitPolicy(new_channelGetCacheWaitPolicy) {}
|
||||
@@ -212,7 +229,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit permitting hasNewData flag to be set in hash table
|
||||
*/
|
||||
struct change_hasNewData {
|
||||
struct change_hasNewData
|
||||
{
|
||||
change_hasNewData (const bool & new_hasNewData): new_hasNewData(new_hasNewData) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -229,7 +247,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
|
||||
*/
|
||||
struct change_channelRegalia {
|
||||
struct change_channelRegalia
|
||||
{
|
||||
change_channelRegalia (const ChannelRegalia & new_channelRegalia): new_channelRegalia(new_channelRegalia) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -245,7 +264,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestDataTypePolicy in hash table
|
||||
*/
|
||||
struct change_channelRequestDataTypePolicy {
|
||||
struct change_channelRequestDataTypePolicy
|
||||
{
|
||||
change_channelRequestDataTypePolicy (
|
||||
const ChannelRequestDataTypePolicy & new_channelRequestDataTypePolicy):
|
||||
new_channelRequestDataTypePolicy(new_channelRequestDataTypePolicy) {}
|
||||
@@ -264,7 +284,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaCtrl in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaCtrl {
|
||||
struct change_channelRequestMetaCtrl
|
||||
{
|
||||
change_channelRequestMetaCtrl (const ChannelRequestMetaData & new_channelData):
|
||||
new_channelData(new_channelData) {}
|
||||
|
||||
@@ -282,7 +303,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaCtrlClient in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaCtrlClient {
|
||||
struct change_channelRequestMetaCtrlClient
|
||||
{
|
||||
change_channelRequestMetaCtrlClient (const ChannelRequestMetaDataClient & new_channelData):
|
||||
new_channelData(new_channelData) {}
|
||||
|
||||
@@ -303,7 +325,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaData in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaData {
|
||||
struct change_channelRequestMetaData
|
||||
{
|
||||
change_channelRequestMetaData (const ChannelRequestMetaData & new_channelData):
|
||||
new_channelData(new_channelData) {}
|
||||
|
||||
@@ -324,7 +347,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaDataClient in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaDataClient {
|
||||
struct change_channelRequestMetaDataClient
|
||||
{
|
||||
change_channelRequestMetaDataClient (const ChannelRequestMetaDataClient & new_channelData):
|
||||
new_channelData(new_channelData) {}
|
||||
|
||||
@@ -343,7 +367,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestMetaPrimitive in hash table
|
||||
*/
|
||||
struct change_channelRequestMetaPrimitive {
|
||||
struct change_channelRequestMetaPrimitive
|
||||
{
|
||||
change_channelRequestMetaPrimitive (const ChannelRequestMetaData & new_channelData):
|
||||
new_channelData(new_channelData) {}
|
||||
|
||||
@@ -360,7 +385,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestPolicyGet in hash table
|
||||
*/
|
||||
struct change_channelRequestPolicyGet {
|
||||
struct change_channelRequestPolicyGet
|
||||
{
|
||||
change_channelRequestPolicyGet (const ChannelRequestPolicy & new_ChannelRequestPolicy):
|
||||
new_ChannelRequestPolicy(new_ChannelRequestPolicy) {}
|
||||
|
||||
@@ -377,7 +403,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestPolicyGetCtrl in hash table
|
||||
*/
|
||||
struct change_channelRequestPolicyGetCtrl {
|
||||
struct change_channelRequestPolicyGetCtrl
|
||||
{
|
||||
change_channelRequestPolicyGetCtrl (const ChannelRequestPolicy & new_ChannelRequestPolicy):
|
||||
new_ChannelRequestPolicy(new_ChannelRequestPolicy) {}
|
||||
|
||||
@@ -395,7 +422,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestPolicyPut in hash table
|
||||
*/
|
||||
struct change_channelRequestPolicyPut {
|
||||
struct change_channelRequestPolicyPut
|
||||
{
|
||||
change_channelRequestPolicyPut (const ChannelRequestPolicy & new_ChannelRequestPolicy):
|
||||
new_ChannelRequestPolicy(new_ChannelRequestPolicy) {}
|
||||
|
||||
@@ -414,7 +442,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGet in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGet {
|
||||
struct change_channelRequestStatusGet
|
||||
{
|
||||
change_channelRequestStatusGet (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
|
||||
|
||||
@@ -434,7 +463,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGetCtrl in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGetCtrl {
|
||||
struct change_channelRequestStatusGetCtrl
|
||||
{
|
||||
change_channelRequestStatusGetCtrl (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
|
||||
|
||||
@@ -451,7 +481,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGetSTSACK in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGetSTSACK {
|
||||
struct change_channelRequestStatusGetSTSACK
|
||||
{
|
||||
change_channelRequestStatusGetSTSACK (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
|
||||
|
||||
@@ -469,7 +500,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusGetClassName in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusGetClassName {
|
||||
struct change_channelRequestStatusGetClassName
|
||||
{
|
||||
change_channelRequestStatusGetClassName (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
|
||||
|
||||
@@ -486,7 +518,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelRequestStatusPut in hash table
|
||||
*/
|
||||
struct change_channelRequestStatusPut {
|
||||
struct change_channelRequestStatusPut
|
||||
{
|
||||
change_channelRequestStatusPut (const ChannelRequestStatus & new_ChannelRequestStatus):
|
||||
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
|
||||
|
||||
@@ -505,7 +538,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelTimeoutPolicyGet in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicyGet {
|
||||
struct change_channelTimeoutPolicyGet
|
||||
{
|
||||
change_channelTimeoutPolicyGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}
|
||||
|
||||
@@ -522,7 +556,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit records the channelTimeoutPolicyPut in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicyPut {
|
||||
struct change_channelTimeoutPolicyPut
|
||||
{
|
||||
change_channelTimeoutPolicyPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}
|
||||
|
||||
@@ -540,31 +575,31 @@ private:
|
||||
/**
|
||||
* Friend to Conduit permitting pvdata to be entered in queue
|
||||
*/
|
||||
struct change_dequePulseID {
|
||||
struct change_dequePulseID
|
||||
{
|
||||
change_dequePulseID (const PVDataHolder & new_pvd): new_pvd(new_pvd) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
c.dequePulseID.push_back(new_pvd);
|
||||
|
||||
if (c.dequePulseID.size() > c.mapPulseIDBufferSize) {
|
||||
if (c.dequePulseID.size() > c.mapPulseIDBufferSize)
|
||||
{
|
||||
c.dequePulseID.pop_front();
|
||||
}
|
||||
|
||||
}
|
||||
catch (std::bad_alloc &e) {
|
||||
catch (std::bad_alloc &e)
|
||||
{
|
||||
|
||||
std::cout << "change_dequeuPulseID" << " //" << e.what() << std:: endl;
|
||||
std::cout << "Critical error in change_dequeuPulseID. Force Exit" << std::endl;
|
||||
std::cout << e.what() << std:: endl;
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -576,36 +611,41 @@ private:
|
||||
/**
|
||||
* Friend to Conduit permitting pulse_id/pvdata to be set in hash table
|
||||
*/
|
||||
struct change_mapPulseID {
|
||||
struct change_mapPulseID
|
||||
{
|
||||
change_mapPulseID (const PVDataHolder & new_pvd): new_pvd(new_pvd) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
|
||||
//std::pair<unsigned long long, PVDataHolder> p = std::make_pair(new_pvd.getPulseID(), new_pvd);
|
||||
|
||||
//Check if make_pair is a success
|
||||
|
||||
c.mapPulseID.insert(std::make_pair(new_pvd.getPulseID(), new_pvd));
|
||||
|
||||
|
||||
if (c.mapPulseID.size() > c.mapPulseIDBufferSize) {
|
||||
if (c.mapPulseID.size() > c.mapPulseIDBufferSize)
|
||||
{
|
||||
|
||||
std::map<unsigned long long, PVDataHolder>::iterator pos=c.mapPulseID.begin();
|
||||
if (pos != c.mapPulseID.end()) {
|
||||
if (pos != c.mapPulseID.end())
|
||||
{
|
||||
c.mapPulseID.erase(pos);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "ITERATOR NOT FOUND in change_mapPulseID" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (std::bad_alloc &e) {
|
||||
|
||||
std::cout << "change_mapPulseID" << " //" << e.what() << std:: endl;
|
||||
catch (std::bad_alloc &e)
|
||||
{
|
||||
std::cout << "Critical error in change_mapPulseID. Force Exit" << std::endl;
|
||||
std::cout << e.what() << std:: endl;
|
||||
exit(1);
|
||||
|
||||
}
|
||||
@@ -617,26 +657,29 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting size of map<pulseID, pvdata> size to be set;
|
||||
* if new buffer size if smaller than previous, then erase excess elements
|
||||
*/
|
||||
struct change_mapPulseIDBufferSize {
|
||||
struct change_mapPulseIDBufferSize
|
||||
{
|
||||
change_mapPulseIDBufferSize (const unsigned short & new_mapPulseIDBufferSize): new_mapPulseIDBufferSize(new_mapPulseIDBufferSize) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
ipos=0;
|
||||
if (c.mapPulseIDBufferSize > new_mapPulseIDBufferSize) {
|
||||
if (c.mapPulseIDBufferSize > new_mapPulseIDBufferSize)
|
||||
{
|
||||
std::map<unsigned long long, PVDataHolder>::iterator pos;
|
||||
for (pos=c.mapPulseID.begin(); pos != c.mapPulseID.end();) {
|
||||
for (pos=c.mapPulseID.begin(); pos != c.mapPulseID.end();)
|
||||
{
|
||||
++ipos;
|
||||
if (ipos > new_mapPulseIDBufferSize) {
|
||||
if (ipos > new_mapPulseIDBufferSize)
|
||||
{
|
||||
c.mapPulseID.erase(pos++);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
@@ -654,7 +697,8 @@ private:
|
||||
* Friend to Conduit permitting fast modification to std::vector<std::string> monitorAction
|
||||
* (for CAFE Extensions)
|
||||
*/
|
||||
struct change_monitorAction {
|
||||
struct change_monitorAction
|
||||
{
|
||||
change_monitorAction (std::string &new_monitorAction): new_monitorAction(new_monitorAction) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -671,7 +715,8 @@ private:
|
||||
* Friend to Conduit permitting fast removal of all elements in std::vector<std::string> monitorAction
|
||||
* (for CAFE Extensions)
|
||||
*/
|
||||
struct change_monitorActionClear {
|
||||
struct change_monitorActionClear
|
||||
{
|
||||
change_monitorActionClear () {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -687,7 +732,8 @@ struct change_monitorActionClear {
|
||||
* Friend to Conduit permitting fast removal of an entry in std::vector<std::string> monitorAction
|
||||
* (for CAFE Extensions)
|
||||
*/
|
||||
struct change_monitorActionErase {
|
||||
struct change_monitorActionErase
|
||||
{
|
||||
change_monitorActionErase (std::string &new_monitorAction): new_monitorAction(new_monitorAction) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -696,17 +742,21 @@ struct change_monitorActionErase {
|
||||
std::vector<std::string>::iterator it;
|
||||
|
||||
|
||||
for (it = c.monitorAction.begin(); it != c.monitorAction.end(); ) {
|
||||
if( (*it)==new_monitorAction) {
|
||||
for (it = c.monitorAction.begin(); it != c.monitorAction.end(); )
|
||||
{
|
||||
if( (*it)==new_monitorAction)
|
||||
{
|
||||
it = c.monitorAction.erase(it);
|
||||
maFound=true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (!maFound) {
|
||||
if (!maFound)
|
||||
{
|
||||
std::cout << "monitorAction " << new_monitorAction << " NOT FOUND! " << std::endl;
|
||||
std::cout << "Could not delete entry!" << std::endl;
|
||||
}
|
||||
@@ -717,40 +767,93 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast removal of an entry in the monitorPolicy vector
|
||||
* Friend to Conduit permitting fast modification to monitorPolicy parameters
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyErase {
|
||||
change_monitorPolicyErase (unsigned int & new_evid): new_evid(new_evid) {}
|
||||
struct change_monitorPolicy
|
||||
{
|
||||
change_monitorPolicy (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
bool evidFound=false;
|
||||
std::vector<MonitorPolicy>::iterator it;
|
||||
bool mpidFound=false;
|
||||
|
||||
//Iterate
|
||||
for (it = c.mpV.begin(); it != c.mpV.end();) {
|
||||
for (size_t i=0; i < c.mpV.size(); ++i)
|
||||
{
|
||||
//std::cout << "ID " << (*it).getID() << " " << std::endl;
|
||||
|
||||
if ( (*it).getID()==new_evid) {
|
||||
evidFound=true;
|
||||
if (c.mpV[i].getID()==new_monitorPolicy.getID())
|
||||
{
|
||||
mpidFound=true;
|
||||
c.mpV[i] = new_monitorPolicy; //Must be a deep copy.
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!mpidFound)
|
||||
{
|
||||
std::cout << "mpid " << new_monitorPolicy.getID() << " NOT FOUND! " << std::endl;
|
||||
std::cout << "Could not modify entry!" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
class MonitorPolicy new_monitorPolicy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast removal of an entry in the monitorPolicy vector
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyErase
|
||||
{
|
||||
change_monitorPolicyErase (unsigned int & new_mpid): new_mpid(new_mpid) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
bool mpidFound=false;
|
||||
std::vector<MonitorPolicy>::iterator it;
|
||||
//Iterate
|
||||
for (it = c.mpV.begin(); it != c.mpV.end();)
|
||||
{
|
||||
//std::cout << "ID " << (*it).getID() << " " << std::endl;
|
||||
|
||||
if ( (*it).getID()==new_mpid)
|
||||
{
|
||||
mpidFound=true;
|
||||
it=(c.mpV).erase(it);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (!evidFound) {
|
||||
std::cout << "evid " << new_evid << " NOT FOUND! " << std::endl;
|
||||
if (!mpidFound)
|
||||
{
|
||||
std::cout << "mpid " << new_mpid << " NOT FOUND! " << std::endl;
|
||||
std::cout << "Could not delete entry!" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int new_evid;
|
||||
unsigned int new_mpid;
|
||||
};
|
||||
|
||||
|
||||
@@ -760,22 +863,22 @@ private:
|
||||
* Friend to Conduit permitting fast insertion into the monitorPolicy vector
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyInsert {
|
||||
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)) {
|
||||
if (c.mpV.size()>(MAX_NO_MONITORS_PER_CHANNEL/2))
|
||||
{
|
||||
std::cout << "HEY DUDE - YOU NOW HAVE " << c.mpV.size() << " MONITORS " << std::endl;
|
||||
std::cout << "for channel " << c.pv << " with handle " << c.handle << std::endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -788,32 +891,36 @@ private:
|
||||
* 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) {}
|
||||
struct change_monitorPolicyInWaitingErase
|
||||
{
|
||||
change_monitorPolicyInWaitingErase (unsigned int & new_mpid): new_mpid(new_mpid) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
bool evidFound=false;
|
||||
bool mpidFound=false;
|
||||
std::vector<MonitorPolicy>::iterator it;
|
||||
//Iterate
|
||||
for (it = c.mpInWaitingV.begin(); it != c.mpInWaitingV.end(); ++it) {
|
||||
for (it = c.mpInWaitingV.begin(); it != c.mpInWaitingV.end(); ++it)
|
||||
{
|
||||
|
||||
if ( (*it).getID()==new_evid) {
|
||||
evidFound=true;
|
||||
if ( (*it).getID()==new_mpid)
|
||||
{
|
||||
mpidFound=true;
|
||||
(c.mpInWaitingV).erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!evidFound) {
|
||||
std::cout << "evid " << new_evid << " NOT FOUND! " << std::endl;
|
||||
if (!mpidFound)
|
||||
{
|
||||
std::cout << "mpid " << new_mpid << " NOT FOUND! " << std::endl;
|
||||
std::cout << "Could not delete entry!" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int new_evid;
|
||||
unsigned int new_mpid;
|
||||
};
|
||||
|
||||
|
||||
@@ -822,7 +929,8 @@ private:
|
||||
* Friend to Conduit permitting fast insertion into the monitorPolicyInWaiting vector
|
||||
*
|
||||
*/
|
||||
struct change_monitorPolicyInWaitingInsert {
|
||||
struct change_monitorPolicyInWaitingInsert
|
||||
{
|
||||
change_monitorPolicyInWaitingInsert (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -831,7 +939,8 @@ struct change_monitorPolicyInWaitingInsert {
|
||||
//insert into mpnWaitingV
|
||||
(c.mpInWaitingV).push_back(new_monitorPolicy);
|
||||
|
||||
if (c.mpInWaitingV.size()>6) {
|
||||
if (c.mpInWaitingV.size()>4)
|
||||
{
|
||||
std::cout << "HEY DUDE - YOU NOW HAVE " << c.mpInWaitingV.size()
|
||||
<< " MONITORS IN WAITING" << std::endl;
|
||||
std::cout << "for channel " << c.pv << " with handle " << c.handle << std::endl;
|
||||
@@ -846,13 +955,11 @@ private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to pvAlias in hash table
|
||||
*/
|
||||
struct change_pvAlias {
|
||||
struct change_pvAlias
|
||||
{
|
||||
change_pvAlias (const char * & new_pvAlias): new_pvAlias(new_pvAlias) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
@@ -870,6 +977,88 @@ private:
|
||||
|
||||
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast modification to pyGetCallbackFn in hash table
|
||||
*/
|
||||
struct change_pyGetCallbackFn
|
||||
{
|
||||
change_pyGetCallbackFn (void * & new_pyGetCallbackFn): new_pyGetCallbackFn(new_pyGetCallbackFn) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
c.pyGetCallbackFn = new_pyGetCallbackFn;
|
||||
}
|
||||
|
||||
private:
|
||||
void * new_pyGetCallbackFn;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast modification to pyPutCallbackFn in hash table
|
||||
*/
|
||||
struct change_pyPutCallbackFn
|
||||
{
|
||||
change_pyPutCallbackFn (void * & new_pyPutCallbackFn): new_pyPutCallbackFn(new_pyPutCallbackFn) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
c.pyPutCallbackFn = new_pyPutCallbackFn;
|
||||
}
|
||||
|
||||
private:
|
||||
void * new_pyPutCallbackFn;
|
||||
};
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast modification to pyConnectCallbackFn in hash table
|
||||
*/
|
||||
struct change_pyConnectCallbackFn
|
||||
{
|
||||
change_pyConnectCallbackFn (void * & new_pyConnectCallbackFn): new_pyConnectCallbackFn(new_pyConnectCallbackFn) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
//c.pyConnectCallbackFn = new_pyConnectCallbackFn;
|
||||
//insert into mpV
|
||||
(c.pyConnectCallbackVector).push_back(new_pyConnectCallbackFn);
|
||||
|
||||
//for (unsigned int i=0; i < c.pyConnectCallbackVector.size(); ++i) {
|
||||
// std::cout << "change_pyConnectCallbackFn: " << i << " " << c.pyConnectCallbackVector[i] << std::endl;
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
void * new_pyConnectCallbackFn;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast modification to pyOpenCallbackFlag in hash table
|
||||
*/
|
||||
struct change_pyOpenCallbackFlag
|
||||
{
|
||||
change_pyOpenCallbackFlag (bool & new_pyOpenCallbackFlag): new_pyOpenCallbackFlag(new_pyOpenCallbackFlag) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
c.pyOpenCallbackFlag = new_pyOpenCallbackFlag;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
bool new_pyOpenCallbackFlag;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting pyCafeFlag flag to be set in hash table
|
||||
*
|
||||
@@ -888,7 +1077,8 @@ private:
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to the status as given by the last method invocation
|
||||
*/
|
||||
struct change_status {
|
||||
struct change_status
|
||||
{
|
||||
change_status (const int & new_status): new_status(new_status) {}
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
@@ -906,52 +1096,159 @@ private:
|
||||
/**
|
||||
* Friend to Conduit permitting associated alarm Severity levels together with channel description to be entered into container
|
||||
*/
|
||||
struct change_supplementHandle {
|
||||
struct change_supplementHandle
|
||||
{
|
||||
change_supplementHandle (const alarmSeverityStruct & new_alarmSeverity, const std::string & new_desc): new_alarmSeverity(new_alarmSeverity), new_desc(new_desc) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
c.aSevStruct.hhsv=new_alarmSeverity.hhsv;
|
||||
c.aSevStruct.hsv=new_alarmSeverity.hsv;
|
||||
c.aSevStruct.lsv=new_alarmSeverity.lsv;
|
||||
c.aSevStruct.llsv=new_alarmSeverity.llsv;
|
||||
c.desc=new_desc;
|
||||
c.hasDesc=true;
|
||||
c.hasAlarmSevStruct=true;
|
||||
|
||||
c.aSevStruct.hhsv=new_alarmSeverity.hhsv;
|
||||
c.aSevStruct.hsv=new_alarmSeverity.hsv;
|
||||
c.aSevStruct.lsv=new_alarmSeverity.lsv;
|
||||
c.aSevStruct.llsv=new_alarmSeverity.llsv;
|
||||
c.desc=new_desc;
|
||||
c.hasDesc=true;
|
||||
c.hasAlarmSevStruct=true;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
alarmSeverityStruct new_alarmSeverity;
|
||||
std::string new_desc;
|
||||
std::string new_desc;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting associated alarm Severity levels together with channel description to be entered into container
|
||||
*/
|
||||
struct change_supplementAlarmSeverity
|
||||
{
|
||||
change_supplementAlarmSeverity (const alarmSeverityStruct & new_alarmSeverity): new_alarmSeverity(new_alarmSeverity) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
c.aSevStruct.hhsv=new_alarmSeverity.hhsv;
|
||||
c.aSevStruct.hsv=new_alarmSeverity.hsv;
|
||||
c.aSevStruct.lsv=new_alarmSeverity.lsv;
|
||||
c.aSevStruct.llsv=new_alarmSeverity.llsv;
|
||||
c.hasAlarmSevStruct=true;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
alarmSeverityStruct new_alarmSeverity;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting associated alarm channel description to be entered into container
|
||||
*/
|
||||
struct change_supplementDescription
|
||||
{
|
||||
change_supplementDescription (const std::string & new_desc): new_desc(new_desc) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
c.desc=new_desc;
|
||||
c.hasDesc=true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string new_desc;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Friend to Conduit/CAFEGroup permitting fast modification to the usrArgs as given by the last method invocation
|
||||
*/
|
||||
struct change_usrArgs {
|
||||
struct change_usrArgs
|
||||
{
|
||||
change_usrArgs (const unsigned int & new_usrArgs): new_usrArgs(new_usrArgs) {}
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
c.usrArgs = (void *) (unsigned long) new_usrArgs; // APRIL2018 - added to remove C++11 compiler warning
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
unsigned int new_usrArgs;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* friend to Conduit/CAFEGroup permitting the groupHandle to which the channel belongs to be recorded in hash table
|
||||
* Friend to Conduit permitting fast removal of an entry in the widgetV vector
|
||||
*
|
||||
*/
|
||||
struct change_groupHandle {
|
||||
struct change_widgetErase
|
||||
{
|
||||
change_widgetErase (void * & new_widget): new_widget(new_widget) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
bool widgetFound=false;
|
||||
std::vector<void *>::iterator it;
|
||||
//Iterate
|
||||
for (it = c.widgetV.begin(); it != c.widgetV.end(); ++it)
|
||||
{
|
||||
if ( (*it)==new_widget)
|
||||
{
|
||||
widgetFound=true;
|
||||
(c.widgetV).erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!widgetFound)
|
||||
{
|
||||
std::cout << "widget " << new_widget << " NOT FOUND! " << std::endl;
|
||||
std::cout << "Could not delete entry from std::vector widgetV!" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void * new_widget;
|
||||
};
|
||||
|
||||
/**
|
||||
* Friend to Conduit permitting fast insertion into the monitorPolicyInWaiting vector
|
||||
*
|
||||
*/
|
||||
struct change_widgetInsert
|
||||
{
|
||||
change_widgetInsert (void * & new_widget): new_widget(new_widget) {}
|
||||
|
||||
void operator() (Conduit& c)
|
||||
{
|
||||
|
||||
//insert into widgetV
|
||||
(c.widgetV).push_back((void *)new_widget);
|
||||
/*
|
||||
std::vector<void *>::iterator it;
|
||||
//Iterate
|
||||
for (it = c.widgetV.begin(); it != c.widgetV.end(); ++it) {
|
||||
|
||||
std::cout << "widget in change " << (*it) << std::endl;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
void * new_widget;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
* \param _memberCC CAFEConduit object representing each group member
|
||||
* \param _groupStatus groupStatus: error indicates >0 members have an error
|
||||
*/
|
||||
class ConduitGroup {
|
||||
class ConduitGroup
|
||||
{
|
||||
friend struct change_channelTimeoutPolicySGPut;
|
||||
friend struct change_channelTimeoutPolicySGGet;
|
||||
friend struct change_timeout_sg_pend_io;
|
||||
@@ -122,7 +123,8 @@ public:
|
||||
* 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 {
|
||||
struct change_sg_rule
|
||||
{
|
||||
change_sg_rule (const bool & new_rule, const unsigned int & iMember):
|
||||
new_rule(new_rule),iMember(iMember) {}
|
||||
|
||||
@@ -140,7 +142,8 @@ private:
|
||||
/**
|
||||
* Friend to ConduitGroup permitting fast modification of status in group hash table;
|
||||
*/
|
||||
struct change_sg_status {
|
||||
struct change_sg_status
|
||||
{
|
||||
change_sg_status (const int & new_status, const unsigned int & iMember):
|
||||
new_status(new_status),iMember(iMember) {}
|
||||
|
||||
@@ -158,7 +161,8 @@ private:
|
||||
* 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 {
|
||||
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)
|
||||
@@ -174,7 +178,8 @@ private:
|
||||
/**
|
||||
* Friend to ConduitGroup records the channelTimeoutPolicySGGet in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicySGGet {
|
||||
struct change_channelTimeoutPolicySGGet
|
||||
{
|
||||
change_channelTimeoutPolicySGGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}
|
||||
|
||||
@@ -191,7 +196,8 @@ private:
|
||||
/**
|
||||
* Friend to ConduitGroup records the channelTimeoutPolicySGPut in hash table
|
||||
*/
|
||||
struct change_channelTimeoutPolicySGPut {
|
||||
struct change_channelTimeoutPolicySGPut
|
||||
{
|
||||
change_channelTimeoutPolicySGPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
|
||||
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
|
||||
|
||||
|
||||
class Connect {
|
||||
class Connect
|
||||
{
|
||||
protected:
|
||||
int status;
|
||||
CAFEStatus cafeStatus;
|
||||
@@ -68,10 +69,9 @@ protected:
|
||||
static void callbackHandlerException (struct exception_handler_args args);
|
||||
|
||||
//connect.cpp
|
||||
//int createHandle(const char * pv, ca_client_context * ccc, ChannelRequestPolicy channelRequestPolicyPut, unsigned int &handle)
|
||||
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 createHandle(const char * pv, ca_client_context * ccc, unsigned int &handle) noexcept(false); // throw (CAFEException_pv);
|
||||
|
||||
int contextDestroy();
|
||||
int contextDestroy(ca_client_context * cctLocal);
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
|
||||
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);
|
||||
noexcept(false); //throw (CAFEException_pv);
|
||||
|
||||
public:
|
||||
|
||||
@@ -212,11 +212,26 @@ public:
|
||||
}
|
||||
int _ca_pend_io(double t)
|
||||
{
|
||||
return ca_pend_io(t);
|
||||
double _t=DEFAULT_TIMEOUT_PEND_IO;
|
||||
if (t<=0)
|
||||
{
|
||||
_t=0.4;
|
||||
std::cout << "Illegal timeout value: " << t << " for _ca_pend_io(timeout) "<< std::endl;
|
||||
std::cout << "Setting timeout to default value of " << _t << " seconds" << std::endl;
|
||||
|
||||
}
|
||||
return ca_pend_io(_t); //returns ECA_TIMEOUT if successful
|
||||
}
|
||||
int _ca_pend_event(double t)
|
||||
{
|
||||
return ca_pend_event(t);
|
||||
double _t=t;
|
||||
if (t<=0)
|
||||
{
|
||||
_t=DEFAULT_TIMEOUT_PEND_EVENT;
|
||||
std::cout << "Illegal timeout value: " << t << " for _ca_pend_event(timeout) "<< std::endl;
|
||||
std::cout << "Setting timeout to default vallue of " << _t << std::endl;
|
||||
}
|
||||
return ca_pend_event(_t); //returns ECA_TIMEOUT if successful
|
||||
}
|
||||
|
||||
//connect.cc
|
||||
@@ -224,48 +239,51 @@ public:
|
||||
{
|
||||
return pyCafeFlag=b;
|
||||
};
|
||||
|
||||
bool getPyCafe()
|
||||
{
|
||||
return pyCafeFlag;
|
||||
} ;
|
||||
int init() throw (CAFEException_init);
|
||||
int init(ca_preemptive_callback_select select) throw (CAFEException_init);
|
||||
};
|
||||
|
||||
int init() noexcept(false); // throw (CAFEException_init);
|
||||
int init(ca_preemptive_callback_select select) noexcept(false); // throw (CAFEException_init);
|
||||
|
||||
//std::string
|
||||
int open(const std::string pvS, unsigned int &handle) throw (CAFEException_open)
|
||||
int open(const std::string pvS, unsigned int &handle) noexcept(false) // throw (CAFEException_open)
|
||||
{
|
||||
|
||||
try {
|
||||
open (pvS.c_str(), handle);
|
||||
try
|
||||
{
|
||||
return open (pvS.c_str(), handle);
|
||||
}
|
||||
catch(CAFEException_open &e) {
|
||||
catch(CAFEException_open &e)
|
||||
{
|
||||
throw e;
|
||||
};
|
||||
}
|
||||
int open(const std::string pvS, const std::string pvAliasS, unsigned int &handle)
|
||||
throw (CAFEException_open)
|
||||
int open(const std::string pvS, const std::string pvAliasS, unsigned int &handle)
|
||||
noexcept(false) // throw (CAFEException_open)
|
||||
{
|
||||
try {
|
||||
open (pvS.c_str(), pvAliasS.c_str(), handle);
|
||||
try
|
||||
{
|
||||
return open (pvS.c_str(), pvAliasS.c_str(), handle);
|
||||
}
|
||||
catch(CAFEException_open &e) {
|
||||
catch(CAFEException_open &e)
|
||||
{
|
||||
throw e;
|
||||
};
|
||||
}
|
||||
int open(const std::string *pvArrayS, unsigned int *handleArray, const unsigned int nHandles)
|
||||
throw (CAFEException_open);
|
||||
int open(const std::string *pvArrayS, unsigned int *handleArray, const unsigned int nHandles) noexcept(false); // 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 *pv, unsigned int &handle) noexcept(false); // throw (CAFEException_open);
|
||||
int open(const char *pv, const char *pvAlias, unsigned int &handle) noexcept(false); // throw (CAFEException_open);
|
||||
|
||||
int open(const char **pvArray, unsigned int *handleArray, const unsigned int nHandles)
|
||||
throw (CAFEException_open);
|
||||
int open(std::vector<const char *>, std::vector<unsigned int> &) throw (CAFEException_open);
|
||||
int open(std::vector<std::string>, std::vector<unsigned int> &) throw (CAFEException_open);
|
||||
noexcept(false); // throw (CAFEException_open);
|
||||
int open(std::vector<const char *>, std::vector<unsigned int> &) noexcept(false); // throw (CAFEException_open);
|
||||
int open(std::vector<std::string>, std::vector<unsigned int> &) noexcept(false); // throw (CAFEException_open);
|
||||
|
||||
int openV(std::vector<std::string> s, std::vector<unsigned int> &i) throw (CAFEException_open)
|
||||
int openV(std::vector<std::string> s, std::vector<unsigned int> &i) noexcept(false) // throw (CAFEException_open)
|
||||
{
|
||||
return open(s,i);
|
||||
};
|
||||
@@ -382,6 +400,10 @@ public:
|
||||
//Pends for a maximimum of timeout seconds
|
||||
void openNowAndWait(double _timeout);
|
||||
|
||||
//Pends for a maximimum of timeout seconds
|
||||
void openNowAndWaitHandles(unsigned int * handleArray, unsigned int nHandles, double _timeout);
|
||||
//Pends for a maximimum of timeout seconds
|
||||
void openNowAndWaitHandleV(std::vector<unsigned int> handleV, double _timeout);
|
||||
|
||||
//Pends for default amount of time
|
||||
void openNow()
|
||||
@@ -396,6 +418,24 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Pends for default amount of time
|
||||
void openNowHandles(unsigned int * handleArray, unsigned int nHandles)
|
||||
{
|
||||
openNowAndWaitHandles(handleArray, nHandles, channelOpenPolicy.getTimeout());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Pends for default amount of time
|
||||
void openNowHandleV(std::vector<unsigned int> handleV)
|
||||
{
|
||||
openNowAndWaitHandleV(handleV, channelOpenPolicy.getTimeout());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -406,6 +446,17 @@ public:
|
||||
|
||||
bool initCallbackComplete(unsigned int * hArray, unsigned int nelem);
|
||||
|
||||
bool initCallbackCompleteV(std::vector<unsigned int> hV)
|
||||
{
|
||||
return initCallbackComplete(&hV[0], hV.size());
|
||||
}
|
||||
|
||||
bool initCallbackCompleteHandle(unsigned int handle)
|
||||
{
|
||||
unsigned int hArray[1];
|
||||
hArray[0]=handle;
|
||||
return initCallbackComplete(hArray, 1);
|
||||
}
|
||||
|
||||
|
||||
//#################################################################################
|
||||
@@ -453,7 +504,7 @@ public:
|
||||
//return status;
|
||||
return closeChannels(&v[0], v.size());
|
||||
};
|
||||
|
||||
|
||||
|
||||
int close(unsigned int handle);
|
||||
int closeChannel(unsigned int handle)
|
||||
@@ -493,6 +544,29 @@ public:
|
||||
{
|
||||
return closeChannelsKeepHandles(&v[0], v.size());
|
||||
}
|
||||
int openChannelsWithHandles(unsigned int * handleArray, unsigned int nHandles);
|
||||
int openChannelsWithHandlesV(std::vector<unsigned int> v)
|
||||
{
|
||||
return openChannelsWithHandles(&v[0], v.size());
|
||||
}
|
||||
int openChannelsWithHandles (std::vector<unsigned int> v)
|
||||
{
|
||||
return openChannelsWithHandles(&v[0], v.size());
|
||||
}
|
||||
int reconnect(std::vector<unsigned int> v)
|
||||
{
|
||||
int status1 = closeChannelsKeepHandles(&v[0], v.size());
|
||||
|
||||
openPrepare();
|
||||
int status2 = openChannelsWithHandles(&v[0], v.size());
|
||||
openNowAndWaitHandles(&v[0], v.size(), channelOpenPolicy.getTimeout());
|
||||
|
||||
if (status1 > status2) {
|
||||
return status1;
|
||||
}
|
||||
return status2;
|
||||
}
|
||||
|
||||
|
||||
// Monitors
|
||||
int monitorStart(unsigned int handle, MonitorPolicy &mp);
|
||||
@@ -584,8 +658,10 @@ public:
|
||||
|
||||
bool isValid(unsigned int handle)
|
||||
{
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
if ((*itcs).getHandle()==handle) {
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
|
||||
{
|
||||
if ((*itcs).getHandle()==handle)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -594,8 +670,10 @@ public:
|
||||
|
||||
bool allChannelsConnected()
|
||||
{
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
if (!(*itcs).isConnected()) {
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
|
||||
{
|
||||
if (!(*itcs).isConnected())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -612,41 +690,47 @@ public:
|
||||
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 != handle_index.end())
|
||||
{
|
||||
return (*it_handle).isConnected();
|
||||
}
|
||||
else {
|
||||
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()) {
|
||||
if (it_handle != handle_index.end())
|
||||
{
|
||||
channelInfo=(*it_handle).getChannelRegalia();
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
else {
|
||||
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()) {
|
||||
if (it_handle != handle_index.end())
|
||||
{
|
||||
return (*it_handle).getChannelID();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
@@ -665,10 +749,12 @@ public:
|
||||
|
||||
int attachContext(ca_client_context *ccc)
|
||||
{
|
||||
if (ccc != NULL) {
|
||||
if (ccc != NULL)
|
||||
{
|
||||
return ca_attach_context(ccc);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return ECAFE_NULLCONTEXT;
|
||||
}
|
||||
}
|
||||
@@ -676,10 +762,12 @@ public:
|
||||
int attachContextByPVName(const char * pvname)
|
||||
{
|
||||
ca_client_context * ccc=getClientContext(pvname);
|
||||
if (ccc != NULL) {
|
||||
if (ccc != NULL)
|
||||
{
|
||||
return ca_attach_context(ccc);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return ECAFE_NULLCONTEXT;
|
||||
}
|
||||
}
|
||||
@@ -687,10 +775,12 @@ public:
|
||||
int attachContextByHandle(unsigned int handle)
|
||||
{
|
||||
ca_client_context * ccc=getClientContext(handle);
|
||||
if (ccc != NULL) {
|
||||
if (ccc != NULL)
|
||||
{
|
||||
return ca_attach_context(ccc);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return ECAFE_NULLCONTEXT;
|
||||
}
|
||||
}
|
||||
@@ -701,20 +791,25 @@ public:
|
||||
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 != handle_index.end())
|
||||
{
|
||||
|
||||
if ( (*it_handle).getAccessRead() != ar ) {
|
||||
if(MUTEX) {
|
||||
if ( (*it_handle).getAccessRead() != ar )
|
||||
{
|
||||
if(MUTEX)
|
||||
{
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_accessRead(ar));
|
||||
if(MUTEX) {
|
||||
if(MUTEX)
|
||||
{
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
}
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
@@ -725,19 +820,24 @@ public:
|
||||
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) {
|
||||
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) {
|
||||
if(MUTEX)
|
||||
{
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
}
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
@@ -748,10 +848,12 @@ public:
|
||||
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 != handle_index.end())
|
||||
{
|
||||
return (bool) (*it_handle).getAccessRead();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -762,10 +864,12 @@ public:
|
||||
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 != handle_index.end())
|
||||
{
|
||||
return (bool) (*it_handle).getAccessWrite();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -794,7 +898,7 @@ public:
|
||||
int printStatus(std::vector<std::string> pvV, std::vector<int> statusV);
|
||||
int printStatusIfError(std::vector<std::string> pvV, std::vector<int> statusV);
|
||||
|
||||
int setPVAlias(unsigned int handle, const char * pv) throw (CAFEException_open);
|
||||
int setPVAlias(unsigned int handle, const char * pv) noexcept(false); // throw (CAFEException_open);
|
||||
|
||||
// GROUP FUNCTIONS
|
||||
|
||||
@@ -833,11 +937,27 @@ public:
|
||||
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 groupOpen(const char *pv, unsigned int &groupHandle) noexcept(false); // throw (CAFEException_groupOpen);
|
||||
int groupOpen(PVGroup &pvgroup, unsigned int &groupHandle) noexcept(false); // throw (CAFEException_groupOpen);
|
||||
|
||||
int groupOpenWithHandles(unsigned int groupHandle);
|
||||
|
||||
|
||||
int groupClose(unsigned int groupHandle, bool keepGroupName) {
|
||||
return Connect::groupClose(groupHandle, keepGroupName, false);
|
||||
}
|
||||
|
||||
int groupClose(unsigned int groupHandle)
|
||||
{
|
||||
return Connect::groupClose(groupHandle, false, false);
|
||||
};
|
||||
|
||||
int groupCloseKeepName(unsigned int groupHandle, bool keepGroupName) {
|
||||
return Connect::groupClose(groupHandle, keepGroupName, false);
|
||||
}
|
||||
|
||||
int groupClose(unsigned int groupHandle, bool keepGroupName, bool keepHandles);
|
||||
|
||||
int groupClose(unsigned int groupHandle);
|
||||
int groupClose();
|
||||
int groupCloseAll()
|
||||
{
|
||||
@@ -858,6 +978,9 @@ public:
|
||||
|
||||
std::vector<std::string> getFromGlobalChannelList(std::vector<std::string>);
|
||||
|
||||
int groupDefineFromCollection (const char * groupName, const char * collectionName, std::vector<std::string> attributeV) {
|
||||
return groupDefine (groupName, collectionName, attributeV);
|
||||
}
|
||||
|
||||
int groupDefine (const char * groupName, const char * collectionName, std::vector<std::string> attributeV);
|
||||
int groupDefine (const char * groupName, const char * collectionName, std::vector<const char*> attributeV);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <cadef.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#define EV EPICSVERSION(HAVE_EPICS)
|
||||
|
||||
#if (EPICS_MAJOR==3) && (EPICS_MINOR==14) && (EPICS_PATCH>=11)
|
||||
@@ -27,14 +26,16 @@ const unsigned short ALARM_STATUS_STRING_LENGTH = 22; // "NO_ALARM","READ","WR
|
||||
//"HIHI","HIGH","LOLO","LOW","STATE","COS","COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
|
||||
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS","WRITE_ACCESS"
|
||||
|
||||
struct alarmSeverityStruct {
|
||||
struct alarmSeverityStruct
|
||||
{
|
||||
short llsv;
|
||||
short lsv;
|
||||
short hsv;
|
||||
short hhsv;
|
||||
short lsv;
|
||||
short hsv;
|
||||
short hhsv;
|
||||
};
|
||||
|
||||
struct etsDatePrevious {
|
||||
struct etsDatePrevious
|
||||
{
|
||||
int year;
|
||||
int mon;
|
||||
int day;
|
||||
@@ -44,7 +45,8 @@ struct etsDatePrevious {
|
||||
unsigned long nsec;
|
||||
};
|
||||
|
||||
struct etsDate {
|
||||
struct etsDate
|
||||
{
|
||||
int year;
|
||||
int mon;
|
||||
int day;
|
||||
@@ -52,12 +54,13 @@ struct etsDate {
|
||||
int min;
|
||||
int sec;
|
||||
unsigned long nsec;
|
||||
int wday;
|
||||
int yday;
|
||||
int isdst;
|
||||
int wday;
|
||||
int yday;
|
||||
int isdst;
|
||||
};
|
||||
|
||||
struct etsNorm {
|
||||
struct etsNorm
|
||||
{
|
||||
unsigned int secPastEpoch;
|
||||
unsigned int nsec;
|
||||
};
|
||||
@@ -103,24 +106,28 @@ 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;
|
||||
const unsigned int MAX_NELEM_FOR_CTRL_BUFFER = 256; //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_CTRL_BUFFER = 1; //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.
|
||||
|
||||
const std::string SYNCHRONOUS_GROUP_NAME_IN_BSDATAHOLDER = "gBS2CA";
|
||||
|
||||
const std::string INVALID_ENUM_RETURN_STRING = "invalid_enum_value";
|
||||
const short INVALID_ENUM_RETURN_VALUE = -1;
|
||||
|
||||
//For BSREAD
|
||||
const double BSREAD_MAX_CONNECT_TIME = 20; //20 seconds; typically 10 seconds is required
|
||||
const double BSREAD_MAX_CONNECT_TIME = 15; //seconds; typically 10 seconds is required
|
||||
const unsigned short BSREAD_ZEROMQ_HIGH_WATER_MARK = 1;
|
||||
const short BSREAD_ZEROMQ_TIMEOUT_MS = 2000; //Can handle 10 Hz // -1 wait for ever
|
||||
|
||||
const unsigned short BSREAD_PREBLOB_BYTES = 12; //No of bytes pre-pending the binary blob with metadata
|
||||
|
||||
const std::string SF_PULSE_ID_PV = "SIN-TIMAST-EVG0:TX-PULSEID";
|
||||
const unsigned short SF_PULSE_ID_BUFFER_SIZE = 10; //Size of map to store history of pulseIDs;
|
||||
const unsigned short SF_PULSE_ID_BUFFER_SIZE = 100; //Size of map to store history of pulseIDs;
|
||||
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
#include <cstring>
|
||||
#include <helper.h>
|
||||
|
||||
class collectionMember {
|
||||
class collectionMember
|
||||
{
|
||||
public:
|
||||
collectionMember():deviceName(""),devicePosition(0) {};
|
||||
virtual ~collectionMember() {};
|
||||
@@ -22,7 +23,8 @@ public:
|
||||
float devicePosition;
|
||||
};
|
||||
|
||||
class deviceCollection {
|
||||
class deviceCollection
|
||||
{
|
||||
friend class Connect;
|
||||
friend class CAFE;
|
||||
//if HAVE_LIBQTXML
|
||||
@@ -61,7 +63,8 @@ public:
|
||||
std::vector<float> posV;
|
||||
posV.clear();
|
||||
posV.reserve(cMembers.size());
|
||||
for (size_t i=0; i<cMembers.size(); ++i) {
|
||||
for (size_t i=0; i<cMembers.size(); ++i)
|
||||
{
|
||||
posV.push_back(cMembers[i].devicePosition);
|
||||
};
|
||||
return posV;
|
||||
@@ -70,8 +73,10 @@ public:
|
||||
{
|
||||
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) {
|
||||
for (size_t i=0; i<cMembers.size(); ++i)
|
||||
{
|
||||
if(strcmp(cMembers[i].deviceName.c_str(),_c)==0)
|
||||
{
|
||||
return cMembers[i].devicePosition;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +90,8 @@ public:
|
||||
std::vector<std::string> memberV;
|
||||
memberV.clear();
|
||||
memberV.reserve(cMembers.size());
|
||||
for (size_t i=0; i<cMembers.size(); ++i) {
|
||||
for (size_t i=0; i<cMembers.size(); ++i)
|
||||
{
|
||||
memberV.push_back(cMembers[i].deviceName);
|
||||
};
|
||||
return memberV;
|
||||
@@ -102,7 +108,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class collectionInGroup {
|
||||
class collectionInGroup
|
||||
{
|
||||
//friend class loadGroupXMLParser;
|
||||
public:
|
||||
collectionInGroup() {};
|
||||
@@ -111,7 +118,8 @@ public:
|
||||
std::string attrib;
|
||||
};
|
||||
|
||||
class deviceGroup {
|
||||
class deviceGroup
|
||||
{
|
||||
//if HAVE_LIBQTXML
|
||||
friend class loadGroupXMLParser;
|
||||
//endif
|
||||
|
||||
@@ -19,18 +19,21 @@
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct enumStrings {
|
||||
struct enumStrings
|
||||
{
|
||||
static char const* data[];
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct enumRefHolder {
|
||||
struct enumRefHolder
|
||||
{
|
||||
T& enumVal;
|
||||
enumRefHolder(T& enumVal): enumVal(enumVal) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct enumConstRefHolder {
|
||||
struct enumConstRefHolder
|
||||
{
|
||||
T const& enumVal;
|
||||
enumConstRefHolder(T const& enumVal): enumVal(enumVal) {}
|
||||
};
|
||||
@@ -40,10 +43,12 @@ inline std::ostream& operator<<(std::ostream& str, enumConstRefHolder<T> const&
|
||||
{
|
||||
//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) {
|
||||
if ( boost::size( enumStrings<T>::data) > (unsigned int) data.enumVal)
|
||||
{
|
||||
return str << enumStrings<T>::data[data.enumVal];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return str << "ERROR: enumStrings.h reports data.enumVal= " << data.enumVal
|
||||
<< " DOES NOT HAVE A STRING EQUIVALENT!";
|
||||
}
|
||||
@@ -65,14 +70,16 @@ inline std::istream& operator>>(std::istream& str, enumRefHolder<T> const& data)
|
||||
//if (find != end)
|
||||
|
||||
if ( std::find( boost::begin(enumStrings<T>::data), boost::end( enumStrings<T>::data), value) !=
|
||||
boost::end( enumStrings<T>::data)) {
|
||||
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) ) {
|
||||
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;
|
||||
|
||||
@@ -10,22 +10,24 @@
|
||||
|
||||
#include <exception>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <defines.h>
|
||||
#include <cafeDataType.h>
|
||||
|
||||
/**
|
||||
* The CAFEException_pv struct for pv error reporting
|
||||
*/
|
||||
struct CAFEException_pv {
|
||||
struct CAFEException_pv
|
||||
{
|
||||
char pv [PVNAME_SIZE];
|
||||
char pvAlias[PVNAME_SIZE];
|
||||
unsigned int handle;
|
||||
CAFE_DATATYPE dataTypeNative;
|
||||
const char * dataTypeNativeText;
|
||||
std::string dataTypeNativeText;
|
||||
int statusCode;
|
||||
const char * statusCodeText;
|
||||
const char * statusMessage;
|
||||
const char * source;
|
||||
std::string statusCodeText;
|
||||
std::string statusMessage;
|
||||
std::string source;
|
||||
unsigned int ln;
|
||||
};
|
||||
|
||||
@@ -33,13 +35,14 @@ struct CAFEException_pv {
|
||||
/**
|
||||
* The CAFEException_group struct for group error reporting
|
||||
*/
|
||||
struct CAFEException_group {
|
||||
struct CAFEException_group
|
||||
{
|
||||
char groupName [PVNAME_SIZE];
|
||||
unsigned int groupHandle;
|
||||
int statusCode;
|
||||
const char * statusCodeText;
|
||||
const char * statusMessage;
|
||||
const char * source;
|
||||
std::string statusCodeText;
|
||||
std::string statusMessage;
|
||||
std::string source;
|
||||
unsigned int ln;
|
||||
};
|
||||
|
||||
@@ -47,24 +50,49 @@ struct CAFEException_group {
|
||||
/**
|
||||
* The CAFEException_open class for ca open error reporting
|
||||
*/
|
||||
class CAFEException_open : public std::exception {
|
||||
class CAFEException_open : public std::exception
|
||||
{
|
||||
private:
|
||||
std::string ewhat;
|
||||
|
||||
public:
|
||||
CAFEException_open() {
|
||||
ewhat = "CAFEException_Open exception: Could not establish link to pv";
|
||||
};
|
||||
CAFEException_open(std::string _ewhat) {
|
||||
ewhat = _ewhat;
|
||||
};
|
||||
|
||||
CAFEException_pv pvEx;
|
||||
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "CAFEException_open exception: Could not establish link to pv";
|
||||
return ewhat.c_str();
|
||||
};
|
||||
|
||||
CAFEException_pv pvEx;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* The CAFEException_groupOpen class for ca group open error reporting
|
||||
*/
|
||||
class CAFEException_groupOpen : public std::exception {
|
||||
class CAFEException_groupOpen : public std::exception
|
||||
{
|
||||
private:
|
||||
std::string ewhat;
|
||||
|
||||
public:
|
||||
CAFEException_groupOpen() {
|
||||
ewhat = "CAFEException_groupOpen exception: Could not establish link to group";
|
||||
};
|
||||
|
||||
CAFEException_groupOpen(std::string _ewhat) {
|
||||
ewhat = _ewhat;
|
||||
};
|
||||
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "CAFEException_groupOpen exception: Could not establish link to group";
|
||||
return ewhat.c_str();
|
||||
};
|
||||
|
||||
CAFEException_group groupEx;
|
||||
@@ -74,11 +102,12 @@ public:
|
||||
/**
|
||||
* The CAFEException_init
|
||||
*/
|
||||
class CAFEException_init: public std::exception {
|
||||
class CAFEException_init: public std::exception
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "CAFEException_init exception: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create";
|
||||
return "CAFEException_init: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -86,7 +115,8 @@ public:
|
||||
/**
|
||||
* The CAFEException_allocBufferMem
|
||||
*/
|
||||
class CAFEException_allocBufferMem: public std::exception {
|
||||
class CAFEException_allocBufferMem: public std::exception
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
|
||||
@@ -12,20 +12,22 @@
|
||||
#include <statusCodes.h>
|
||||
#include <defines.h>
|
||||
|
||||
class ExceptionsHelper {
|
||||
class ExceptionsHelper
|
||||
{
|
||||
private:
|
||||
CAFEDataTypeCode cafeDataTypeCode;
|
||||
CAFEStatus cafeStatus;
|
||||
public:
|
||||
CAFEException_pv prepareCAFEException_pv(const char *pv, const char *pvAlias,
|
||||
CAFEException_pv prepareCAFEException_pv(
|
||||
const char pv[PVNAME_SIZE], const char pvAlias[PVNAME_SIZE],
|
||||
unsigned int handle, chid pCh, int status,
|
||||
const char * source, unsigned int ln);
|
||||
std::string source, unsigned int ln);
|
||||
|
||||
CAFEException_group prepareCAFEException_group(
|
||||
char groupName [PVNAME_SIZE],
|
||||
const char groupName [PVNAME_SIZE],
|
||||
unsigned int groupHandle,
|
||||
int statusCode,
|
||||
const char * source,
|
||||
std::string source,
|
||||
unsigned int ln);
|
||||
|
||||
ExceptionsHelper(void) {};
|
||||
|
||||
@@ -40,7 +40,7 @@ extern unsigned long nCBs;
|
||||
|
||||
extern bool callbackLiveFlag;
|
||||
|
||||
extern bool SF_WITH_PULSE_ID;
|
||||
extern bool SF_WITH_PULSE_ID;
|
||||
|
||||
|
||||
#endif // GLOBAL_H
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
|
||||
|
||||
class Granules {
|
||||
class Granules
|
||||
{
|
||||
public:
|
||||
|
||||
template <class CTYPE> friend class Instant;
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#include <tmDateMap.h>
|
||||
|
||||
|
||||
class HandleHelper : public Helper {
|
||||
class HandleHelper : public Helper
|
||||
{
|
||||
|
||||
private:
|
||||
CAFEStatus cafeStatus;
|
||||
@@ -40,12 +41,6 @@ private:
|
||||
|
||||
PrintErrorPolicy printErrorPolicy;
|
||||
|
||||
// now in defines.h
|
||||
//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() {};
|
||||
@@ -60,6 +55,15 @@ public:
|
||||
TMwdayText tmDay;
|
||||
TMmonthpText tmMonth;
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
int setPyConnectCallbackFn(unsigned int _handle, void * callbackFn);
|
||||
int setPyGetCallbackFn(unsigned int _handle, void * callbackFn);
|
||||
int setPyPutCallbackFn(unsigned int _handle, void * callbackFn);
|
||||
#endif
|
||||
int addWidget (unsigned int _handle, void * widget);
|
||||
int removeWidget (unsigned int _handle, void * widget);
|
||||
int getWidgets(unsigned int _handle, std::vector<void *> & widgetV);
|
||||
|
||||
int checkConsistency();
|
||||
int checkConsistency(unsigned int _handle);
|
||||
|
||||
@@ -110,7 +114,7 @@ public:
|
||||
int getTimeStamp(unsigned int h, epicsTimeStamp &ts);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
etsNorm getEpicsTimeStampAsUInt32(unsigned int h)
|
||||
@@ -213,7 +217,8 @@ public:
|
||||
}
|
||||
|
||||
|
||||
std::string etsDateAsString(etsNorm ts) {
|
||||
std::string etsDateAsString(etsNorm ts)
|
||||
{
|
||||
|
||||
time_t t= ts.secPastEpoch;
|
||||
|
||||
@@ -232,12 +237,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
//Deprecated!!!
|
||||
//Deprecated!!!
|
||||
int getPulseID(unsigned int h, unsigned int &pulseID)
|
||||
{
|
||||
epicsTimeStamp ts;
|
||||
int status=getTimeStamp(h, ts);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
std::string nsS = static_cast<std::ostringstream*>( &(std::ostringstream() << ts.nsec) )->str();
|
||||
int l=nsS.length();
|
||||
int startPos=std::max(l-6,0);
|
||||
@@ -258,22 +264,26 @@ public:
|
||||
return pulseID;
|
||||
}
|
||||
|
||||
bool hasAlarmStatusSeverity(unsigned int h);
|
||||
bool hasAlarmStatusSeverity(unsigned int h);
|
||||
int getAlarmStatusSeverity(unsigned int h, dbr_short_t as[2]);
|
||||
int getAlarmStatusSeverityAsString(unsigned int h, std::string asas[2]);
|
||||
unsigned int getNoHandles();
|
||||
unsigned int getNextFreeHandle();
|
||||
|
||||
bool hasDescription(unsigned int _handle);
|
||||
|
||||
int getDescription(unsigned int _handle, std::string & desc);
|
||||
int getUnits (unsigned int h, std::string & units);
|
||||
int getPrecision(unsigned int h, short &precision);
|
||||
int getPrecision(unsigned int h, short &precision);
|
||||
|
||||
|
||||
bool isChannelConnected(unsigned int handle);
|
||||
bool allChannelsConnected();
|
||||
bool areChannelsConnected(unsigned int * handleArray, const unsigned int nHandles);
|
||||
bool areChannelsConnectedV(std::vector<unsigned int>);
|
||||
bool allChannelsWithinGroupConnected();
|
||||
bool allChannelsWithinGroupConnectedV(std::vector<unsigned int>);
|
||||
|
||||
|
||||
int printHandle (unsigned int h);
|
||||
int printHandlesV(std::vector<unsigned int> handleV);
|
||||
int printHandles(unsigned int * handleArray, unsigned int nHandles);
|
||||
@@ -303,7 +313,7 @@ public:
|
||||
bool isEnum(unsigned int _handle);
|
||||
short getEnumFromString(unsigned int _handle, std::string enumStringValue);
|
||||
std::string getStringFromEnum(unsigned int _handle, unsigned short enumValue);
|
||||
std::vector<std::string> getEnumStrings(unsigned int handle);
|
||||
std::vector<std::string> getEnumStrings(unsigned int handle);
|
||||
|
||||
int getDataTypeNative (unsigned int _handle, chtype &ndt);
|
||||
int getDataTypeRequest(unsigned int _handle, chtype &rdt);
|
||||
@@ -364,11 +374,13 @@ public:
|
||||
void setFirstAndLastArrayElements(unsigned int _handle,
|
||||
unsigned int _start, unsigned int _last)
|
||||
{
|
||||
if (_last > _start ) {
|
||||
if (_last > _start )
|
||||
{
|
||||
setOffset(_handle, _start);
|
||||
setNelem(_handle, _last);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << " offset must be less than the nelements" <<std::endl;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef HASHCONDUIT_GROUP_H
|
||||
#define HASHCONDUIT_GROUP_H
|
||||
|
||||
#include "conduitGroup.h"
|
||||
#include <conduitGroup.h>
|
||||
|
||||
// boost include
|
||||
#include <boost/multi_index_container.hpp>
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#include <cafeEnum.h>
|
||||
#include <defines.h>
|
||||
|
||||
class Helper {
|
||||
class Helper
|
||||
{
|
||||
public:
|
||||
Helper() {};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,8 @@
|
||||
#include <cafeEnum.h>
|
||||
|
||||
|
||||
template <class CTYPE> class Instant {
|
||||
template <class CTYPE> class Instant
|
||||
{
|
||||
|
||||
private:
|
||||
Transpose<dbr_string_t> renderString; // 0
|
||||
@@ -150,16 +151,20 @@ public:
|
||||
|
||||
status=ICAFE_NORMAL;
|
||||
|
||||
if (handleSet.size() != valSet.size() ) {
|
||||
if (handleSet.size() != valSet.size() )
|
||||
{
|
||||
return ECAFE_HANDLE_MISMATCH_SET_AND_MATCH;
|
||||
}
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
for (size_t i=0; i< handleSet.size(); ++i)
|
||||
{
|
||||
|
||||
if (!helper.isChannelConnected(handleSet[i])) {
|
||||
if (!helper.isChannelConnected(handleSet[i]))
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "NOT ALL CHANNELS CONNECTED: " << std::endl;
|
||||
if (!helper.isChannelConnected(handleSet[i])) {
|
||||
if (!helper.isChannelConnected(handleSet[i]))
|
||||
{
|
||||
helper.printHandle(handleSet[i]);
|
||||
status=helper.getStatus(handleSet[i]);
|
||||
}
|
||||
@@ -168,18 +173,22 @@ public:
|
||||
}
|
||||
|
||||
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
if (status!=ICAFE_NORMAL)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
if(printFlag) {
|
||||
if(printFlag)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
}
|
||||
|
||||
|
||||
if (printFlag) {
|
||||
if (printFlag)
|
||||
{
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
for (size_t i=0; i< handleSet.size(); ++i)
|
||||
{
|
||||
|
||||
std::cout << "SETTING PV=" << helper.getPVFromHandle(handleSet[i]) << " to " << valSet[i] << std::endl;
|
||||
|
||||
@@ -189,7 +198,8 @@ public:
|
||||
} //if
|
||||
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
for (size_t i=0; i< handleSet.size(); ++i)
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -200,9 +210,11 @@ public:
|
||||
|
||||
nelemPrevious=helper.getNelemClient(handleSet[i]);
|
||||
//Check the number of elements requested?
|
||||
if (nelemPrevious>1) {
|
||||
if (nelemPrevious>1)
|
||||
{
|
||||
nelemRequestedCheck = helper.setNelem(handleSet[i],nelemRequested);
|
||||
if (nelemRequestedCheck != nelemRequested) {
|
||||
if (nelemRequestedCheck != nelemRequested)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "Internal CAFE FUNNY: Wanted to set the no. elements from: "
|
||||
<< nelemPrevious << std::endl;
|
||||
@@ -232,7 +244,8 @@ public:
|
||||
|
||||
status=set(handleSet[i], DBR_STRING, valSetA);
|
||||
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
if (status!=ICAFE_NORMAL)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
cstat.report(status);
|
||||
}
|
||||
@@ -244,9 +257,11 @@ public:
|
||||
nelemRequested=1;
|
||||
//Switch back to previous value
|
||||
//if (nelemPrevious>1) {
|
||||
if(helper.getNelemRequest(handleSet[i])!= nelemPrevious) {
|
||||
if(helper.getNelemRequest(handleSet[i])!= nelemPrevious)
|
||||
{
|
||||
nelemPreviousCheck= helper.setNelem(handleSet[i],nelemPrevious);
|
||||
if (nelemPreviousCheck != nelemPrevious) {
|
||||
if (nelemPreviousCheck != nelemPrevious)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "Internal CAFE FUNNY: Wanted to re-set the no. elements from: "
|
||||
<< nelemRequested << std::endl;
|
||||
@@ -283,16 +298,19 @@ public:
|
||||
helper.removeLeadingAndTrailingSpaces(valSet.c_str(), valSetA[0]);
|
||||
|
||||
status=Instant::set(handleSet, DBR_STRING, valSetA);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
status=Instant::get(handleSet, DBR_STRING, valGetA);
|
||||
|
||||
valGet=valGetA[0];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
if (strcmp(valSetA[0],valGetA[0])==0) {
|
||||
if (strcmp(valSetA[0],valGetA[0])==0)
|
||||
{
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
@@ -308,13 +326,16 @@ public:
|
||||
ins>>ind;
|
||||
|
||||
|
||||
if ( !ous.fail() && !ins.fail()) {
|
||||
if (ind==oud) {
|
||||
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()) {
|
||||
else if (!ins.fail())
|
||||
{
|
||||
short enumval=-1;
|
||||
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
@@ -324,7 +345,8 @@ public:
|
||||
std::stringstream ss;
|
||||
ss << enumval;
|
||||
valGet= ss.str();
|
||||
if ((short)ind==enumval) {
|
||||
if ((short)ind==enumval)
|
||||
{
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
@@ -361,16 +383,19 @@ public:
|
||||
helper.removeLeadingAndTrailingSpaces(valSet, valSetA[0]);
|
||||
|
||||
status=Instant::set(handleSet, DBR_STRING, valSetA);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
if (status==ICAFE_NORMAL)
|
||||
{
|
||||
status=Instant::get(handleSet, DBR_STRING, valGetA);
|
||||
|
||||
strcpy(valGet,valGetA[0]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
if (strcmp(valSetA[0],valGetA[0])==0) {
|
||||
if (strcmp(valSetA[0],valGetA[0])==0)
|
||||
{
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
@@ -386,13 +411,16 @@ public:
|
||||
ins.str(valSetA[0]);
|
||||
ins>>ind;
|
||||
|
||||
if ( !ous.fail() && !ins.fail()) {
|
||||
if (ind==oud) {
|
||||
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()) {
|
||||
else if (!ins.fail())
|
||||
{
|
||||
short enumval=-1;
|
||||
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
@@ -402,7 +430,8 @@ public:
|
||||
ss << enumval;
|
||||
strcpy(valGet, ss.str().c_str());
|
||||
|
||||
if ((short) ind==enumval) {
|
||||
if ((short) ind==enumval)
|
||||
{
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,19 +6,21 @@
|
||||
///
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#ifndef LOADCOLLECTIONXMLPARSER_H
|
||||
#define LOADCOLLECTIONXMLPARSER_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#include <deviceCollection.h>
|
||||
|
||||
#include <QtXml/QXmlDefaultHandler>
|
||||
//include <QtXml/QXmlDefaultHandler>
|
||||
#include <QXmlDefaultHandler>
|
||||
|
||||
|
||||
class loadCollectionXMLParser : public QXmlDefaultHandler {
|
||||
class loadCollectionXMLParser : public QXmlDefaultHandler
|
||||
{
|
||||
public:
|
||||
loadCollectionXMLParser();
|
||||
virtual ~loadCollectionXMLParser();
|
||||
@@ -35,7 +37,8 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
NotWaiting,
|
||||
WaitingForDescription,
|
||||
WaitingForDevice,
|
||||
|
||||
@@ -5,18 +5,26 @@
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#ifndef LOADGROUPXMLPARSER_H
|
||||
#define LOADGROUPXMLPARSER_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <deviceCollection.h>
|
||||
|
||||
#include <QtXml/QXmlDefaultHandler>
|
||||
//include <QtXml/QXmlDefaultHandler>
|
||||
#include <QXmlDefaultHandler>
|
||||
|
||||
class loadGroupXMLParser : public QXmlDefaultHandler {
|
||||
|
||||
class loadGroupXMLParser : public QXmlDefaultHandler
|
||||
{
|
||||
public:
|
||||
loadGroupXMLParser();
|
||||
virtual ~loadGroupXMLParser();
|
||||
@@ -26,7 +34,8 @@ public:
|
||||
|
||||
std::vector<deviceGroup> groups;
|
||||
private:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
NotWaiting,
|
||||
WaitingForDescription,
|
||||
WaitingForStatusGroup,
|
||||
@@ -61,6 +70,8 @@ private:
|
||||
const static QString& tagCollectiveType;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* LOADGROUPXMLPARSER_H */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
366
include/lz4.h
Normal file
366
include/lz4.h
Normal file
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
LZ4 - Fast LZ compression algorithm
|
||||
Header File
|
||||
Copyright (C) 2011-2015, Yann Collet.
|
||||
|
||||
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
You can contact the author at :
|
||||
- LZ4 source repository : https://github.com/Cyan4973/lz4
|
||||
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* lz4.h provides block compression functions, and gives full buffer control to programmer.
|
||||
* If you need to generate inter-operable compressed data (respecting LZ4 frame specification),
|
||||
* and can let the library handle its own memory, please use lz4frame.h instead.
|
||||
*/
|
||||
|
||||
/**************************************
|
||||
* Version
|
||||
**************************************/
|
||||
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
||||
#define LZ4_VERSION_MINOR 7 /* for new (non-breaking) interface capabilities */
|
||||
#define LZ4_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */
|
||||
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
|
||||
int LZ4_versionNumber (void);
|
||||
|
||||
/**************************************
|
||||
* Tuning parameter
|
||||
**************************************/
|
||||
/*
|
||||
* LZ4_MEMORY_USAGE :
|
||||
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
|
||||
* Increasing memory usage improves compression ratio
|
||||
* Reduced memory usage can improve speed, due to cache effect
|
||||
* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache
|
||||
*/
|
||||
#define LZ4_MEMORY_USAGE 14
|
||||
|
||||
|
||||
/**************************************
|
||||
* Simple Functions
|
||||
**************************************/
|
||||
|
||||
int LZ4_compress_default(const char* source, char* dest, int sourceSize, int maxDestSize);
|
||||
int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxDecompressedSize);
|
||||
|
||||
/*
|
||||
LZ4_compress_default() :
|
||||
Compresses 'sourceSize' bytes from buffer 'source'
|
||||
into already allocated 'dest' buffer of size 'maxDestSize'.
|
||||
Compression is guaranteed to succeed if 'maxDestSize' >= LZ4_compressBound(sourceSize).
|
||||
It also runs faster, so it's a recommended setting.
|
||||
If the function cannot compress 'source' into a more limited 'dest' budget,
|
||||
compression stops *immediately*, and the function result is zero.
|
||||
As a consequence, 'dest' content is not valid.
|
||||
This function never writes outside 'dest' buffer, nor read outside 'source' buffer.
|
||||
sourceSize : Max supported value is LZ4_MAX_INPUT_VALUE
|
||||
maxDestSize : full or partial size of buffer 'dest' (which must be already allocated)
|
||||
return : the number of bytes written into buffer 'dest' (necessarily <= maxOutputSize)
|
||||
or 0 if compression fails
|
||||
|
||||
LZ4_decompress_safe() :
|
||||
compressedSize : is the precise full size of the compressed block.
|
||||
maxDecompressedSize : is the size of destination buffer, which must be already allocated.
|
||||
return : the number of bytes decompressed into destination buffer (necessarily <= maxDecompressedSize)
|
||||
If destination buffer is not large enough, decoding will stop and output an error code (<0).
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function is protected against buffer overflow exploits, including malicious data packets.
|
||||
It never writes outside output buffer, nor reads outside input buffer.
|
||||
*/
|
||||
|
||||
|
||||
/**************************************
|
||||
* Advanced Functions
|
||||
**************************************/
|
||||
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
|
||||
#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
|
||||
|
||||
/*
|
||||
LZ4_compressBound() :
|
||||
Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)
|
||||
This function is primarily useful for memory allocation purposes (destination buffer size).
|
||||
Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).
|
||||
Note that LZ4_compress_default() compress faster when dest buffer size is >= LZ4_compressBound(srcSize)
|
||||
inputSize : max supported value is LZ4_MAX_INPUT_SIZE
|
||||
return : maximum output size in a "worst case" scenario
|
||||
or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)
|
||||
*/
|
||||
int LZ4_compressBound(int inputSize);
|
||||
|
||||
/*
|
||||
LZ4_compress_fast() :
|
||||
Same as LZ4_compress_default(), but allows to select an "acceleration" factor.
|
||||
The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
|
||||
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
|
||||
An acceleration value of "1" is the same as regular LZ4_compress_default()
|
||||
Values <= 0 will be replaced by ACCELERATION_DEFAULT (see lz4.c), which is 1.
|
||||
*/
|
||||
int LZ4_compress_fast (const char* source, char* dest, int sourceSize, int maxDestSize, int acceleration);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_compress_fast_extState() :
|
||||
Same compression function, just using an externally allocated memory space to store compression state.
|
||||
Use LZ4_sizeofState() to know how much memory must be allocated,
|
||||
and allocate it on 8-bytes boundaries (using malloc() typically).
|
||||
Then, provide it as 'void* state' to compression function.
|
||||
*/
|
||||
int LZ4_sizeofState(void);
|
||||
int LZ4_compress_fast_extState (void* state, const char* source, char* dest, int inputSize, int maxDestSize, int acceleration);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_compress_destSize() :
|
||||
Reverse the logic, by compressing as much data as possible from 'source' buffer
|
||||
into already allocated buffer 'dest' of size 'targetDestSize'.
|
||||
This function either compresses the entire 'source' content into 'dest' if it's large enough,
|
||||
or fill 'dest' buffer completely with as much data as possible from 'source'.
|
||||
*sourceSizePtr : will be modified to indicate how many bytes where read from 'source' to fill 'dest'.
|
||||
New value is necessarily <= old value.
|
||||
return : Nb bytes written into 'dest' (necessarily <= targetDestSize)
|
||||
or 0 if compression fails
|
||||
*/
|
||||
int LZ4_compress_destSize (const char* source, char* dest, int* sourceSizePtr, int targetDestSize);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_decompress_fast() :
|
||||
originalSize : is the original and therefore uncompressed size
|
||||
return : the number of bytes read from the source buffer (in other words, the compressed size)
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes.
|
||||
note : This function fully respect memory boundaries for properly formed compressed data.
|
||||
It is a bit faster than LZ4_decompress_safe().
|
||||
However, it does not provide any protection against intentionally modified data stream (malicious input).
|
||||
Use this function in trusted environment only (data to decode comes from a trusted source).
|
||||
*/
|
||||
int LZ4_decompress_fast (const char* source, char* dest, int originalSize);
|
||||
|
||||
/*
|
||||
LZ4_decompress_safe_partial() :
|
||||
This function decompress a compressed block of size 'compressedSize' at position 'source'
|
||||
into destination buffer 'dest' of size 'maxDecompressedSize'.
|
||||
The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached,
|
||||
reducing decompression time.
|
||||
return : the number of bytes decoded in the destination buffer (necessarily <= maxDecompressedSize)
|
||||
Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller.
|
||||
Always control how many bytes were decoded.
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets
|
||||
*/
|
||||
int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize);
|
||||
|
||||
|
||||
/***********************************************
|
||||
* Streaming Compression Functions
|
||||
***********************************************/
|
||||
#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)
|
||||
#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(long long))
|
||||
/*
|
||||
* LZ4_stream_t
|
||||
* information structure to track an LZ4 stream.
|
||||
* important : init this structure content before first use !
|
||||
* note : only allocated directly the structure if you are statically linking LZ4
|
||||
* If you are using liblz4 as a DLL, please use below construction methods instead.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
long long table[LZ4_STREAMSIZE_U64];
|
||||
} LZ4_stream_t;
|
||||
|
||||
/*
|
||||
* LZ4_resetStream
|
||||
* Use this function to init an allocated LZ4_stream_t structure
|
||||
*/
|
||||
void LZ4_resetStream (LZ4_stream_t* streamPtr);
|
||||
|
||||
/*
|
||||
* LZ4_createStream will allocate and initialize an LZ4_stream_t structure
|
||||
* LZ4_freeStream releases its memory.
|
||||
* In the context of a DLL (liblz4), please use these methods rather than the static struct.
|
||||
* They are more future proof, in case of a change of LZ4_stream_t size.
|
||||
*/
|
||||
LZ4_stream_t* LZ4_createStream(void);
|
||||
int LZ4_freeStream (LZ4_stream_t* streamPtr);
|
||||
|
||||
/*
|
||||
* LZ4_loadDict
|
||||
* Use this function to load a static dictionary into LZ4_stream.
|
||||
* Any previous data will be forgotten, only 'dictionary' will remain in memory.
|
||||
* Loading a size of 0 is allowed.
|
||||
* Return : dictionary size, in bytes (necessarily <= 64 KB)
|
||||
*/
|
||||
int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
|
||||
|
||||
/*
|
||||
* LZ4_compress_fast_continue
|
||||
* Compress buffer content 'src', using data from previously compressed blocks as dictionary to improve compression ratio.
|
||||
* Important : Previous data blocks are assumed to still be present and unmodified !
|
||||
* 'dst' buffer must be already allocated.
|
||||
* If maxDstSize >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
|
||||
* If not, and if compressed data cannot fit into 'dst' buffer size, compression stops, and function returns a zero.
|
||||
*/
|
||||
int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int maxDstSize, int acceleration);
|
||||
|
||||
/*
|
||||
* LZ4_saveDict
|
||||
* If previously compressed data block is not guaranteed to remain available at its memory location
|
||||
* save it into a safer place (char* safeBuffer)
|
||||
* Note : you don't need to call LZ4_loadDict() afterwards,
|
||||
* dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue()
|
||||
* Return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error
|
||||
*/
|
||||
int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dictSize);
|
||||
|
||||
|
||||
/************************************************
|
||||
* Streaming Decompression Functions
|
||||
************************************************/
|
||||
|
||||
#define LZ4_STREAMDECODESIZE_U64 4
|
||||
#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long))
|
||||
typedef struct
|
||||
{
|
||||
unsigned long long table[LZ4_STREAMDECODESIZE_U64];
|
||||
} LZ4_streamDecode_t;
|
||||
/*
|
||||
* LZ4_streamDecode_t
|
||||
* information structure to track an LZ4 stream.
|
||||
* init this structure content using LZ4_setStreamDecode or memset() before first use !
|
||||
*
|
||||
* In the context of a DLL (liblz4) please prefer usage of construction methods below.
|
||||
* They are more future proof, in case of a change of LZ4_streamDecode_t size in the future.
|
||||
* LZ4_createStreamDecode will allocate and initialize an LZ4_streamDecode_t structure
|
||||
* LZ4_freeStreamDecode releases its memory.
|
||||
*/
|
||||
LZ4_streamDecode_t* LZ4_createStreamDecode(void);
|
||||
int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
|
||||
|
||||
/*
|
||||
* LZ4_setStreamDecode
|
||||
* Use this function to instruct where to find the dictionary.
|
||||
* Setting a size of 0 is allowed (same effect as reset).
|
||||
* Return : 1 if OK, 0 if error
|
||||
*/
|
||||
int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
|
||||
|
||||
/*
|
||||
*_continue() :
|
||||
These decoding functions allow decompression of multiple blocks in "streaming" mode.
|
||||
Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB)
|
||||
In the case of a ring buffers, decoding buffer must be either :
|
||||
- Exactly same size as encoding buffer, with same update rule (block boundaries at same positions)
|
||||
In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB).
|
||||
- Larger than encoding buffer, by a minimum of maxBlockSize more bytes.
|
||||
maxBlockSize is implementation dependent. It's the maximum size you intend to compress into a single block.
|
||||
In which case, encoding and decoding buffers do not need to be synchronized,
|
||||
and encoding ring buffer can have any size, including small ones ( < 64 KB).
|
||||
- _At least_ 64 KB + 8 bytes + maxBlockSize.
|
||||
In which case, encoding and decoding buffers do not need to be synchronized,
|
||||
and encoding ring buffer can have any size, including larger than decoding buffer.
|
||||
Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer,
|
||||
and indicate where it is saved using LZ4_setStreamDecode()
|
||||
*/
|
||||
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxDecompressedSize);
|
||||
int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize);
|
||||
|
||||
|
||||
/*
|
||||
Advanced decoding functions :
|
||||
*_usingDict() :
|
||||
These decoding functions work the same as
|
||||
a combination of LZ4_setStreamDecode() followed by LZ4_decompress_x_continue()
|
||||
They are stand-alone. They don't need nor update an LZ4_streamDecode_t structure.
|
||||
*/
|
||||
int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxDecompressedSize, const char* dictStart, int dictSize);
|
||||
int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize);
|
||||
|
||||
|
||||
|
||||
/**************************************
|
||||
* Obsolete Functions
|
||||
**************************************/
|
||||
/* Deprecate Warnings */
|
||||
/* Should these warnings messages be a problem,
|
||||
it is generally possible to disable them,
|
||||
with -Wno-deprecated-declarations for gcc
|
||||
or _CRT_SECURE_NO_WARNINGS in Visual for example.
|
||||
You can also define LZ4_DEPRECATE_WARNING_DEFBLOCK. */
|
||||
#ifndef LZ4_DEPRECATE_WARNING_DEFBLOCK
|
||||
# define LZ4_DEPRECATE_WARNING_DEFBLOCK
|
||||
# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
# if (LZ4_GCC_VERSION >= 405) || defined(__clang__)
|
||||
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||
# elif (LZ4_GCC_VERSION >= 301)
|
||||
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
|
||||
# elif defined(_MSC_VER)
|
||||
# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
|
||||
# else
|
||||
# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
|
||||
# define LZ4_DEPRECATED(message)
|
||||
# endif
|
||||
#endif /* LZ4_DEPRECATE_WARNING_DEFBLOCK */
|
||||
|
||||
/* Obsolete compression functions */
|
||||
/* These functions are planned to start generate warnings by r131 approximately */
|
||||
int LZ4_compress (const char* source, char* dest, int sourceSize);
|
||||
int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);
|
||||
int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
|
||||
int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
|
||||
int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
/* Obsolete decompression functions */
|
||||
/* These function names are completely deprecated and must no longer be used.
|
||||
They are only provided here for compatibility with older programs.
|
||||
- LZ4_uncompress is the same as LZ4_decompress_fast
|
||||
- LZ4_uncompress_unknownOutputSize is the same as LZ4_decompress_safe
|
||||
These function prototypes are now disabled; uncomment them only if you really need them.
|
||||
It is highly recommended to stop using these prototypes and migrate to maintained ones */
|
||||
/* int LZ4_uncompress (const char* source, char* dest, int outputSize); */
|
||||
/* int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); */
|
||||
|
||||
/* Obsolete streaming functions; use new streaming interface whenever possible */
|
||||
LZ4_DEPRECATED("use LZ4_createStream() instead") void* LZ4_create (char* inputBuffer);
|
||||
LZ4_DEPRECATED("use LZ4_createStream() instead") int LZ4_sizeofStreamState(void);
|
||||
LZ4_DEPRECATED("use LZ4_resetStream() instead") int LZ4_resetStreamState(void* state, char* inputBuffer);
|
||||
LZ4_DEPRECATED("use LZ4_saveDict() instead") char* LZ4_slideInputBuffer (void* state);
|
||||
|
||||
/* Obsolete streaming decoding functions */
|
||||
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
|
||||
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
@@ -34,13 +34,21 @@ 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
|
||||
#am__append_1 = zbsread.h zbsHash.h zbsdtHelper.h zbsDataHolders.h \
|
||||
# bitshuffle/bitshuffle_core.h bitshuffle/bitshuffle.h bitshuffle/iochain.h \
|
||||
# bitshuffle/bitshuffle_internals.h
|
||||
|
||||
#bitshuffle/bshuf_h5filter.h
|
||||
#am__append_2 = PyCafe_api.h
|
||||
#am__append_3 = 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__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@@ -49,7 +57,7 @@ CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__include_HEADERS_DIST = cafe.h cafeCache.h cafeConvert.h \
|
||||
am__include_HEADERS_DIST = config.h 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 \
|
||||
@@ -61,7 +69,10 @@ am__include_HEADERS_DIST = cafe.h cafeCache.h cafeConvert.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 \
|
||||
tmDateMap.h PyCafe_api.h PyCafe.h
|
||||
tmDateMap.h zbsread.h zbsHash.h zbsdtHelper.h zbsDataHolders.h \
|
||||
bitshuffle/bitshuffle_core.h bitshuffle/bitshuffle.h \
|
||||
bitshuffle/iochain.h bitshuffle/bitshuffle_internals.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/||"`;; \
|
||||
@@ -90,26 +101,27 @@ 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 -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
|
||||
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
|
||||
AM_CPPFLAGS = -fexceptions -fPIC -std=c++1z -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
|
||||
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64
|
||||
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 = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
|
||||
CC = /opt/psi/Programming/gcc/6.3.0/bin/gcc
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -g -O2
|
||||
CPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc -E
|
||||
CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
|
||||
CXX = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++
|
||||
CXXCPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++ -E
|
||||
CPP = /opt/psi/Programming/gcc/6.3.0/bin/gcc -E
|
||||
CPPFLAGS = -fexceptions -fPIC -std=c++1z -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
|
||||
CXX = /opt/psi/Programming/gcc/6.3.0/bin/g++
|
||||
CXXCPP = /opt/psi/Programming/gcc/6.3.0/bin/g++ -E
|
||||
CXXDEPMODE = depmode=gcc3
|
||||
CXXFLAGS = -g -O2
|
||||
CYGPATH_W = echo
|
||||
DEFS = -DHAVE_CONFIG_H
|
||||
DEPDIR = .deps
|
||||
DLLTOOL = false
|
||||
DSYMUTIL =
|
||||
DUMPBIN =
|
||||
ECHO_C =
|
||||
@@ -125,14 +137,16 @@ 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
|
||||
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64
|
||||
LIBOBJS =
|
||||
LIBS = -lQtXml -lQtCore
|
||||
LIBS =
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LIPO =
|
||||
LN_S = ln -s
|
||||
LTLIBOBJS =
|
||||
LT_SYS_LIBRARY_PATH =
|
||||
MAKEINFO = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run makeinfo
|
||||
MANIFEST_TOOL = :
|
||||
MKDIR_P = /bin/mkdir -p
|
||||
NM = /usr/bin/nm -B
|
||||
NMEDIT =
|
||||
@@ -143,21 +157,22 @@ OTOOL64 =
|
||||
PACKAGE = cafe
|
||||
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
|
||||
PACKAGE_NAME = CAFE
|
||||
PACKAGE_STRING = CAFE 1.8.0
|
||||
PACKAGE_STRING = CAFE 1.12.5
|
||||
PACKAGE_TARNAME = cafe
|
||||
PACKAGE_VERSION = 1.8.0
|
||||
PACKAGE_VERSION = 1.12.5
|
||||
PATH_SEPARATOR = :
|
||||
RANLIB = ranlib
|
||||
SED = /bin/sed
|
||||
SET_MAKE =
|
||||
SHELL = /bin/sh
|
||||
STRIP = strip
|
||||
VERSION = 1.8.0
|
||||
VERSION = 1.12.5
|
||||
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 = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
|
||||
ac_ct_AR = ar
|
||||
ac_ct_CC = /opt/psi/Programming/gcc/6.3.0/bin/gcc
|
||||
ac_ct_CXX =
|
||||
ac_ct_DUMPBIN =
|
||||
am__include = include
|
||||
@@ -186,16 +201,15 @@ 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.8.0-gcc-6.3.0/lib
|
||||
libdir = /opt/gfa/cafe/cpp/cafe-noqt-1.12.5-gcc-6.3.0/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.8.0-gcc-6.3.0
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-noqt-1.12.5-gcc-6.3.0
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
@@ -206,9 +220,10 @@ 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 \
|
||||
include_HEADERS = config.h 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 \
|
||||
@@ -217,7 +232,7 @@ include_HEADERS = cafe.h cafeCache.h cafeConvert.h cafeDataType.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 \
|
||||
tmDateMap.h $(am__append_1) $(am__append_2)
|
||||
tmDateMap.h $(am__append_1) $(am__append_2) $(am__append_3)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@@ -474,10 +489,6 @@ uninstall-am: uninstall-includeHEADERS
|
||||
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:
|
||||
|
||||
@@ -3,25 +3,27 @@
|
||||
## 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 \
|
||||
include_HEADERS = config.h 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 tmDateMap.h
|
||||
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h tmDateMap.h
|
||||
|
||||
|
||||
if HAVE_ZEROMQ_
|
||||
include_HEADERS += zbsread.h zbsHash.h zbsdtHelper.h zbsDataHolders.h \
|
||||
bitshuffle/bitshuffle_core.h bitshuffle/bitshuffle.h bitshuffle/iochain.h \
|
||||
bitshuffle/bitshuffle_internals.h
|
||||
endif
|
||||
#bitshuffle/bshuf_h5filter.h
|
||||
|
||||
if HAVE_PYTHON_
|
||||
include_HEADERS += PyCafe_api.h
|
||||
endif
|
||||
|
||||
if HAVE_PYCAFE_EXT
|
||||
if HAVE_PYCAFE_EXT_
|
||||
include_HEADERS += PyCafe.h
|
||||
endif
|
||||
|
||||
#if HAVE_ZEROMQ
|
||||
#include_HEADERS += cafeService.h zhelpers.h
|
||||
#endif
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
///
|
||||
/// \file methodCallbacks.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
/// \date Release: February 2015; Updated: July 2019
|
||||
/// \version CAFE 1.9.0
|
||||
///
|
||||
/// Added handlerGetDescription
|
||||
|
||||
#ifndef METHODCALLBACKS_H
|
||||
#define METHODCALLBACKS_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
namespace CALLBACK_CAFE {
|
||||
namespace CALLBACK_CAFE
|
||||
{
|
||||
#if HAVE_PYTHON_H
|
||||
void PyHandlerPut( struct event_handler_args args);
|
||||
void PyHandlerGet( struct event_handler_args args);
|
||||
void PyHandlerPut(struct event_handler_args args);
|
||||
void PyHandlerGet(struct event_handler_args args);
|
||||
#endif
|
||||
void handlerPulseID( struct event_handler_args args) ;
|
||||
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) ;
|
||||
void handlerPulseID(struct event_handler_args args);
|
||||
void handlerPut(struct event_handler_args args);
|
||||
void handlerGet(struct event_handler_args args);
|
||||
void handlerGetCtrl(struct event_handler_args args);
|
||||
void handlerGetCtrlAtConnect(struct event_handler_args args); //Python option embedded
|
||||
void handlerGetSTSACK(struct event_handler_args args);
|
||||
void handlerGetClassName(struct event_handler_args args);
|
||||
|
||||
|
||||
void handlerGetDescription(struct event_handler_args args);
|
||||
|
||||
};
|
||||
|
||||
#endif // METHODCALLBACKS_H
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
//include <config.h> //In the below!
|
||||
#include <methodCallbacks.h>
|
||||
@@ -32,11 +33,13 @@
|
||||
//include <enumStrings.h>
|
||||
|
||||
using namespace CAFENUM;
|
||||
using namespace boost::posix_time;
|
||||
|
||||
/**
|
||||
* Define Policy for printing messages
|
||||
*/
|
||||
class PrintErrorPolicy {
|
||||
class PrintErrorPolicy
|
||||
{
|
||||
protected:
|
||||
bool invalidHandle;
|
||||
bool info;
|
||||
@@ -88,15 +91,19 @@ public:
|
||||
|
||||
|
||||
/**
|
||||
* Define Policy for creating channel; this just sets the priority level
|
||||
* Define Policy for creating channel; this also sets the priority level
|
||||
* for dispatch within the server or network
|
||||
*/
|
||||
class ChannelCreatePolicy {
|
||||
class ChannelCreatePolicy
|
||||
{
|
||||
private:
|
||||
unsigned short priority;
|
||||
|
||||
//special method to find handle thru conduit_set iterator
|
||||
pCallbackConnection handler;
|
||||
bool pyCallbackFlag; //enable pyCallback
|
||||
void * pyConnectHandler;
|
||||
|
||||
public:
|
||||
static void callbackHandlerCreate(struct connection_handler_args args);
|
||||
pCallbackConnection getHandler()
|
||||
@@ -116,7 +123,27 @@ public:
|
||||
priority=std::min(p,(unsigned short) CA_SERVER_DISPATCH_PRIORITY_MAX);
|
||||
return priority;
|
||||
}
|
||||
ChannelCreatePolicy():priority(CA_SERVER_DISPATCH_PRIORITY_DEFAULT),handler(callbackHandlerCreate) {};
|
||||
|
||||
void setPyConnectHandler(void * cythonConnectCallbackFn){
|
||||
pyConnectHandler=cythonConnectCallbackFn;
|
||||
}
|
||||
|
||||
void * getPyConnectHandler(){
|
||||
return pyConnectHandler;
|
||||
}
|
||||
|
||||
void setPyCallbackFlag(bool b)
|
||||
{
|
||||
pyCallbackFlag=b;
|
||||
}
|
||||
bool getPyCallbackFlag() const
|
||||
{
|
||||
return pyCallbackFlag;
|
||||
}
|
||||
ChannelCreatePolicy():priority(CA_SERVER_DISPATCH_PRIORITY_DEFAULT),
|
||||
handler(callbackHandlerCreate),
|
||||
pyCallbackFlag(false),
|
||||
pyConnectHandler(NULL) {};
|
||||
};
|
||||
|
||||
|
||||
@@ -124,7 +151,8 @@ public:
|
||||
* Define Policy to open/close/monitor channels one-by-one
|
||||
* or to accumulate messages for later dispatch
|
||||
*/
|
||||
class ChannelOpenPolicy {
|
||||
class ChannelOpenPolicy
|
||||
{
|
||||
public:
|
||||
|
||||
//Constructors
|
||||
@@ -134,16 +162,20 @@ public:
|
||||
ChannelOpenPolicy(ChannelFlushSendBufferPolicyKind f,
|
||||
ChannelWhenToFlushSendBufferPolicyKind w, double t)
|
||||
{
|
||||
if (f>=WITH_PEND_EVENT && f<=WITH_POLL) {
|
||||
if (f>=WITH_PEND_EVENT && f<=WITH_POLL)
|
||||
{
|
||||
setFlushSendBufferKind(f);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << std::endl;
|
||||
}
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT) {
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{
|
||||
setWhenToFlushSendBuffer(w);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
|
||||
}
|
||||
setTimeout(t), setDefaultTimeout(DEFAULT_TIMEOUT_PEND_EVENT);
|
||||
@@ -157,7 +189,8 @@ private:
|
||||
public:
|
||||
void flushSendBufferNow()
|
||||
{
|
||||
switch(flushKind) {
|
||||
switch(flushKind)
|
||||
{
|
||||
case WITH_PEND_EVENT:
|
||||
ca_pend_event(timeout);
|
||||
break;
|
||||
@@ -198,20 +231,24 @@ public:
|
||||
|
||||
void setFlushSendBufferKind(ChannelFlushSendBufferPolicyKind f)
|
||||
{
|
||||
if (f>=WITH_FLUSH_IO && f<=WITH_POLL) {
|
||||
if (f>=WITH_FLUSH_IO && f<=WITH_POLL)
|
||||
{
|
||||
flushKind=f;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind w)
|
||||
{
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT) {
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{
|
||||
whenKind=w;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
|
||||
}
|
||||
};
|
||||
@@ -219,11 +256,13 @@ public:
|
||||
|
||||
double setTimeout(double t)
|
||||
{
|
||||
if (t<0) {
|
||||
if (t<0)
|
||||
{
|
||||
std::cout << "CHANNELOPENPOLICY:setTimeout " << t << " seconds is an illegal value!" << std::endl;
|
||||
return timeout;
|
||||
}
|
||||
else if (t==0) {
|
||||
else if (t==0)
|
||||
{
|
||||
timeout=0.001;
|
||||
std::cout << "CHANNELOPENPOLICY:setTimeout " << " A value of zero would block the ioc for ever! "<< std::endl;
|
||||
std::cout << "CHANNELOPENPOLICY:setTimeout " << " Setting timeout to " << timeout << std::endl;
|
||||
@@ -234,11 +273,13 @@ public:
|
||||
|
||||
double setDefaultTimeout(double t)
|
||||
{
|
||||
if (t<0) {
|
||||
if (t<0)
|
||||
{
|
||||
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << t << " seconds is an illegal value!" << std::endl;
|
||||
return defaultTimeout;
|
||||
}
|
||||
else if (t==0) {
|
||||
else if (t==0)
|
||||
{
|
||||
defaultTimeout=0.001;
|
||||
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " A value of zero would block the ioc for ever! "<< std::endl;
|
||||
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " Setting timeout to " << defaultTimeout << std::endl;
|
||||
@@ -254,16 +295,20 @@ public:
|
||||
|
||||
void setPolicy(ChannelWhenToFlushSendBufferPolicyKind w, ChannelFlushSendBufferPolicyKind f, double t)
|
||||
{
|
||||
if (f>=WITH_FLUSH_IO && f<=WITH_POLL) {
|
||||
if (f>=WITH_FLUSH_IO && f<=WITH_POLL)
|
||||
{
|
||||
flushKind=f;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << std::endl;
|
||||
}
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT) {
|
||||
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{
|
||||
whenKind=w;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
|
||||
}
|
||||
timeout = t;
|
||||
@@ -277,16 +322,19 @@ public:
|
||||
/**
|
||||
* Define Policy to control datatype conversion for data transfer
|
||||
*/
|
||||
class ChannelRequestDataTypePolicy {
|
||||
class ChannelRequestDataTypePolicy
|
||||
{
|
||||
private:
|
||||
CAFENUM::ChannelRequestDataTypePolicyKind requestKind;
|
||||
public:
|
||||
void setRequestKind(CAFENUM::ChannelRequestDataTypePolicyKind rk)
|
||||
{
|
||||
if (rk>=CAFENUM::NATIVE_DATATYPE && rk<=CAFENUM::LOWEST_DATATYPE) {
|
||||
if (rk>=CAFENUM::NATIVE_DATATYPE && rk<=CAFENUM::LOWEST_DATATYPE)
|
||||
{
|
||||
requestKind=rk;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << rk << " is an INVALID ChannelDataTypePolicyKind" << std::endl;
|
||||
}
|
||||
};
|
||||
@@ -308,16 +356,19 @@ public:
|
||||
/**
|
||||
* Define Policy to control wait/nowait strategy in getCache operations
|
||||
*/
|
||||
class ChannelGetCacheWaitPolicy {
|
||||
class ChannelGetCacheWaitPolicy
|
||||
{
|
||||
private:
|
||||
CAFENUM::ChannelGetCacheWaitPolicyKind getCacheWaitKind;
|
||||
public:
|
||||
void setWaitKind(CAFENUM::ChannelGetCacheWaitPolicyKind wk)
|
||||
{
|
||||
if (wk>=CAFENUM::GET_CACHE_NO_CHECK && wk<=CAFENUM::GET_CACHE_WAIT) {
|
||||
if (wk>=CAFENUM::GET_CACHE_NO_CHECK && wk<=CAFENUM::GET_CACHE_WAIT)
|
||||
{
|
||||
getCacheWaitKind=wk;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << wk << " is an INVALID ChannelGetCacheWaitKind" << std::endl;
|
||||
}
|
||||
};
|
||||
@@ -327,7 +378,7 @@ public:
|
||||
return getCacheWaitKind;
|
||||
}
|
||||
//Constructors
|
||||
ChannelGetCacheWaitPolicy():getCacheWaitKind(CAFENUM::GET_CACHE_WAIT) {};
|
||||
ChannelGetCacheWaitPolicy():getCacheWaitKind(CAFENUM::GET_CACHE_NO_CHECK) {};
|
||||
ChannelGetCacheWaitPolicy(CAFENUM::ChannelGetCacheWaitPolicyKind wk)
|
||||
{
|
||||
getCacheWaitKind=wk;
|
||||
@@ -339,16 +390,19 @@ public:
|
||||
/**
|
||||
* Define Policy to control whether the get operations targets the ioc or not when there is a monitor
|
||||
*/
|
||||
class ChannelGetActionWhenMonitorPolicy {
|
||||
class ChannelGetActionWhenMonitorPolicy
|
||||
{
|
||||
private:
|
||||
CAFENUM::ChannelGetActionWhenMonitorPolicyKind getActionWhenMonitorKind;
|
||||
public:
|
||||
void setActionKind(CAFENUM::ChannelGetActionWhenMonitorPolicyKind ak)
|
||||
{
|
||||
if (ak>=CAFENUM::GET_FROM_CACHE && ak<=CAFENUM::GET_FROM_IOC) {
|
||||
if (ak>=CAFENUM::GET_FROM_CACHE && ak<=CAFENUM::GET_FROM_IOC)
|
||||
{
|
||||
getActionWhenMonitorKind=ak;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << ak << " is an INVALID ChannelGetActionWhenMonitorKind" << std::endl;
|
||||
}
|
||||
};
|
||||
@@ -373,7 +427,8 @@ public:
|
||||
* event of an ECA_TIMEOUT error; deltaTimeout gives the
|
||||
* increment in timeout for each additional attempt.
|
||||
*/
|
||||
class ChannelTimeoutPolicy {
|
||||
class ChannelTimeoutPolicy
|
||||
{
|
||||
private:
|
||||
bool selfGoverningTimeout;
|
||||
double timeout;
|
||||
@@ -440,7 +495,8 @@ public:
|
||||
* Define Policy to get/set channels whether in blocking/non-blocking mode:
|
||||
* Blocking can be achieved with or without callback
|
||||
*/
|
||||
class ChannelRequestPolicy {
|
||||
class ChannelRequestPolicy
|
||||
{
|
||||
private:
|
||||
|
||||
ChannelWhenToFlushSendBufferPolicyKind whenKind; // used for set
|
||||
@@ -479,7 +535,8 @@ public:
|
||||
|
||||
void setHandler(pCallback h)
|
||||
{
|
||||
if (h!=NULL) {
|
||||
if (h!=NULL)
|
||||
{
|
||||
handler=h;
|
||||
methodKind=WITH_CALLBACK_USER_SUPPLIED;
|
||||
}
|
||||
@@ -500,30 +557,36 @@ public:
|
||||
|
||||
void setMethodKind(ChannelRequestPolicyKind m)
|
||||
{
|
||||
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED) {
|
||||
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
|
||||
{
|
||||
methodKind=m;
|
||||
}
|
||||
else {
|
||||
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) {
|
||||
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{
|
||||
whenKind=w;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
void setWaitKind(ChannelWaitForResponsePolicyKind r)
|
||||
{
|
||||
if (r>=WAIT && r<=NO_WAIT) {
|
||||
if (r>=WAIT && r<=NO_WAIT)
|
||||
{
|
||||
waitKind=r;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << r << " is an INVALID ChannelWaitForResponsePolicyKind" << std::endl;
|
||||
}
|
||||
};
|
||||
@@ -537,32 +600,39 @@ public:
|
||||
ChannelWhenToFlushSendBufferPolicyKind w, ChannelWaitForResponsePolicyKind r,
|
||||
ChannelRequestPolicyKind m)
|
||||
{
|
||||
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT) {
|
||||
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
|
||||
{
|
||||
whenKind=w;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
|
||||
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
|
||||
std::cout << "Sticking to default value ChannelWhenToFlushSendBufferPolicyKind=" << whenKind << std::endl;
|
||||
}
|
||||
if (r>=WAIT && r<=NO_WAIT) {
|
||||
if (r>=WAIT && r<=NO_WAIT)
|
||||
{
|
||||
waitKind=r;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
|
||||
std::cout << r<< " is an INVALID ChannelWaitForResponsePolicyKind" << std::endl;
|
||||
std::cout << "Sticking to default value ChannelWaitForRespomsePolicyKind=" << waitKind << std::endl;
|
||||
}
|
||||
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED) {
|
||||
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
|
||||
{
|
||||
methodKind=m;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
|
||||
std::cout << r<< " is an INVALID ChannelRequestPolicyKind" << std::endl;
|
||||
std::cout << "Sticking to default value ChannelRequestPolicyKind=" << methodKind << std::endl;
|
||||
}
|
||||
|
||||
if (methodKind==WITHOUT_CALLBACK && waitKind==NO_WAIT) {
|
||||
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;
|
||||
|
||||
@@ -580,10 +650,12 @@ public:
|
||||
|
||||
ChannelRequestPolicy(ChannelRequestPolicyKind b)
|
||||
{
|
||||
if (b>=WITHOUT_CALLBACK && b<=WITH_CALLBACK_USER_SUPPLIED) {
|
||||
if (b>=WITHOUT_CALLBACK && b<=WITH_CALLBACK_USER_SUPPLIED)
|
||||
{
|
||||
methodKind=b;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << b << " is anINVALID ChannelRequestPolicyKind" << std::endl;
|
||||
}
|
||||
handler=NULL;
|
||||
@@ -613,7 +685,8 @@ public:
|
||||
* The monitor is rather placed in a monitor_in_waiting
|
||||
* pseudo-queue and only started upon connection
|
||||
*/
|
||||
class MonitorPolicy {
|
||||
class MonitorPolicy
|
||||
{
|
||||
friend class Conduit;
|
||||
friend class Connect;
|
||||
private:
|
||||
@@ -624,12 +697,14 @@ private:
|
||||
unsigned int nelem; //2
|
||||
//chid channelID; //3
|
||||
unsigned int mask; //4
|
||||
pCallback handler;//5
|
||||
void * userArgs; //6
|
||||
pCallback handler; //5
|
||||
void * cyCallback;
|
||||
void * userArgs; //6 handle
|
||||
evid eventID; //output
|
||||
int status; //output
|
||||
unsigned int id;
|
||||
|
||||
unsigned short notifyDeltaMilliSeconds; // Nov. 2020; push to Python Widgets
|
||||
ptime lastUpdate;
|
||||
|
||||
static void PyCallbackHandlerMonitorData(struct event_handler_args args); //pushes pvd,handle,pvname
|
||||
static void PyCallbackHandlerMonitor(struct event_handler_args args); //pushes handle
|
||||
@@ -644,11 +719,14 @@ public:
|
||||
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)
|
||||
handler(callbackHandlerMonitor), cyCallback(NULL),
|
||||
userArgs(NULL), eventID(NULL), status(ICAFE_NORMAL),
|
||||
notifyDeltaMilliSeconds(0)
|
||||
{
|
||||
++idNext;
|
||||
id = idNext;
|
||||
ptime timeNow(min_date_time);
|
||||
lastUpdate = timeNow;
|
||||
};
|
||||
//Make public
|
||||
static void callbackHandlerMonitor(struct event_handler_args args);
|
||||
@@ -701,6 +779,12 @@ public:
|
||||
(mask & DBE_ALARM) ? has=true : has=false;
|
||||
return has;
|
||||
}; //1
|
||||
|
||||
void * getCyCallback() const
|
||||
{
|
||||
return cyCallback;
|
||||
};
|
||||
|
||||
pCallback getHandler() const
|
||||
{
|
||||
return handler;
|
||||
@@ -720,33 +804,73 @@ public:
|
||||
{
|
||||
return eventID;
|
||||
};
|
||||
unsigned int getMonitorID() const
|
||||
{
|
||||
return id;
|
||||
};
|
||||
int getStatus() const
|
||||
{
|
||||
return status;
|
||||
};
|
||||
|
||||
unsigned int getID() const
|
||||
{
|
||||
return id;
|
||||
};
|
||||
|
||||
unsigned int getMonitorID() const
|
||||
{
|
||||
return id;
|
||||
};
|
||||
|
||||
ptime getLastUpdate() const
|
||||
{
|
||||
return lastUpdate;
|
||||
};
|
||||
|
||||
unsigned short getNotifyDeltaMilliSeconds() const
|
||||
{
|
||||
return notifyDeltaMilliSeconds;
|
||||
};
|
||||
|
||||
int getStatus() const
|
||||
{
|
||||
return status;
|
||||
};
|
||||
|
||||
void setMask(unsigned int m)
|
||||
{
|
||||
mask=m;
|
||||
};
|
||||
|
||||
void setNotifyDeltaMilliSeconds(unsigned short deltaMS)
|
||||
{
|
||||
notifyDeltaMilliSeconds = deltaMS;
|
||||
};
|
||||
|
||||
void setLastUpdate(ptime new_ptime)
|
||||
{
|
||||
lastUpdate = new_ptime;
|
||||
};
|
||||
|
||||
void setCyCallback(void * cythonCallback){
|
||||
cyCallback=cythonCallback;
|
||||
}
|
||||
|
||||
void setPyCyHandler(void * cythonCallback)
|
||||
{
|
||||
handler= PyCallbackHandlerMonitor;
|
||||
cyCallback=cythonCallback;
|
||||
};
|
||||
|
||||
void setPyHandler()
|
||||
{
|
||||
handler= PyCallbackHandlerMonitor;
|
||||
};
|
||||
|
||||
void setPyCyHandlerData(void * cythonCallback)
|
||||
{
|
||||
handler= PyCallbackHandlerMonitorData;
|
||||
cyCallback=cythonCallback;
|
||||
};
|
||||
|
||||
void setPyHandlerData()
|
||||
{
|
||||
handler= PyCallbackHandlerMonitorData;
|
||||
};
|
||||
|
||||
void setDefaultHandler()
|
||||
{
|
||||
handler= callbackHandlerMonitor;
|
||||
@@ -762,14 +886,17 @@ public:
|
||||
};
|
||||
void setDataType(chtype dt)
|
||||
{
|
||||
if (dt < DBR_PUT_ACKT) {
|
||||
if (dt < DBR_PUT_ACKT)
|
||||
{
|
||||
dataType=dt%(LAST_TYPE+1);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << "monitorPolicy FUNNY! " << dt << " is an INVALID DATATYPE! " << std::endl;
|
||||
return;
|
||||
}
|
||||
switch(cafeDbrType) {
|
||||
switch(cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
|
||||
break;
|
||||
@@ -792,16 +919,19 @@ public:
|
||||
|
||||
void setCafeDbrType( CAFENUM::DBR_TYPE cdt)
|
||||
{
|
||||
if (cdt > DBR_PUT) {
|
||||
if (cdt > DBR_PUT)
|
||||
{
|
||||
std::cout << "monitorPolicy FUNNY! " << cdt << " is an INVALID CAFENUM::DBR_TYPE! " << std::endl;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
cafeDbrType=cdt;
|
||||
}
|
||||
//std::cout << "monitorPolicy Class: " << " cafeDbrType = " << cafeDbrType << std::endl;
|
||||
//std::cout << "setDataType: " << dataType << std::endl;
|
||||
switch(cafeDbrType) {
|
||||
switch(cafeDbrType)
|
||||
{
|
||||
case CAFENUM::DBR_TIME:
|
||||
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
|
||||
break;
|
||||
@@ -823,8 +953,6 @@ public:
|
||||
//std::cout << "monitorPolicy Class: " << " dbrDataType = " << dbrDataType << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setUserArgs(void * u)
|
||||
{
|
||||
userArgs=u;
|
||||
|
||||
@@ -5,20 +5,25 @@
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#ifndef RESTOREPVGROUPXMLPARSER_H
|
||||
#define RESTOREPVGROUPXMLPARSER_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include <PVGroup.h>
|
||||
|
||||
//include <QtXml/QXmlDefaultHandler>
|
||||
#include <QXmlDefaultHandler>
|
||||
|
||||
#include <QtXml/QXmlDefaultHandler>
|
||||
|
||||
|
||||
class restorePVGroupXMLParser : public QXmlDefaultHandler {
|
||||
class restorePVGroupXMLParser : public QXmlDefaultHandler
|
||||
{
|
||||
public:
|
||||
restorePVGroupXMLParser();
|
||||
virtual ~restorePVGroupXMLParser();
|
||||
@@ -29,7 +34,8 @@ public:
|
||||
|
||||
PVGroup group;
|
||||
private:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
NotWaiting,
|
||||
WaitingForConfig,
|
||||
WaitingForNPV,
|
||||
|
||||
@@ -33,6 +33,7 @@ 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_DAQ = 900; // for use in HLAs
|
||||
const unsigned short ICAFE_STATUS_ERROR = 1000;
|
||||
const unsigned short ICAFE_FILE_ERROR = 1100;
|
||||
const unsigned short ICAFE_SERVICE_ERROR =1200;
|
||||
@@ -44,7 +45,6 @@ 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,
|
||||
@@ -75,6 +75,11 @@ enum CAFE_CC_STATE { ICAFE_CA_OP_GET=ICAFE_STATUS_CA_OP,
|
||||
ICAFE_CA_OP_CONN_DOWN
|
||||
};
|
||||
|
||||
enum CAFE_DAQ_STATE { ICAFE_DAQ_RUN= ICAFE_STATUS_DAQ,
|
||||
ICAFE_DAQ_PAUSED,
|
||||
ICAFE_DAQ_STOPPED
|
||||
};
|
||||
|
||||
enum CAFE_ERROR_STATE { ECAFE_NODATA=ICAFE_STATUS_ERROR,
|
||||
ECAFE_INVALID_TYPE,
|
||||
ECAFE_BADCOUNT,
|
||||
@@ -160,7 +165,8 @@ enum EPICS_GLOBAL_ALARM_CONDITION {STAT_NO_ALARM=0, STAT_READ, STAT_WRITE, STAT_
|
||||
enum EPICS_GLOBAL_ALARM_SEVERITY {SEV_NO_ALARM=0, SEV_MINOR, SEV_MAJOR, SEV_INVALID};
|
||||
|
||||
|
||||
class CAFEGlobalAlarmCondition {
|
||||
class CAFEGlobalAlarmCondition
|
||||
{
|
||||
typedef std::map<int, std::string> mapIntString;
|
||||
|
||||
private:
|
||||
@@ -201,12 +207,14 @@ public:
|
||||
{
|
||||
|
||||
pos = mapAlarmCondition.find(i);
|
||||
if (pos != mapAlarmCondition.end()) {
|
||||
if (pos != mapAlarmCondition.end())
|
||||
{
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
if (i == -1) {
|
||||
if (i == -1)
|
||||
{
|
||||
oss << "NO_DATA" ;
|
||||
return oss.str();
|
||||
}
|
||||
@@ -221,9 +229,9 @@ public:
|
||||
|
||||
|
||||
int asInt (std::string message)
|
||||
|
||||
{
|
||||
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
|
||||
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
|
||||
@@ -244,7 +252,8 @@ public:
|
||||
vecI.clear();
|
||||
vecI.reserve(mapAlarmCondition.size());
|
||||
|
||||
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
|
||||
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos)
|
||||
{
|
||||
vecI.push_back(pos->first);
|
||||
vecS.push_back(pos->second);
|
||||
}
|
||||
@@ -257,11 +266,14 @@ public:
|
||||
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) {
|
||||
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos)
|
||||
{
|
||||
if (pos->first < 10)
|
||||
{
|
||||
std::cout << " " << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -272,7 +284,8 @@ public:
|
||||
|
||||
|
||||
|
||||
class CAFEGlobalAlarmSeverity {
|
||||
class CAFEGlobalAlarmSeverity
|
||||
{
|
||||
typedef std::map<int, std::string> mapIntString;
|
||||
|
||||
private:
|
||||
@@ -294,13 +307,15 @@ public:
|
||||
{
|
||||
|
||||
pos = mapAlarmSeverity.find(i);
|
||||
if (pos != mapAlarmSeverity.end()) {
|
||||
if (pos != mapAlarmSeverity.end())
|
||||
{
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
|
||||
std::ostringstream oss;
|
||||
if (i == -1) {
|
||||
if (i == -1)
|
||||
{
|
||||
oss << "NO_DATA" ;
|
||||
return oss.str();
|
||||
}
|
||||
@@ -316,7 +331,8 @@ public:
|
||||
|
||||
int asInt (std::string message)
|
||||
{
|
||||
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
|
||||
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
|
||||
@@ -337,7 +353,8 @@ public:
|
||||
vecI.clear();
|
||||
vecI.reserve(mapAlarmSeverity.size());
|
||||
|
||||
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
|
||||
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos)
|
||||
{
|
||||
|
||||
vecI.push_back(pos->first);
|
||||
vecS.push_back(pos->second);
|
||||
@@ -350,7 +367,8 @@ public:
|
||||
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) {
|
||||
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos)
|
||||
{
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
@@ -414,6 +432,9 @@ public:
|
||||
* 709 ICAFE_SET_AND_GET_MISMATCH \n
|
||||
* 806 ICAFE_CA_OP_CONN_UP \n
|
||||
* 807 ICAFE_CA_OP_CONN_DOWN \n
|
||||
* 900 ICAFE_DAQ_RUN \n
|
||||
* 901 ICAFE_DAQ_PAUSED \n
|
||||
* 902 ICAFE_DAQ_STOPPED \n
|
||||
* 1000 ECAFE_NODATA \n
|
||||
* 1001 ECAFE_INVALID_TYPE \n
|
||||
* 1002 ECAFE_BADCOUNT \n
|
||||
@@ -463,13 +484,14 @@ public:
|
||||
* 1502 ECAFE_BSREAD_PARSEFAIL_DATAHEADER \n
|
||||
* 1503 ECAFE_BSREAD_ZMQSTREAM_NULL \n
|
||||
* 5004 ERRNO_EINTR \n
|
||||
* 5011 ERRNO_EGAIN \n
|
||||
* 5011 ERRNO_EAGAIN \n
|
||||
* 5014 ERRNO_EFAULT \n
|
||||
* 5022 ERRNO_EINVAL Invalid argument \n
|
||||
* 5088 ERRNO_ENOTSOCK \n
|
||||
* 5093 ERRNO_EPROTONOSUPPORT \n
|
||||
*/
|
||||
class CAFEStatusInfo {
|
||||
class CAFEStatusInfo
|
||||
{
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapStatusInfo;
|
||||
@@ -499,8 +521,11 @@ public:
|
||||
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) ICAFE_SET_AND_GET_MISMATCH, "Set and Get values from SetAndGetMethod do not match "));
|
||||
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_DAQ_RUN, "HLA DAQ in progress " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_DAQ_PAUSED, "HLA DAQ has been paused " ));
|
||||
mapStatusInfo.insert(std::make_pair((int) ICAFE_DAQ_STOPPED, "HLA DAQ has been stopped " ));
|
||||
|
||||
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! " ));
|
||||
@@ -583,13 +608,16 @@ public:
|
||||
std::string message (int i)
|
||||
{
|
||||
|
||||
if (i<ICAFE_STATUS_BASE) {
|
||||
if (i<ICAFE_STATUS_BASE)
|
||||
{
|
||||
std::string c= ca_message(i);
|
||||
return c;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
posStatusInfo = mapStatusInfo.find(i);
|
||||
if (posStatusInfo != mapStatusInfo.end()) {
|
||||
if (posStatusInfo != mapStatusInfo.end())
|
||||
{
|
||||
return posStatusInfo->second;
|
||||
}
|
||||
|
||||
@@ -609,7 +637,8 @@ public:
|
||||
std::cout << "-----------------------" << std::endl;
|
||||
std::cout << "CAFE ERROR MESSAGE LIST" << std::endl;
|
||||
std::cout << "-----------------------" << std::endl;
|
||||
for (posStatusInfo=mapStatusInfo.begin(); posStatusInfo != mapStatusInfo.end(); ++posStatusInfo) {
|
||||
for (posStatusInfo=mapStatusInfo.begin(); posStatusInfo != mapStatusInfo.end(); ++posStatusInfo)
|
||||
{
|
||||
std::cout << posStatusInfo->first << " " << posStatusInfo->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
@@ -620,7 +649,8 @@ public:
|
||||
|
||||
|
||||
|
||||
class CAFEStatusCode {
|
||||
class CAFEStatusCode
|
||||
{
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
|
||||
private:
|
||||
@@ -674,17 +704,21 @@ public:
|
||||
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_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_CA_OP_CONN_UP" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_CA_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_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) ICAFE_SET_AND_GET_MISMATCH, "CAFE INFO: ICAFE_SET_AND_GET_MISMATCH"));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_DAQ_RUN, "CAFE INFO: ICAFE_DAQ_RUN" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_DAQ_PAUSED, "CAFE INFO: ICAFE_DAQ_PAUSED" ));
|
||||
mapStatusCode.insert(std::make_pair((int) ICAFE_DAQ_STOPPED, "CAFE INFO: ICAFE_DAQ_STOPPED" ));
|
||||
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_NODATA, "CAFE ERROR: ECAFE_NODATA"));
|
||||
mapStatusCode.insert(std::make_pair((int) ECAFE_BADCOUNT, "CAFE ERROR: ECAFE_BADCOUNT"));
|
||||
@@ -756,7 +790,8 @@ public:
|
||||
{
|
||||
|
||||
pos = mapStatusCode.find(i);
|
||||
if (pos != mapStatusCode.end()) {
|
||||
if (pos != mapStatusCode.end())
|
||||
{
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
@@ -776,13 +811,16 @@ public:
|
||||
vecI.clear();
|
||||
vecI.reserve(mapStatusCode.size());
|
||||
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos)
|
||||
{
|
||||
std::size_t found = (pos->second).find(": ");
|
||||
if (found!=std::string::npos) {
|
||||
if (found!=std::string::npos)
|
||||
{
|
||||
|
||||
vecS.push_back((pos->second).substr(found+2,(pos->second).length()));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
vecS.push_back(pos->second);
|
||||
}
|
||||
vecI.push_back(pos->first);
|
||||
@@ -794,13 +832,16 @@ public:
|
||||
{
|
||||
|
||||
pos = mapStatusCode.find(i);
|
||||
if (pos != mapStatusCode.end()) {
|
||||
if (pos != mapStatusCode.end())
|
||||
{
|
||||
std::size_t found = (pos->second).find(": ");
|
||||
if (found!=std::string::npos) {
|
||||
if (found!=std::string::npos)
|
||||
{
|
||||
|
||||
return (pos->second).substr(found+2,(pos->second).length());
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return pos->second;
|
||||
}
|
||||
}
|
||||
@@ -815,7 +856,8 @@ public:
|
||||
|
||||
int enumIs (std::string message)
|
||||
{
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
|
||||
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
|
||||
@@ -826,10 +868,12 @@ public:
|
||||
|
||||
bool isTimeout(int statusCodeToCheck)
|
||||
{
|
||||
if (statusCodeToCheck==ECA_TIMEOUT || statusCodeToCheck==ECAFE_TIMEOUT) {
|
||||
if (statusCodeToCheck==ECA_TIMEOUT || statusCodeToCheck==ECAFE_TIMEOUT)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -839,7 +883,8 @@ public:
|
||||
std::cout << "-------------------" << std::endl;
|
||||
std::cout << "CAFE ERROR CODE LIST" << std::endl;
|
||||
std::cout << "-------------------" << std::endl;
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
|
||||
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos)
|
||||
{
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
@@ -849,7 +894,8 @@ public:
|
||||
|
||||
|
||||
|
||||
class CAFEStatusSeverity {
|
||||
class CAFEStatusSeverity
|
||||
{
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
|
||||
private:
|
||||
@@ -874,7 +920,7 @@ public:
|
||||
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_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"));
|
||||
@@ -915,6 +961,10 @@ public:
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "WARN"));
|
||||
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_DAQ_RUN, "INFO" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_DAQ_PAUSED, "INFO" ));
|
||||
mapStatusSeverity.insert(std::make_pair((int) ICAFE_DAQ_STOPPED, "INFO" ));
|
||||
|
||||
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"));
|
||||
@@ -984,7 +1034,8 @@ public:
|
||||
std::string message (int i)
|
||||
{
|
||||
pos = mapStatusSeverity.find(i);
|
||||
if (pos != mapStatusSeverity.end()) {
|
||||
if (pos != mapStatusSeverity.end())
|
||||
{
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
@@ -997,7 +1048,8 @@ public:
|
||||
|
||||
int enumIs (std::string message)
|
||||
{
|
||||
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
|
||||
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
|
||||
@@ -1011,7 +1063,8 @@ public:
|
||||
std::cout << "-------------------" << std::endl;
|
||||
std::cout << "CAFE STATUS SEVERITY LIST" << std::endl;
|
||||
std::cout << "-------------------" << std::endl;
|
||||
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
|
||||
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos)
|
||||
{
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "------------------" << std::endl;
|
||||
@@ -1027,7 +1080,8 @@ public:
|
||||
//code: SUCCESS: ECA_NORMAL
|
||||
//info: Normal successful completion
|
||||
//message: SUCCESS: ECA_NORMAL Normal successful completion
|
||||
class CAFEStatus {
|
||||
class CAFEStatus
|
||||
{
|
||||
|
||||
public:
|
||||
CAFEStatusSeverity css;
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
enum TM_WDAY {
|
||||
enum TM_WDAY
|
||||
{
|
||||
TM_SUNDAY = 0,
|
||||
TM_MONDAY = 1,
|
||||
TM_TUESDAY = 2,
|
||||
@@ -22,7 +23,8 @@ enum TM_WDAY {
|
||||
};
|
||||
|
||||
|
||||
enum TM_MONTHP {
|
||||
enum TM_MONTHP
|
||||
{
|
||||
TM_JAN = 1,
|
||||
TM_FEB = 2,
|
||||
TM_MAR = 3,
|
||||
@@ -42,7 +44,8 @@ enum TM_MONTHP {
|
||||
* Provides methods to convert between
|
||||
* the TM_WDAY and text equivalent
|
||||
*/
|
||||
class TMwdayText {
|
||||
class TMwdayText
|
||||
{
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapDataType;
|
||||
@@ -56,7 +59,7 @@ public:
|
||||
mapDataType.insert(std::make_pair((int) TM_WEDNESDAY, "Wed" ));
|
||||
mapDataType.insert(std::make_pair((int) TM_THURSDAY, "Thu" ));
|
||||
mapDataType.insert(std::make_pair((int) TM_FRIDAY, "Fri" ));
|
||||
mapDataType.insert(std::make_pair((int) TM_SATURDAY, "Sat" ));
|
||||
mapDataType.insert(std::make_pair((int) TM_SATURDAY, "Sat" ));
|
||||
};
|
||||
|
||||
~TMwdayText() {};
|
||||
@@ -101,7 +104,8 @@ public:
|
||||
std::cout << "------------------" << std::endl;
|
||||
std::cout << "TM_WDAY LIST" << std::endl;
|
||||
std::cout << "------------------" << std::endl;
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
|
||||
{
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "-----------------" << std::endl;
|
||||
@@ -117,7 +121,8 @@ public:
|
||||
* Provides methods to convert between
|
||||
* the TM_WDAY and text equivalent
|
||||
*/
|
||||
class TMmonthpText {
|
||||
class TMmonthpText
|
||||
{
|
||||
typedef std::map<int, std::string> mapLongString;
|
||||
private:
|
||||
mapLongString mapDataType;
|
||||
@@ -137,7 +142,7 @@ public:
|
||||
mapDataType.insert(std::make_pair((int) TM_OCT, "Oct" ));
|
||||
mapDataType.insert(std::make_pair((int) TM_NOV, "Nov" ));
|
||||
mapDataType.insert(std::make_pair((int) TM_DEC, "Dec" ));
|
||||
|
||||
|
||||
};
|
||||
|
||||
~TMmonthpText() {};
|
||||
@@ -182,7 +187,8 @@ public:
|
||||
std::cout << "------------------" << std::endl;
|
||||
std::cout << "TM_MONTH(+1) LIST" << std::endl;
|
||||
std::cout << "------------------" << std::endl;
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
|
||||
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
|
||||
{
|
||||
std::cout << pos->first << " " << pos->second << std::endl;
|
||||
}
|
||||
std::cout << "-----------------" << std::endl;
|
||||
|
||||
@@ -1345,14 +1345,23 @@ template <class CTYPE> int Transpose<CTYPE>::get(
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaData().getDbrDataType();
|
||||
_dataTypeClient = (*it_handle).getChannelRequestMetaDataClient().getDataType();
|
||||
|
||||
|
||||
//if (_handle==1) {
|
||||
// _dataTypeClient=DBR_FLOAT;
|
||||
//}
|
||||
|
||||
//std::cout << "WHAT IS ON THE DATA BUFFER = " << dbrTypeRequest_DataBuffer << std::endl;
|
||||
//std::cout << "WHAT THE CLIENT WANTS = " << _dataTypeClient << std::endl;
|
||||
|
||||
////dbr_string_t * val2 = new dbr_string_t[nelem];
|
||||
|
||||
ts.secPastEpoch=0;
|
||||
ts.nsec =0;
|
||||
alarmStatus =-1;
|
||||
alarmSeverity =-1;
|
||||
|
||||
//This will happen for DBF_NO_ACCESS = 7
|
||||
// in which case do not use dbr_type_to_text !!
|
||||
|
||||
if (_dataTypeClient < DBR_STRING || _dataTypeClient > DBR_DOUBLE) {
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
@@ -1735,15 +1744,25 @@ template <class CTYPE> int Transpose<CTYPE>::get(
|
||||
default:
|
||||
switch(_dataTypeClient) {
|
||||
case DBR_STRING:
|
||||
memcpy( val, &(&((PVDataL)->strval))[offset], sizeof(dbr_string_t)*nelem);
|
||||
//DEFINE stringf array then copy to CTYPE
|
||||
|
||||
memcpy( val, &(&((PVDataL)->tstrval.value))[offset], sizeof(dbr_string_t)*nelem);
|
||||
|
||||
//for (unsigned int i=0; i<nelem; ++i) {
|
||||
// val[i]= (CTYPE) strtod( val2[i], NULL);
|
||||
//}
|
||||
|
||||
|
||||
break;
|
||||
case DBR_SHORT:
|
||||
case DBR_LONG:
|
||||
case DBR_ENUM:
|
||||
case DBR_CHAR:
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
val[i]= (CTYPE) strtol( (*(&((PVDataL)->tstrval.value)+i+offset)), NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case DBR_FLOAT:
|
||||
case DBR_DOUBLE:
|
||||
@@ -1767,6 +1786,7 @@ template <class CTYPE> int Transpose<CTYPE>::get(
|
||||
handleHelper.setSTS(_handle, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
|
||||
////delete [] val2;
|
||||
}
|
||||
else {
|
||||
cafeStatus.report(ECAFE_INVALID_HANDLE);
|
||||
|
||||
1416
include/zbsDataHolders.h
Normal file
1416
include/zbsDataHolders.h
Normal file
File diff suppressed because it is too large
Load Diff
77
include/zbsHash.h
Normal file
77
include/zbsHash.h
Normal file
@@ -0,0 +1,77 @@
|
||||
///
|
||||
/// \file zbsHash.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: January 2018
|
||||
/// \version CAFE 1.6
|
||||
|
||||
#ifndef ZBSHASH_H
|
||||
#define ZBSHASH_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;
|
||||
using namespace boost::multi_index;
|
||||
|
||||
|
||||
struct bsreadContainer
|
||||
{
|
||||
long by_bsID;
|
||||
std::string by_bsName;
|
||||
|
||||
bsreadContainer(long _id, std::string _name):by_bsID(_id),by_bsName(_name) {};
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const bsreadContainer& m)
|
||||
{
|
||||
//os<<m.by_bsID << " " << m.by_bsName << std::endl;
|
||||
os << m.by_bsName << std::endl;
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
struct by_bsID {};
|
||||
struct by_bsName {};
|
||||
|
||||
typedef multi_index_container<
|
||||
bsreadContainer,
|
||||
indexed_by<
|
||||
ordered_unique<
|
||||
tag<by_bsName>, BOOST_MULTI_INDEX_MEMBER(bsreadContainer, std::string, by_bsName)>,
|
||||
ordered_non_unique<
|
||||
tag<by_bsID>, BOOST_MULTI_INDEX_MEMBER(bsreadContainer, long, by_bsID )> >
|
||||
> bsreadContainer_set;
|
||||
|
||||
|
||||
template<typename Tag,typename MultiIndexContainer>
|
||||
void print_out_by(
|
||||
const MultiIndexContainer& s,
|
||||
Tag* =0
|
||||
)
|
||||
{
|
||||
|
||||
// obtain a reference to the index tagged by Tag
|
||||
|
||||
const typename boost::multi_index::index<MultiIndexContainer,Tag>::type& i=
|
||||
get<Tag>(s);
|
||||
|
||||
typedef typename MultiIndexContainer::value_type value_type;
|
||||
|
||||
// dump the elements of the index to cout
|
||||
std::cout << "--------------" << std::endl;
|
||||
std::cout << " ENUMERATED LIST " << std::endl;
|
||||
std::cout << "--------------" << std::endl;
|
||||
std::copy(i.begin(),i.end(),std::ostream_iterator<value_type>(std::cout));
|
||||
std::cout << "--------------------" << std::endl;
|
||||
}
|
||||
|
||||
typedef bsreadContainer_set::index<by_bsID>::type bsreadContainer_set_by_id;
|
||||
typedef bsreadContainer_set::index<by_bsName>::type bsreadContainer_set_by_name;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
865
include/zbsdtHelper.h
Normal file
865
include/zbsdtHelper.h
Normal file
@@ -0,0 +1,865 @@
|
||||
///
|
||||
/// \file zbsdtHelper.h
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: January 2018
|
||||
/// \version CAFE 1.6
|
||||
|
||||
#ifndef ZBSDTHELPER_H
|
||||
#define ZBSDTHELPER_H
|
||||
|
||||
#include <zbsHash.h>
|
||||
#include <bitshuffle/bitshuffle.h>
|
||||
namespace CAFE_BSHELPER
|
||||
{
|
||||
|
||||
using boost::multi_index_container;
|
||||
using namespace boost::multi_index;
|
||||
|
||||
bsreadContainer_set bsdt;
|
||||
|
||||
std::vector<BSChannel> bsrdV;
|
||||
|
||||
|
||||
//Type maching is as follows:
|
||||
// int8 [1 byte] to char
|
||||
// uint8 [1] to unsigned char
|
||||
// int16 [2] to short
|
||||
// uint16 [2] to unsigned short
|
||||
// int32 [4] to long
|
||||
// uint32 [4] to unsigned long
|
||||
// int64 [8] to long long
|
||||
// uint64 [8] to unsigned long long
|
||||
// float32[4] to float
|
||||
// float64[8] to double
|
||||
// bool [1] same as uint8; 0=false, !0 = true
|
||||
// string to char (Byte order of strings are irrelevant - always big-endian). The String encoding is utf8; from bsread documentation
|
||||
|
||||
enum bsdtIndex {BS_INT8=0, BS_UINT8, BS_INT16, BS_UINT16,
|
||||
BS_INT32, BS_UINT32, BS_INT64, BS_UINT64,
|
||||
BS_FLOAT32, BS_FLOAT64, BS_BOOL, BS_STRING, BS_CHAR=BS_STRING
|
||||
};
|
||||
|
||||
void bsdtInsert()
|
||||
{
|
||||
bsdt.insert(bsreadContainer(BS_INT8, "int8"));
|
||||
bsdt.insert(bsreadContainer(BS_UINT8, "uint8"));
|
||||
bsdt.insert(bsreadContainer(BS_INT16, "int16"));
|
||||
bsdt.insert(bsreadContainer(BS_UINT16, "uint16"));
|
||||
bsdt.insert(bsreadContainer(BS_INT32, "int32"));
|
||||
bsdt.insert(bsreadContainer(BS_UINT32, "uint32"));
|
||||
bsdt.insert(bsreadContainer(BS_INT64, "int64"));
|
||||
bsdt.insert(bsreadContainer(BS_UINT64, "uint64"));
|
||||
bsdt.insert(bsreadContainer(BS_FLOAT32,"float32"));
|
||||
bsdt.insert(bsreadContainer(BS_FLOAT64,"float64"));
|
||||
bsdt.insert(bsreadContainer(BS_BOOL, "bool"));
|
||||
bsdt.insert(bsreadContainer(BS_STRING, "string"));
|
||||
bsdt.insert(bsreadContainer(BS_CHAR, "string"));
|
||||
}
|
||||
|
||||
|
||||
int getByteSize(unsigned int dt)
|
||||
{
|
||||
#define __METHOD__ "getByteSize (unsigned int)"
|
||||
switch(dt)
|
||||
{
|
||||
case BS_INT8:
|
||||
return sizeof(int8_t);
|
||||
case BS_UINT8:
|
||||
case BS_BOOL:
|
||||
return sizeof(uint8_t);
|
||||
case BS_INT16:
|
||||
return sizeof(int16_t);
|
||||
case BS_UINT16:
|
||||
return sizeof(uint16_t);
|
||||
case BS_INT32:
|
||||
return sizeof(int32_t);
|
||||
case BS_UINT32:
|
||||
return sizeof(uint32_t);
|
||||
case BS_INT64:
|
||||
return sizeof(int64_t);
|
||||
case BS_UINT64:
|
||||
return sizeof(uint64_t);
|
||||
case BS_FLOAT32:
|
||||
return sizeof(float);
|
||||
case BS_FLOAT64:
|
||||
return sizeof(double);
|
||||
case BS_STRING: //is also BS_CHAR
|
||||
return sizeof(char);
|
||||
default:
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "Enumerated input value " << dt << " is outside allowed band: " << BS_INT8 << " and " << BS_STRING << std::endl;
|
||||
print_out_by<by_bsID>(bsdt);
|
||||
std::cout << "Returning byte size of 1" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
int getByteSize(std::string dt)
|
||||
{
|
||||
#define __METHOD__ "getByteSize (string)"
|
||||
bsreadContainer_set_by_name & name_index = bsdt.get<by_bsName> ();
|
||||
bsreadContainer_set_by_name::iterator it_name;
|
||||
unsigned int bsdtIndex;
|
||||
|
||||
//Find enum of data type
|
||||
it_name = name_index.find(dt);
|
||||
if ( (it_name) != name_index.end() )
|
||||
{
|
||||
bsdtIndex=(*it_name).by_bsID;
|
||||
return getByteSize(bsdtIndex);
|
||||
}
|
||||
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "string value " << dt << " is not recognized " << std::endl;
|
||||
print_out_by<by_bsID>(bsdt);
|
||||
std::cout << "Returning byte size of 1" << std::endl;
|
||||
return 1;
|
||||
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Easy show-error-and-bail function.
|
||||
//void run_screaming(const char *message, const int code) {
|
||||
// printf("%s\n", message);
|
||||
// exit(code);
|
||||
// return;
|
||||
//}
|
||||
|
||||
/**
|
||||
* \brief Generic function to display bits of a number
|
||||
* used for testing in zmq stream
|
||||
*/
|
||||
void printBits(int const size, void const * const ptr)
|
||||
{
|
||||
unsigned char *b= (unsigned char *) ptr;
|
||||
unsigned char byte;
|
||||
int i, j;
|
||||
for (i=size-1; i>=0; i--)
|
||||
{
|
||||
for (j=7; j>=0; j--)
|
||||
{
|
||||
byte =(b[i]>>j ) &1;
|
||||
printf("%u", byte);
|
||||
}
|
||||
}
|
||||
puts("");
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns true if at least one bit within byte is set
|
||||
* Used to test endianess of timestamp
|
||||
*/
|
||||
bool hasMinOneBitSet(int const size, void const * const ptr)
|
||||
{
|
||||
unsigned char *b= (unsigned char *) ptr;
|
||||
unsigned char byte;
|
||||
|
||||
bool hasBit = false;
|
||||
int i, j;
|
||||
for (i=size-1; i>=0; i--)
|
||||
{
|
||||
for (j=7; j>=0; j--)
|
||||
{
|
||||
byte =(b[i]>>j ) &1;
|
||||
if (byte) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Unfolds the two bytes that precede the blob
|
||||
* See: https://git.psi.ch/sf_daq/ch.psi.daq.dispatcherrest
|
||||
* and: https://git.psi.ch/sf_daq/bsread_specification
|
||||
*/
|
||||
int unfoldPreBlob(const char * data, long &uncompressedSize, int &blockSize)
|
||||
{
|
||||
|
||||
//Check for -ve numbers
|
||||
uncompressedSize = ( ((data[7] <<0) & 0x7f) | ((data[7]<<0) & 0x80) | (data[6]<<8) | (data[5]<<16) | (data[4]<<24)
|
||||
| ((long long) data[3]<<32) | ((long long) data[2]<<40) | ((long long) data[1]<<48) | ((long long) data[0]<<56) ) ;
|
||||
|
||||
// printBits(2, &uncompressedSize);
|
||||
|
||||
|
||||
//std::cout << "UNCOMPRESSED SIZE / " << uncompressedSizeL << " " << uncompressedSize << std::endl;
|
||||
|
||||
|
||||
|
||||
//uncompressedSize = ( ((data[7] <<0) & 0x7f) | ((data[7]<<0) & 0x80) | (data[6]<<8) | (data[5]<<16) | (data[4]<<24)
|
||||
// | ((long long) data[3]<<32) | ((long long) data[2]<<40) | ((long long) data[1]<<48) | ((long long) data[0]<<56) ) ;
|
||||
//std::cout << "UNCOMPRESSED SIZE // " << uncompressedSize << std::endl;
|
||||
|
||||
|
||||
//All three give equivalent block size
|
||||
//blockSize= ( (data[11]<<0) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24) );
|
||||
//std::cout << "BLOCKSIZE " << blockSize << std::endl;
|
||||
|
||||
blockSize= ( ((data[11]<<0)) | ((data[11]<<0)& 0x80) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24) );
|
||||
//std::cout << "BLOCKSIZE / " << blockSize << std::endl;
|
||||
|
||||
//blockSize= ( ((data[11]<<0) & 0x7f) | ((data[11]<<0)& 0x80) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24) );
|
||||
//std::cout << "BLOCKSIZE // " << blockSize << std::endl;
|
||||
|
||||
return ICAFE_NORMAL;;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief DataBitset Template \n
|
||||
* CTYPE is the integer type the data type is to be rendered to the client \n
|
||||
* method unfold() will receive data and then convert to CTYPE
|
||||
*/
|
||||
template <class CTYPE> class DataBitset
|
||||
{
|
||||
public:
|
||||
DataBitset () {};
|
||||
~DataBitset () {};
|
||||
CTYPE unfold(char * data, size_t start, size_t end, std::string encoding )
|
||||
{
|
||||
//std::cout << "encoding=" << encoding << std::endl;
|
||||
if (encoding=="big")
|
||||
{
|
||||
//big endian
|
||||
for (short n=start; n < end; n++)
|
||||
{
|
||||
i = (i << 8) + data[n];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//little endian
|
||||
for (short n = end; n >= start; n--)
|
||||
{
|
||||
i = (i << 8) + data[n];
|
||||
}
|
||||
}
|
||||
//std::cout << "Value = " << i << std::endl;
|
||||
return i;
|
||||
}
|
||||
private:
|
||||
CTYPE i;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief IntegerBitset Template \n
|
||||
* CTYPE is the integer type the data type is to be rendered to the client \n
|
||||
* method unfold() will receive data and then convert to vector<CTYPE>
|
||||
*/
|
||||
template <class CTYPE> class IntegerBitsetV
|
||||
{
|
||||
public:
|
||||
IntegerBitsetV () {};
|
||||
~IntegerBitsetV () {};
|
||||
|
||||
CTYPE unfold(char * data, unsigned int nelem, std::string encoding, std::vector<CTYPE> &valV )
|
||||
{
|
||||
valV.clear();
|
||||
valV.reserve(nelem);
|
||||
cSize=sizeof(CTYPE);
|
||||
idx=0;
|
||||
if (encoding=="big")
|
||||
{
|
||||
switch (cSize)
|
||||
{
|
||||
case 1:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal= (data[idx+1]<<0) & 0xff;
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal= ( ((data[idx+1]<<0) & 0xff) | ((data[idx]<<8) & 0xffff));
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal= ( ((data[idx+3]<<0) & 0xff ) | ((data[idx+2]<<8) & 0xffff )
|
||||
| ((data[idx+1]<<16) & 0xffffff) | ((data[idx]<<24) & 0xffffffff) );
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal= ( ((data[idx+7]<<0) & 0xff) | ((data[idx+6]<<8) & 0xffff )
|
||||
| ((data[idx+5]<<16) & 0xffffff ) | ((data[idx+4]<<24) & 0xffffffff )
|
||||
| (((long long) data[idx+3]<<32) & 0xffffffffff)
|
||||
| (((long long) data[idx+2]<<40) & 0xffffffffffff)
|
||||
| (((long long) data[idx+1]<<48) & 0xffffffffffffff)
|
||||
| (((long long) data[idx]<<56) & 0xffffffffffffffff) ) ;
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
|
||||
}
|
||||
}
|
||||
else //little endian
|
||||
{
|
||||
switch (cSize)
|
||||
{
|
||||
case 1:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal= (data[idx]<<0) & 0xff;
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal= ( ( (data[idx]<<0) & 0xff ) | ( (data[idx+1]<<8) & 0xffff) );
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal= ( ( (data[idx]<<0) & 0xff) | ( (data[idx+1]<<8) & 0xffff )
|
||||
| ( (data[idx+2]<<16) & 0xffffff) | ((data[idx+3]<<24) & 0xffffffff ));
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal = ( ( (data[idx]<<0) & 0xFF) | ( (data[idx+1]<<8) & 0xFFFF)
|
||||
| ((data[idx+2]<<16) & 0xFFFFFF) | ( (data[idx+3]<<24) & 0xFFFFFFFF)
|
||||
| (((long long) data[idx+4]<<32) & 0xFFFFFFFFFF )
|
||||
| (((long long) data[idx+5]<<40) & 0xFFFFFFFFFFFF )
|
||||
| (((long long) data[idx+6]<<48) & 0xFFFFFFFFFFFFFF )
|
||||
| (((long long) data[idx+7]<<56) & 0xFFFFFFFFFFFFFFFF ) ) ;
|
||||
valV.push_back(iVal);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
|
||||
}
|
||||
}
|
||||
return valV[0]; //scalar value
|
||||
}
|
||||
private:
|
||||
unsigned int cSize;
|
||||
unsigned int idx;
|
||||
CTYPE iVal;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief IntegerBitset Template \n
|
||||
* CTYPE is the integer type the data type is to be rendered to the client \n
|
||||
* method unfold() will receive data and then convert to CTYPE *
|
||||
*/
|
||||
template <class CTYPE> class IntegerBitset
|
||||
{
|
||||
public:
|
||||
IntegerBitset () {};
|
||||
~IntegerBitset () {};
|
||||
|
||||
CTYPE * unfold(char * data, unsigned int nelem, std::string encoding )
|
||||
{
|
||||
//std::cout << sizeof(char) << " s+ " << sizeof(short) << " i+ " << sizeof(int) << " l+ " <<sizeof(long) << " ll+ " << sizeof(long long) << std::endl;
|
||||
cSize=sizeof(CTYPE);
|
||||
idx=0;
|
||||
iVal=new CTYPE[nelem];
|
||||
//std::cout << "cSize " << cSize << std::endl;
|
||||
//std::cout << "nelem " << nelem << " encoding" << encoding << std::endl;
|
||||
if (encoding=="big")
|
||||
{
|
||||
switch (cSize)
|
||||
{
|
||||
case 1:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal[i]= data[idx]<<0 & 0xff;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal[i]= ( ((data[idx+1]<<0) & 0xff) | ((data[idx]<<8) & 0xffff));
|
||||
//char is=data[idx]; printBits(1,&is);
|
||||
//is=data[idx+1]; printBits(1,&is);
|
||||
//iVal[i]=( (data[idx+1]<<0) | (data[idx]<<8) );
|
||||
//short ss=iVal[i];
|
||||
//printBits(2, &ss);
|
||||
//std::cout << iVal[i] << " [" << i << "] " ;
|
||||
}
|
||||
//std::cout << std::endl;
|
||||
break;
|
||||
case 4:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal[i]=( ((data[idx+3]<<0) & 0xff ) | ((data[idx+2]<<8) & 0xffff )
|
||||
| ((data[idx+1]<<16) & 0xffffff) | ((data[idx]<<24) & 0xffffffff) );
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal[i]= ( ((data[idx+7]<<0) & 0xff) | ((data[idx+6]<<8) & 0xffff )
|
||||
| ((data[idx+5]<<16) & 0xffffff ) | ((data[idx+4]<<24) & 0xffffffff )
|
||||
| (((long long) data[idx+3]<<32) & 0xffffffffff)
|
||||
| (((long long) data[idx+2]<<40) & 0xffffffffffff)
|
||||
| (((long long) data[idx+1]<<48) & 0xffffffffffffff)
|
||||
| (((long long) data[idx]<<56) & 0xffffffffffffffff) ) ;
|
||||
}
|
||||
default:
|
||||
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
|
||||
}
|
||||
}
|
||||
else //little endian
|
||||
{
|
||||
switch (cSize)
|
||||
{
|
||||
case 1:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal[i]= (data[idx]<<0) & 0xff;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal[i]=( ( (data[idx]<<0) & 0xff ) | ( (data[idx+1]<<8) & 0xffff) );
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
|
||||
iVal[i]=( ( (data[idx]<<0) & 0xff) | ( (data[idx+1]<<8) & 0xffff )
|
||||
| ( (data[idx+2]<<16) & 0xffffff) | ((data[idx+3]<<24) & 0xffffffff ));
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
idx=i*cSize;
|
||||
iVal[i]=( ( (data[idx]<<0) & 0xFF) | ( (data[idx+1]<<8) & 0xFFFF)
|
||||
| ((data[idx+2]<<16) & 0xFFFFFF) | ( (data[idx+3]<<24) & 0xFFFFFFFF)
|
||||
| (((long long) data[idx+4]<<32) & 0xFFFFFFFFFF )
|
||||
| (((long long) data[idx+5]<<40) & 0xFFFFFFFFFFFF )
|
||||
| (((long long) data[idx+6]<<48) & 0xFFFFFFFFFFFFFF )
|
||||
| (((long long) data[idx+7]<<56) & 0xFFFFFFFFFFFFFFFF ) ) ;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return iVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
CTYPE unfoldScalar(char * data, std::string encoding )
|
||||
{
|
||||
cSize=sizeof(CTYPE);
|
||||
idx=0;
|
||||
|
||||
if (encoding=="big")
|
||||
{
|
||||
switch (cSize)
|
||||
{
|
||||
case 1:
|
||||
idx=0;
|
||||
iValScalar = data[idx]<<0 & 0xff;
|
||||
break;
|
||||
case 2:
|
||||
idx=0;
|
||||
iValScalar=( ((data[idx+1]<<0) & 0xff) | ((data[idx]<<8) & 0xffff));
|
||||
break;
|
||||
case 4:
|
||||
idx=0;
|
||||
iValScalar=( ((data[idx+3]<<0) & 0xff) | ((data[idx+2]<<8) & 0xffff)
|
||||
| ((data[idx+1]<<16) & 0xffffff) | ((data[idx]<<24) & 0xffffffff) );
|
||||
break;
|
||||
case 8:
|
||||
idx=0;
|
||||
iValScalar=( ((data[idx+7]<<0) & 0xff) | ((data[idx+6]<<8) & 0xffff )
|
||||
| ((data[idx+5]<<16) & 0xffffff ) | ((data[idx+4]<<24) & 0xffffffff )
|
||||
| (((long long) data[idx+3]<<32) & 0xffffffffff)
|
||||
| (((long long) data[idx+2]<<40) & 0xffffffffffff)
|
||||
| (((long long) data[idx+1]<<48) & 0xffffffffffffff)
|
||||
| (((long long) data[idx]<<56) & 0xffffffffffffffff) ) ;
|
||||
break;
|
||||
default:
|
||||
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
|
||||
}
|
||||
}
|
||||
else //little endian
|
||||
{
|
||||
switch (cSize)
|
||||
{
|
||||
case 1:
|
||||
idx=0;
|
||||
iValScalar= (data[idx]<<0) & 0xff;
|
||||
break;
|
||||
case 2:
|
||||
idx=0;
|
||||
iValScalar=( ( (data[idx]<<0) & 0xff ) | ( (data[idx+1]<<8) & 0xffff) );
|
||||
break;
|
||||
case 4:
|
||||
idx=0;
|
||||
iValScalar=( ( (data[idx]<<0) & 0xff) | ( (data[idx+1]<<8) & 0xffff )
|
||||
| ( (data[idx+2]<<16) & 0xffffff) | ((data[idx+3]<<24) & 0xffffffff ));
|
||||
break;
|
||||
case 8:
|
||||
idx=0;
|
||||
iValScalar=( ( (data[idx]<<0) & 0xFF) | ( (data[idx+1]<<8) & 0xFFFF)
|
||||
| ((data[idx+2]<<16) & 0xFFFFFF) | ( (data[idx+3]<<24) & 0xFFFFFFFF)
|
||||
| (((long long) data[idx+4]<<32) & 0xFFFFFFFFFF )
|
||||
| (((long long) data[idx+5]<<40) & 0xFFFFFFFFFFFF )
|
||||
| (((long long) data[idx+6]<<48) & 0xFFFFFFFFFFFFFF )
|
||||
| (((long long) data[idx+7]<<56) & 0xFFFFFFFFFFFFFFFF ) ) ;
|
||||
break;
|
||||
default:
|
||||
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
|
||||
}
|
||||
}
|
||||
return iValScalar;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int cSize;
|
||||
unsigned int idx;
|
||||
CTYPE * iVal;
|
||||
CTYPE iValScalar;
|
||||
};
|
||||
|
||||
|
||||
// big endian
|
||||
// int uc = ( ( (data[7]<<0) & 0x7f) | ((data[7]<<0) & 0x80) | (data[6]<<8) | (data[5]<<16) | (data[4]<<24) | ((long long) data[3]<<32)
|
||||
// | ((long long) data[2]<<40) | ((long long) data[1]<<48) | ((long long) data[0]<<56) ) ;
|
||||
//
|
||||
// int bs = ( ( (data[11]<<0) & 0x7f) | ((data[11]<<0) & 0x80) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24));
|
||||
|
||||
// big endian
|
||||
// bs = ( ( (regen_buffer[n] <<24) ) | ( (regen_buffer[n+1] <<26) ) | ( (regen_buffer[n+2] <<8) )
|
||||
// | ( (regen_buffer[n+3] <<0) & 0x7f) | (regen_buffer[n+3] <<0) & 0x80 ) ;
|
||||
|
||||
/**
|
||||
* \brief FloatBitset Template \n
|
||||
* CTYPE is the float type of the data type to be rendered to the client \n
|
||||
* method unfold() will receive data and then convert to CTYPE
|
||||
*/
|
||||
template <class CTYPE> class FloatBitset
|
||||
{
|
||||
public:
|
||||
FloatBitset () {};
|
||||
~FloatBitset () {};
|
||||
CTYPE * unfold(char * data, unsigned int nelem, std::string encoding)
|
||||
{
|
||||
cSize=sizeof(CTYPE);
|
||||
val=new CTYPE[nelem];
|
||||
//std::cout << "HELPER>H " << nelem << " " << encoding << " cSize " << cSize << std::endl;
|
||||
if (encoding=="big")
|
||||
{
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
start=i*cSize;
|
||||
end=(i+1)*cSize;
|
||||
//std::cout << start << " // " << end << std::endl;
|
||||
inst=0;
|
||||
|
||||
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
|
||||
{
|
||||
|
||||
idx=(nelem*cSize)-1-char_nbr;
|
||||
|
||||
//std::cout << inst << " " << idx << std::endl;
|
||||
bar.c[inst]=data[idx];
|
||||
++inst;
|
||||
}
|
||||
//std::cout << "i= " << i << " " << std::endl;
|
||||
//std::cout << bar.v << " [" << i << "] " << std::endl;
|
||||
val[nelem-1-i]=bar.v;
|
||||
//std::cout << val[nelem-1-i] << " [" << (nelem-1-i) << "] " << std::endl;
|
||||
}
|
||||
}
|
||||
// little endian
|
||||
|
||||
else
|
||||
{
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
start=i*cSize;
|
||||
end=(i+1)*cSize;
|
||||
inst=0;
|
||||
|
||||
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
|
||||
{
|
||||
bar.c[inst]=data[char_nbr];
|
||||
++inst;
|
||||
}
|
||||
val[i]=bar.v;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
CTYPE unfoldScalar(char * data, std::string encoding)
|
||||
{
|
||||
cSize=sizeof(CTYPE);
|
||||
|
||||
if (encoding=="big")
|
||||
{
|
||||
start=0;
|
||||
end=cSize;
|
||||
inst=0;
|
||||
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
|
||||
{
|
||||
idx=cSize-1-char_nbr;
|
||||
bar.c[inst]=data[idx];
|
||||
++inst;
|
||||
}
|
||||
}
|
||||
|
||||
// little endian
|
||||
else
|
||||
{
|
||||
|
||||
start=0;
|
||||
end=cSize;
|
||||
inst=0;
|
||||
|
||||
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
|
||||
{
|
||||
bar.c[inst]=data[char_nbr];
|
||||
++inst;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return bar.v;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
CTYPE unfold(char * data, size_t start, size_t end, std::string encoding )
|
||||
{
|
||||
if (encoding=="big") {
|
||||
// big endian
|
||||
for (size_t char_nbr = start; char_nbr < end; char_nbr++) {
|
||||
bar.c[char_nbr]=data[end-1-char_nbr];
|
||||
}
|
||||
} else {
|
||||
// little endian
|
||||
for (size_t char_nbr = start; char_nbr < end; char_nbr++) {
|
||||
bar.c[char_nbr]=data[char_nbr];
|
||||
}
|
||||
}
|
||||
|
||||
//std::cout << "UNION D " << bar.v << std::endl;
|
||||
return bar.v;
|
||||
}
|
||||
*/
|
||||
private:
|
||||
union dUnion
|
||||
{
|
||||
char c[sizeof(CTYPE)];
|
||||
CTYPE v;
|
||||
} bar;
|
||||
CTYPE * val;
|
||||
unsigned int cSize;
|
||||
int start;
|
||||
int end;
|
||||
int inst;
|
||||
int idx;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief FloatBitsetV Template \n
|
||||
* CTYPE is the float type of the data type to be rendered to the client \n
|
||||
* method unfold() will receive data and then convert to vector<CTYPE>
|
||||
*/
|
||||
template <class CTYPE> class FloatBitsetV
|
||||
{
|
||||
public:
|
||||
FloatBitsetV () {};
|
||||
~FloatBitsetV () {};
|
||||
CTYPE unfold(char * data, unsigned int nelem, std::string encoding, std::vector<CTYPE> &valV)
|
||||
{
|
||||
|
||||
//memory already allocated in zbsread.h
|
||||
//valV.clear();
|
||||
//valV.reserve(nelem);
|
||||
cSize=sizeof(CTYPE);
|
||||
//std::cout << "HELPER_H " << nelem << " " << encoding << " cSize " << cSize << std::endl;
|
||||
|
||||
if (encoding=="big")
|
||||
{
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
|
||||
start=i*cSize;
|
||||
end=(i+1)*cSize;
|
||||
std::cout << start << " // " << end << std::endl;
|
||||
inst=0;
|
||||
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
|
||||
{
|
||||
idx=(nelem*cSize)-1-char_nbr;
|
||||
bar.c[inst]=data[idx];
|
||||
++inst;
|
||||
}
|
||||
|
||||
std::cout << bar.v << " [" << (nelem-1-i) << "] " ;
|
||||
valV[nelem-1-i]=bar.v;
|
||||
std::cout << valV[nelem-1-i] << " [" << (nelem-1-i) << "] " ;
|
||||
|
||||
//valV.push_back(bar.v);
|
||||
|
||||
}
|
||||
}
|
||||
else // little endian
|
||||
{
|
||||
for (unsigned int i=0; i<nelem; ++i)
|
||||
{
|
||||
start=i*cSize;
|
||||
end=(i+1)*cSize;
|
||||
inst=0;
|
||||
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
|
||||
{
|
||||
bar.c[inst]=data[char_nbr];
|
||||
++inst;
|
||||
}
|
||||
std::cout << bar.v << " [" << i << "] " ;
|
||||
valV[i]=bar.v;
|
||||
//valV.push_back(bar.v);
|
||||
}
|
||||
}
|
||||
std::cout << std::endl;
|
||||
return valV[0]; //scalar value
|
||||
}
|
||||
|
||||
private:
|
||||
union dUnion
|
||||
{
|
||||
char c[sizeof(CTYPE)];
|
||||
CTYPE v;
|
||||
} bar;
|
||||
unsigned int cSize;
|
||||
int start;
|
||||
int end;
|
||||
int inst;
|
||||
int idx;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Routine that decompresses the compressed WFs and other data
|
||||
*/
|
||||
int bitshuffleDecompress( const char * data, char* & regen_buffer, int sizeData, int dtByteSize)
|
||||
{
|
||||
#define __METHOD__ "bitshuffleDecompress"
|
||||
long uncompressedSize=0;
|
||||
int blockSize=0;
|
||||
int localDebug=0;
|
||||
|
||||
int sizeBlob = sizeData-BSREAD_PREBLOB_BYTES;
|
||||
if (sizeBlob <1)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "WARNING: data size " << sizeData << " is less than BSREAD_PREBLOB_BYTES " << BSREAD_PREBLOB_BYTES << std::endl;
|
||||
std::cout << "This should not happen. Probably we are trying to decompress uncompressed data! " << std::endl;
|
||||
return ECAFE_BITSHUFF_BADCOUNT;
|
||||
} //Should not happen
|
||||
|
||||
unfoldPreBlob(data, uncompressedSize, blockSize);
|
||||
//std::cout << "Uncompressed/Block size: " << uncompressedSize << " / " << blockSize << std::endl;
|
||||
|
||||
//decompress
|
||||
int dataNelem=uncompressedSize/dtByteSize;
|
||||
//use bitshuffle terminology
|
||||
regen_buffer = (char *) malloc(uncompressedSize);
|
||||
if (regen_buffer == NULL)
|
||||
{
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "FAILED TO ALLOC MEM of size: " << uncompressedSize << std::endl;
|
||||
return ECAFE_BITSHUFF_ALLOCMEM;
|
||||
}
|
||||
|
||||
char * dataBlob = new char[sizeBlob];
|
||||
int ij=0;
|
||||
if(localDebug) std::cout << " BSREAD_PREBLOB_BYTES " << BSREAD_PREBLOB_BYTES <<std::endl;
|
||||
if(localDebug) std::cout << " sizeData " << sizeData <<std::endl;
|
||||
if(localDebug) std::cout << " sizeBlob " << sizeBlob <<std::endl;
|
||||
if(localDebug) std::cout << " dataNelem " << dataNelem <<std::endl;
|
||||
if(localDebug) std::cout << " dtByteSize " << dtByteSize <<std::endl;
|
||||
for (int char_nbr = BSREAD_PREBLOB_BYTES; char_nbr < sizeData; char_nbr++)
|
||||
{
|
||||
dataBlob[ij]=data[char_nbr];
|
||||
++ij;
|
||||
}
|
||||
//Use 0 rather than given block size as is recommended
|
||||
const int decompressed_size = bshuf_decompress_lz4((const char *) dataBlob, regen_buffer, dataNelem, dtByteSize, 0);
|
||||
delete [] dataBlob;
|
||||
if(localDebug) std::cout << " " << " decompressed_size " << decompressed_size << std::endl;
|
||||
if (decompressed_size < 0)
|
||||
{
|
||||
return ECAFE_BITSHUFF_DECOMPRESS;
|
||||
}
|
||||
else if (decompressed_size == 0)
|
||||
{
|
||||
if(localDebug)std::cout << "0 decompressed size! Should have a positive number for successful deompression?" <<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(localDebug)std::cout << "We successfully decompressed some data!" <<std::endl;
|
||||
}
|
||||
// Not only does a positive return value mean success,
|
||||
// value returned == number of bytes regenerated from compressed_data stream.
|
||||
// We can use this to realloc() *regen_buffer to free up memory
|
||||
// Did this at first to remove spurious trailing characters
|
||||
// BUT AVOID AT ALL COSTS; screws up regen_buffer content!!
|
||||
/*
|
||||
regen_buffer = (char *)realloc(regen_buffer, decompressed_size);
|
||||
if (regen_buffer == NULL) {
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "WARNING with status code: " << ECAFE_BITSHUFF_REALLOCMEM << std::endl;
|
||||
std::cout << "Failed to reallocate memory for compressed data. Not a show stopper" << std::endl;
|
||||
}
|
||||
*/
|
||||
return ICAFE_NORMAL;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
1766
include/zbsread.h
Normal file
1766
include/zbsread.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user