new release
This commit is contained in:
@@ -29,7 +29,7 @@ private:
|
||||
|
||||
PolicyHelper policyHelper;
|
||||
|
||||
HandleHelper helper;
|
||||
HandleHelper helper;
|
||||
|
||||
Conduit cc;
|
||||
ChannelTimeoutPolicy channelTimeoutPolicyGet;
|
||||
@@ -48,11 +48,11 @@ private:
|
||||
bool isCacheRequest);
|
||||
public:
|
||||
|
||||
Instant (){};
|
||||
~Instant (){};
|
||||
Instant () {};
|
||||
~Instant () {};
|
||||
|
||||
int set(const unsigned int *handleArray, const unsigned int nelem,
|
||||
const chtype _dbrType, const CTYPE * val, int *statusArray);
|
||||
const chtype _dbrType, const CTYPE * val, int *statusArray);
|
||||
|
||||
int set(const unsigned int _handle, const chtype dbrType, const CTYPE * _val);
|
||||
|
||||
@@ -60,27 +60,35 @@ public:
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
|
||||
|
||||
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
|
||||
{
|
||||
epicsTimeStamp ts;
|
||||
return get(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val){
|
||||
dbr_short_t alarmStatus; dbr_short_t alarmSeverity; epicsTimeStamp ts;
|
||||
return get(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val)
|
||||
{
|
||||
dbr_short_t alarmStatus;
|
||||
dbr_short_t alarmSeverity;
|
||||
epicsTimeStamp ts;
|
||||
return get(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
|
||||
|
||||
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
|
||||
{
|
||||
epicsTimeStamp ts;
|
||||
return getCache(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val){
|
||||
dbr_short_t alarmStatus; dbr_short_t alarmSeverity; epicsTimeStamp ts;
|
||||
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val)
|
||||
{
|
||||
dbr_short_t alarmStatus;
|
||||
dbr_short_t alarmSeverity;
|
||||
epicsTimeStamp ts;
|
||||
return getCache(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
@@ -90,181 +98,190 @@ public:
|
||||
|
||||
int getCache(const unsigned int *handleArray, const unsigned int nelem,
|
||||
const chtype _dbrType, CTYPE * val, int *statusArray,
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity ) {
|
||||
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity )
|
||||
{
|
||||
epicsTimeStamp * ts;
|
||||
return getCache(handleArray, nelem, _dbrType, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
int getCache(const unsigned int *handleArray, const unsigned int nelem,
|
||||
const chtype _dbrType, CTYPE * val, int *statusArray) {
|
||||
dbr_short_t * alarmStatus; dbr_short_t * alarmSeverity; epicsTimeStamp * ts;
|
||||
const chtype _dbrType, CTYPE * val, int *statusArray)
|
||||
{
|
||||
dbr_short_t * alarmStatus;
|
||||
dbr_short_t * alarmSeverity;
|
||||
epicsTimeStamp * ts;
|
||||
return getCache(handleArray, nelem, _dbrType, val, statusArray,
|
||||
alarmStatus, alarmSeverity, ts);
|
||||
};
|
||||
|
||||
int setAndGet(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, CTYPE &valGet);
|
||||
int setAndMatch(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, const unsigned int handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int setAndMatchMany(vector<unsigned int> handleSetV, const chtype dbrType, vector<CTYPE> valSet, vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int setTriggerAndMatchMany(vector<unsigned int> handleSetV, const chtype dbrType, vector<CTYPE> valSet,
|
||||
vector<unsigned int> handleAction, vector<string> valAction, vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int matchMany( const chtype dbrType, vector<CTYPE> valSet, vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
int setAndMatchMany(std::vector<unsigned int> handleSetV, const chtype dbrType, std::vector<CTYPE> valSet, std::vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int match( const chtype dbrType, CTYPE valSet, unsigned int handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int setMany(vector<unsigned int> handleSet, const chtype dbrType, vector<CTYPE> valSet, bool printFlag);
|
||||
|
||||
|
||||
|
||||
int compareAndMatchMany(vector<unsigned int> handleSet, const chtype dbrType, vector<CTYPE> valSet, vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
int setTriggerAndMatchMany(std::vector<unsigned int> handleSetV, const chtype dbrType, std::vector<CTYPE> valSet,
|
||||
std::vector<unsigned int> handleAction, std::vector<std::string> valAction, std::vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int matchMany( const chtype dbrType, std::vector<CTYPE> valSet, std::vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int match( const chtype dbrType, CTYPE valSet, unsigned int handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
int setMany(std::vector<unsigned int> handleSet, const chtype dbrType, std::vector<CTYPE> valSet, bool printFlag);
|
||||
|
||||
|
||||
|
||||
int setManyString(vector<unsigned int> handleSet, vector<string> valSet, bool printFlag) {
|
||||
int compareAndMatchMany(std::vector<unsigned int> handleSet, const chtype dbrType, std::vector<CTYPE> valSet, std::vector<unsigned int> handleMatch,
|
||||
CTYPE tolerance, double timeout, bool printFlag);
|
||||
|
||||
#define __METHOD__ "Instant<CTYPE>::setMany(vector<unsigned int>handleSet, chtype, vector<CTYPE>valSet)"
|
||||
|
||||
CAFEStatus cstat;
|
||||
|
||||
|
||||
status=ICAFE_NORMAL;
|
||||
|
||||
if (handleSet.size() != valSet.size() ) {
|
||||
return ECAFE_HANDLE_MISMATCH_SET_AND_MATCH;
|
||||
}
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
int setManyString(std::vector<unsigned int> handleSet, std::vector<std::string> valSet, bool printFlag)
|
||||
{
|
||||
|
||||
if (!helper.isChannelConnected(handleSet[i])) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "NOT ALL CHANNELS CONNECTED: " << endl;
|
||||
if (!helper.isChannelConnected(handleSet[i])) {
|
||||
helper.printHandle(handleSet[i]);
|
||||
status=helper.getStatus(handleSet[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (status!=ICAFE_NORMAL) {return status;}
|
||||
|
||||
if(printFlag) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
}
|
||||
|
||||
|
||||
if (printFlag) {
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
|
||||
cout << "SETTING PV=" << helper.getPVFromHandle(handleSet[i]) << " to " << valSet[i] << endl;
|
||||
|
||||
|
||||
} //for
|
||||
|
||||
} //if
|
||||
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
|
||||
|
||||
|
||||
//set No of Elements to 1
|
||||
#define __METHOD__ "Instant<CTYPE>::setMany(vector<unsigned int>handleSet, chtype, vector<CTYPE>valSet)"
|
||||
|
||||
unsigned int nelemPrevious, nelemRequestedCheck=0;
|
||||
unsigned int nelemRequested=1;
|
||||
|
||||
nelemPrevious=helper.getNelemClient(handleSet[i]);
|
||||
//Check the number of elements requested?
|
||||
if (nelemPrevious>1) {
|
||||
nelemRequestedCheck = helper.setNelem(handleSet[i],nelemRequested);
|
||||
if (nelemRequestedCheck != nelemRequested) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Internal CAFE FUNNY: Wanted to set the no. elements from: "
|
||||
<< nelemPrevious << endl;
|
||||
cout << "to: " << nelemRequested << " but got instead: "
|
||||
<< nelemRequestedCheck << endl;
|
||||
CAFEStatus cstat;
|
||||
|
||||
|
||||
status=ICAFE_NORMAL;
|
||||
|
||||
if (handleSet.size() != valSet.size() ) {
|
||||
return ECAFE_HANDLE_MISMATCH_SET_AND_MATCH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//policy set synchronous
|
||||
ChannelRequestPolicy polPrevious, polNow;
|
||||
|
||||
policyHelper.getChannelRequestPolicyPut(handleSet[i], polPrevious);
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
|
||||
polNow.setMethodKind(WITHOUT_CALLBACK);
|
||||
polNow.setWaitKind(WAIT);
|
||||
polNow.setWhenToFlushSendBuffer(FLUSH_AUTOMATIC);
|
||||
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])) {
|
||||
helper.printHandle(handleSet[i]);
|
||||
status=helper.getStatus(handleSet[i]);
|
||||
}
|
||||
}
|
||||
|
||||
policyHelper.setChannelRequestPolicyPut(handleSet[i], polNow);
|
||||
|
||||
dbr_string_t valSetA[1];
|
||||
|
||||
|
||||
helper.removeLeadingAndTrailingSpaces(valSet[i].c_str(), valSetA[0]);
|
||||
|
||||
|
||||
status=set(handleSet[i], DBR_STRING, valSetA);
|
||||
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cstat.report(status);
|
||||
}
|
||||
|
||||
policyHelper.setChannelRequestPolicyPut(handleSet[i], polPrevious);
|
||||
|
||||
|
||||
unsigned int nelemPreviousCheck=nelemPrevious;
|
||||
nelemRequested=1;
|
||||
//Switch back to previous value
|
||||
//if (nelemPrevious>1) {
|
||||
if(helper.getNelemRequest(handleSet[i])!= nelemPrevious) {
|
||||
nelemPreviousCheck= helper.setNelem(handleSet[i],nelemPrevious);
|
||||
if (nelemPreviousCheck != nelemPrevious) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Internal CAFE FUNNY: Wanted to re-set the no. elements from: "
|
||||
<< nelemRequested << endl;
|
||||
cout << "to the previous: " << nelemPrevious << " but got instead: "
|
||||
<< nelemPreviousCheck << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} //for size_t
|
||||
|
||||
return status;
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if(printFlag) {
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
}
|
||||
|
||||
|
||||
if (printFlag) {
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
|
||||
std::cout << "SETTING PV=" << helper.getPVFromHandle(handleSet[i]) << " to " << valSet[i] << std::endl;
|
||||
|
||||
|
||||
} //for
|
||||
|
||||
} //if
|
||||
|
||||
|
||||
for (size_t i=0; i< handleSet.size(); ++i) {
|
||||
|
||||
|
||||
|
||||
//set No of Elements to 1
|
||||
|
||||
unsigned int nelemPrevious, nelemRequestedCheck=0;
|
||||
unsigned int nelemRequested=1;
|
||||
|
||||
nelemPrevious=helper.getNelemClient(handleSet[i]);
|
||||
//Check the number of elements requested?
|
||||
if (nelemPrevious>1) {
|
||||
nelemRequestedCheck = helper.setNelem(handleSet[i],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;
|
||||
std::cout << "to: " << nelemRequested << " but got instead: "
|
||||
<< nelemRequestedCheck << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//policy set synchronous
|
||||
ChannelRequestPolicy polPrevious, polNow;
|
||||
|
||||
policyHelper.getChannelRequestPolicyPut(handleSet[i], polPrevious);
|
||||
|
||||
polNow.setMethodKind(WITHOUT_CALLBACK);
|
||||
polNow.setWaitKind(WAIT);
|
||||
polNow.setWhenToFlushSendBuffer(FLUSH_AUTOMATIC);
|
||||
|
||||
policyHelper.setChannelRequestPolicyPut(handleSet[i], polNow);
|
||||
|
||||
dbr_string_t valSetA[1];
|
||||
|
||||
|
||||
helper.removeLeadingAndTrailingSpaces(valSet[i].c_str(), valSetA[0]);
|
||||
|
||||
|
||||
status=set(handleSet[i], DBR_STRING, valSetA);
|
||||
|
||||
if (status!=ICAFE_NORMAL) {
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
cstat.report(status);
|
||||
}
|
||||
|
||||
policyHelper.setChannelRequestPolicyPut(handleSet[i], polPrevious);
|
||||
|
||||
|
||||
unsigned int nelemPreviousCheck=nelemPrevious;
|
||||
nelemRequested=1;
|
||||
//Switch back to previous value
|
||||
//if (nelemPrevious>1) {
|
||||
if(helper.getNelemRequest(handleSet[i])!= nelemPrevious) {
|
||||
nelemPreviousCheck= helper.setNelem(handleSet[i],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;
|
||||
std::cout << "to the previous: " << nelemPrevious << " but got instead: "
|
||||
<< nelemPreviousCheck << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} //for size_t
|
||||
|
||||
return status;
|
||||
#undef __METHOD__
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set followed by an immediate get
|
||||
* \param handleSet input: handle
|
||||
* \param valSet input: string value to set
|
||||
* \param valGet output: string value to get
|
||||
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
|
||||
*/
|
||||
int setAndGetString(const unsigned int handleSet, string valSet, string &valGet) {
|
||||
#define __METHOD__ "Instant<CTYPE>::setAndGetString(const unsigned int handleSet, string valSet, string &valGet"
|
||||
/**
|
||||
* \brief Set followed by an immediate get
|
||||
* \param handleSet input: handle
|
||||
* \param valSet input: string value to set
|
||||
* \param valGet output: string value to get
|
||||
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
|
||||
*/
|
||||
int setAndGetString(const unsigned int handleSet, std::string valSet, std::string &valGet)
|
||||
{
|
||||
#define __METHOD__ "Instant<CTYPE>::setAndGetString(const unsigned int handleSet, std::string valSet, std::string &valGet"
|
||||
//CheckPolicy
|
||||
|
||||
dbr_string_t valGetA[1]; dbr_string_t valSetA[1];
|
||||
dbr_string_t valGetA[1];
|
||||
dbr_string_t valSetA[1];
|
||||
|
||||
strcpy(valGetA[0],"0");
|
||||
valGet="0";
|
||||
|
||||
|
||||
helper.removeLeadingAndTrailingSpaces(valSet.c_str(), valSetA[0]);
|
||||
|
||||
|
||||
status=Instant::set(handleSet, DBR_STRING, valSetA);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
status=Instant::get(handleSet, DBR_STRING, valGetA);
|
||||
@@ -279,66 +296,70 @@ return status;
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
//Check if number
|
||||
istringstream ins, ous;
|
||||
double oud=0;
|
||||
//Check if number
|
||||
std::istringstream ins, ous;
|
||||
double oud=0;
|
||||
ous.clear();
|
||||
ous.str(valGetA[0]);
|
||||
ous>>oud;
|
||||
double ind=0;
|
||||
double ind=0;
|
||||
ins.clear();
|
||||
ins.str(valSetA[0]);
|
||||
ins>>ind;
|
||||
|
||||
|
||||
if ( !ous.fail() && !ins.fail()) {
|
||||
if (ind==oud) {return ICAFE_NORMAL;}
|
||||
if (ind==oud) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
}
|
||||
//Cater for enums that are refered to by their integer values in string format
|
||||
else if (!ins.fail()) {
|
||||
short enumval=-1;
|
||||
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
|
||||
//Convert integer to string
|
||||
|
||||
stringstream ss;
|
||||
ss << enumval;
|
||||
valGet= ss.str();
|
||||
if ((short)ind==enumval) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << endl;
|
||||
cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet.c_str() << endl;
|
||||
//Cater for enums that are refered to by their integer values in string format
|
||||
else if (!ins.fail()) {
|
||||
short enumval=-1;
|
||||
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
|
||||
//Convert integer to string
|
||||
|
||||
std::stringstream ss;
|
||||
ss << enumval;
|
||||
valGet= ss.str();
|
||||
if ((short)ind==enumval) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << std::endl;
|
||||
std::cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet.c_str() << std::endl;
|
||||
return ICAFE_SET_AND_GET_MISMATCH;
|
||||
#undef __METHOD__
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set followed by an immediate get
|
||||
* \param handleSet input: handle
|
||||
* \param valSet input: dbr_string_t value to set
|
||||
* \param valGet output: dbr_string_t value to get
|
||||
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
|
||||
*/
|
||||
int setAndGetDbrString(const unsigned int handleSet, dbr_string_t valSet, dbr_string_t &valGet) {
|
||||
|
||||
/**
|
||||
* \brief Set followed by an immediate get
|
||||
* \param handleSet input: handle
|
||||
* \param valSet input: dbr_string_t value to set
|
||||
* \param valGet output: dbr_string_t value to get
|
||||
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
|
||||
*/
|
||||
int setAndGetDbrString(const unsigned int handleSet, dbr_string_t valSet, dbr_string_t &valGet)
|
||||
{
|
||||
#define __METHOD__ "Instant<CTYPE>::setAndGetDbrString(const unsigned int handleSet, dbr_string_tvalSet, dbr_string_t &valGet"
|
||||
//CheckPolicy
|
||||
|
||||
dbr_string_t valGetA[1]; dbr_string_t valSetA[1];
|
||||
dbr_string_t valGetA[1];
|
||||
dbr_string_t valSetA[1];
|
||||
|
||||
strcpy(valGetA[0],"0");
|
||||
strcpy(valGet,"0");
|
||||
|
||||
helper.removeLeadingAndTrailingSpaces(valSet, valSetA[0]);
|
||||
|
||||
|
||||
helper.removeLeadingAndTrailingSpaces(valSet, valSetA[0]);
|
||||
|
||||
status=Instant::set(handleSet, DBR_STRING, valSetA);
|
||||
if (status==ICAFE_NORMAL) {
|
||||
status=Instant::get(handleSet, DBR_STRING, valGetA);
|
||||
@@ -353,48 +374,50 @@ return status;
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
//Check if number
|
||||
//Check if number
|
||||
istringstream ins, ous;
|
||||
double oud=0;
|
||||
//Check if number
|
||||
//Check if number
|
||||
std::istringstream ins, ous;
|
||||
double oud=0;
|
||||
ous.clear();
|
||||
ous.str(valGetA[0]);
|
||||
ous>>oud;
|
||||
double ind=0;
|
||||
double ind=0;
|
||||
ins.clear();
|
||||
ins.str(valSetA[0]);
|
||||
ins>>ind;
|
||||
|
||||
if ( !ous.fail() && !ins.fail()) {
|
||||
if (ind==oud) {return ICAFE_NORMAL;}
|
||||
if (ind==oud) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
}
|
||||
//Cater for enums that are refered to by their integer values in string format
|
||||
else if (!ins.fail()) {
|
||||
short enumval=-1;
|
||||
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
|
||||
//Convert integer to string
|
||||
stringstream ss;
|
||||
ss << enumval;
|
||||
strcpy(valGet, ss.str().c_str());
|
||||
|
||||
if ((short) ind==enumval) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Cater for enums that are refered to by their integer values in string format
|
||||
else if (!ins.fail()) {
|
||||
short enumval=-1;
|
||||
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << endl;
|
||||
cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet << endl;
|
||||
enumval=helper.getEnumFromString(handleSet, valGet);
|
||||
|
||||
//Convert integer to string
|
||||
std::stringstream ss;
|
||||
ss << enumval;
|
||||
strcpy(valGet, ss.str().c_str());
|
||||
|
||||
if ((short) ind==enumval) {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
|
||||
std::cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << std::endl;
|
||||
std::cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet << std::endl;
|
||||
return ICAFE_SET_AND_GET_MISMATCH;
|
||||
#undef __METHOD__
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
#include "instant.cpp"
|
||||
|
||||
Reference in New Issue
Block a user