new release
This commit is contained in:
191400
src/PyCafe2.cpp
191400
src/PyCafe2.cpp
File diff suppressed because it is too large
Load Diff
272414
src/PyCafe3.cpp
272414
src/PyCafe3.cpp
File diff suppressed because it is too large
Load Diff
155122
src/PyCafe3_March7.cpp
155122
src/PyCafe3_March7.cpp
File diff suppressed because it is too large
Load Diff
5027
src/cafe.cpp
5027
src/cafe.cpp
File diff suppressed because it is too large
Load Diff
1196
src/cafeCache.cpp
1196
src/cafeCache.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file cafeEnumStrings.h
|
||||
/// \file cafeEnumStrings.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -9,30 +9,32 @@
|
||||
#include "enumStrings.h"
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelWaitForResponsePolicyKind>::data[]
|
||||
= {"CAFENUM::WAIT", "CAFENUM::NO_WAIT"};
|
||||
= {"CAFENUM::WAIT", "CAFENUM::NO_WAIT"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelRequestDataTypePolicyKind>::data[]
|
||||
= {"CAFENUM::NATIVE_DATATYPE", "CAFENUM::LOWEST_DATATYPE"};
|
||||
= {"CAFENUM::NATIVE_DATATYPE", "CAFENUM::LOWEST_DATATYPE"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelFlushSendBufferPolicyKind>::data[]
|
||||
= {"CAFENUM::WITH_FLUSH_IO","CAFENUM::WITH_PEND_IO","CAFENUM::WITH_PEND_EVENT", "CAFENUM::WITH_POLL"};
|
||||
= {"CAFENUM::WITH_FLUSH_IO","CAFENUM::WITH_PEND_IO","CAFENUM::WITH_PEND_EVENT", "CAFENUM::WITH_POLL"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelWhenToFlushSendBufferPolicyKind>::data[]
|
||||
= {"CAFENUM::FLUSH_AFTER_EACH_MESSAGE","CAFENUM::FLUSH_DESIGNATED_TO_CLIENT"};
|
||||
= {"CAFENUM::FLUSH_AFTER_EACH_MESSAGE","CAFENUM::FLUSH_DESIGNATED_TO_CLIENT"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::ChannelRequestPolicyKind>::data[]
|
||||
= {"CAFENUM::WITHOUT_CALLBACK","CAFENUM::WITH_CALLBACK_DEFAULT","CAFENUM::WITH_CALLBACK_USER_SUPPLIED"};
|
||||
= {"CAFENUM::WITHOUT_CALLBACK","CAFENUM::WITH_CALLBACK_DEFAULT","CAFENUM::WITH_CALLBACK_USER_SUPPLIED"};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::DBR_TYPE>::data[]
|
||||
= {"CAFENUM::DBR_PRIMITIVE","CAFENUM::DBR_STS","CAFENUM::DBR_TIME", "CAFENUM::DBR_GR",
|
||||
"CAFENUM::DBR_CTRL","CAFENUM::DBR_PUT", "CAFENUM::DBR_STSACK","CAFENUM::DBR_CLASS",
|
||||
"CAFENUM::DBR_OTHER"};
|
||||
= {"CAFENUM::DBR_PRIMITIVE","CAFENUM::DBR_STS","CAFENUM::DBR_TIME", "CAFENUM::DBR_GR",
|
||||
"CAFENUM::DBR_CTRL","CAFENUM::DBR_PUT", "CAFENUM::DBR_STSACK","CAFENUM::DBR_CLASS",
|
||||
"CAFENUM::DBR_OTHER"
|
||||
};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::StatusMessageKind>::data[]
|
||||
= {"CAFENUM::NO_MESSAGE","CAFENUM::PRE_REQUEST","CAFENUM::FROM_REQUEST","CAFENUM::FROM_PEND",
|
||||
"CAFENUM::FROM_CALLBACK"};
|
||||
= {"CAFENUM::NO_MESSAGE","CAFENUM::PRE_REQUEST","CAFENUM::FROM_REQUEST","CAFENUM::FROM_PEND",
|
||||
"CAFENUM::FROM_CALLBACK"
|
||||
};
|
||||
|
||||
template<> char const * enumStrings<CAFENUM::CallbackProgressKind>::data[]
|
||||
= {"CAFENUM::NOT_INITIATED","CAFENUM::PENDING","CAFENUM::COMPLETE"};
|
||||
= {"CAFENUM::NOT_INITIATED","CAFENUM::PENDING","CAFENUM::COMPLETE"};
|
||||
|
||||
|
||||
|
||||
2375
src/cafeGroup.cpp
2375
src/cafeGroup.cpp
File diff suppressed because it is too large
Load Diff
1642
src/cafeVectors.cpp
1642
src/cafeVectors.cpp
File diff suppressed because it is too large
Load Diff
180
src/cafeXML.cpp
180
src/cafeXML.cpp
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file cafeXML.cc
|
||||
/// \file cafeXML.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date November 2014
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -8,20 +8,19 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <ctime>
|
||||
#include "cafe.h"
|
||||
#include <cafe.h>
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
|
||||
#include <loadCollectionXMLParser.h>
|
||||
#include <loadGroupXMLParser.h>
|
||||
#include <restorePVGroupXMLParser.h>
|
||||
|
||||
|
||||
#include "loadCollectionXMLParser.h"
|
||||
#include "loadGroupXMLParser.h"
|
||||
#include "restorePVGroupXMLParser.h"
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::posix_time;
|
||||
|
||||
/**
|
||||
@@ -30,8 +29,9 @@ using namespace boost::posix_time;
|
||||
* \param collectionFile input: name of collection file
|
||||
* \return ICAFE_NORMAL if OK else ECAFE_LOAD_COLLECTION;
|
||||
*/
|
||||
int CAFE::loadCollectionsFromXML(const char * collectionFile) {
|
||||
#define __METHOD__ "CAFE::loadCollectionsFromXML(char * collectionFile)"
|
||||
int CAFE::loadCollectionsFromXML(const char * collectionFile)
|
||||
{
|
||||
#define __METHOD__ "CAFE::loadCollectionsFromXML(char * collectionFile)"
|
||||
|
||||
//First check for existence of file in current directory
|
||||
//before searching in CAFE_XML_PATH
|
||||
@@ -45,7 +45,7 @@ int CAFE::loadCollectionsFromXML(const char * collectionFile) {
|
||||
std::string envS;
|
||||
char * env = getenv("CAFE_XML_PATH");
|
||||
env == NULL ? envS=std::string(".") : envS=std::string(env);
|
||||
envS.append("/"); //("/Collections/");
|
||||
envS.append("/"); //("/Collections/");
|
||||
envS.append(collectionFile);
|
||||
|
||||
file = new QFile(envS.c_str());
|
||||
@@ -54,15 +54,15 @@ int CAFE::loadCollectionsFromXML(const char * collectionFile) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "envS=" << envS << endl;
|
||||
cout << "COLLECTION FILE " << collectionFile << " NOT FOUND " << endl;
|
||||
cout << "IN THE CURRENT (OR GIVEN) DIRECTORY" << endl;
|
||||
if (env != NULL) {
|
||||
cout << "NOR IN CAFE_XML_PATH/=" << endl;
|
||||
cout << env << endl;
|
||||
}
|
||||
else {
|
||||
cout << "OPTIONAL ENVIRONMENT VARIABLE CAFE_XML_PATH IS UNDEFINED" << endl;
|
||||
}
|
||||
delete file;
|
||||
cout << "IN THE CURRENT (OR GIVEN) DIRECTORY" << endl;
|
||||
if (env != NULL) {
|
||||
cout << "NOR IN CAFE_XML_PATH/=" << endl;
|
||||
cout << env << endl;
|
||||
}
|
||||
else {
|
||||
cout << "OPTIONAL ENVIRONMENT VARIABLE CAFE_XML_PATH IS UNDEFINED" << endl;
|
||||
}
|
||||
delete file;
|
||||
return ECAFE_LOAD_COLLECTION;
|
||||
}
|
||||
}
|
||||
@@ -84,10 +84,10 @@ int CAFE::loadCollectionsFromXML(const char * collectionFile) {
|
||||
return ECAFE_LOAD_COLLECTION;
|
||||
}
|
||||
deviceCollectionV=handler.deviceCollectionV;
|
||||
|
||||
//cout << deviceCollectionV[0].getCMembers()[0].devicePosition << endl;
|
||||
//cout << deviceCollectionV[1].getCMembers()[0].devicePosition << endl;
|
||||
|
||||
|
||||
//cout << deviceCollectionV[0].getCMembers()[0].devicePosition << endl;
|
||||
//cout << deviceCollectionV[1].getCMembers()[0].devicePosition << endl;
|
||||
|
||||
return ICAFE_NORMAL;
|
||||
|
||||
#undef __METHOD__
|
||||
@@ -101,7 +101,8 @@ int CAFE::loadCollectionsFromXML(const char * collectionFile) {
|
||||
* \param groupFile input: name of group file
|
||||
* \return ICAFE_NORMAL if OK else ECAFE_LOAD_GROUP;
|
||||
*/
|
||||
int CAFE::loadGroupsFromXML (const char * groupFile) {
|
||||
int CAFE::loadGroupsFromXML (const char * groupFile)
|
||||
{
|
||||
#define __METHOD__ "CAFE::loadGroupsFromXML(char * groupFile)"
|
||||
|
||||
int localStatus=ICAFE_NORMAL;
|
||||
@@ -114,7 +115,7 @@ int CAFE::loadGroupsFromXML (const char * groupFile) {
|
||||
std::string envS;
|
||||
char * env = getenv("CAFE_XML_PATH");
|
||||
env == NULL ? envS=std::string(".") : envS=std::string(env);
|
||||
envS.append("/"); //envS.append("/Groups/");
|
||||
envS.append("/"); //envS.append("/Groups/");
|
||||
envS.append(groupFile);
|
||||
|
||||
file = new QFile(envS.c_str());
|
||||
@@ -122,16 +123,16 @@ int CAFE::loadGroupsFromXML (const char * groupFile) {
|
||||
if (!file->exists()) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "GROUP FILE " << groupFile << " NOT FOUND " << endl;
|
||||
cout << "NEITHER IN THE CURRENT (OR GIVEN) DIRECTORY" << endl;
|
||||
cout << "NEITHER IN THE CURRENT (OR GIVEN) DIRECTORY" << endl;
|
||||
|
||||
if (env != NULL) {
|
||||
cout << "NOR IN CAFE_XML_PATH/=" << endl;
|
||||
cout << env << endl;
|
||||
}
|
||||
else {
|
||||
cout << "OPTIONAL ENVIRONMENT VARIABLE CAFE_XML_PATH IS UNDEFINED" << endl;
|
||||
}
|
||||
delete file;
|
||||
if (env != NULL) {
|
||||
cout << "NOR IN CAFE_XML_PATH/=" << endl;
|
||||
cout << env << endl;
|
||||
}
|
||||
else {
|
||||
cout << "OPTIONAL ENVIRONMENT VARIABLE CAFE_XML_PATH IS UNDEFINED" << endl;
|
||||
}
|
||||
delete file;
|
||||
|
||||
return ECAFE_LOAD_GROUP;
|
||||
}
|
||||
@@ -157,7 +158,7 @@ int CAFE::loadGroupsFromXML (const char * groupFile) {
|
||||
|
||||
|
||||
for (std::vector<deviceGroup>::const_iterator group=handler.groups.begin();
|
||||
group!=handler.groups.end();++group) {
|
||||
group!=handler.groups.end(); ++group) {
|
||||
|
||||
if(isGroup((char *)(*group).getName().c_str())) {
|
||||
|
||||
@@ -171,12 +172,14 @@ int CAFE::loadGroupsFromXML (const char * groupFile) {
|
||||
}
|
||||
|
||||
PVGroup pg;
|
||||
vector<std::string> pvList; pvList.clear();
|
||||
vector<std::string> pvList;
|
||||
pvList.clear();
|
||||
strcpy(pg.name,(*group).getName().c_str());
|
||||
|
||||
|
||||
//Loop round all collections;
|
||||
vector<collectionInGroup> cg; cg.clear();
|
||||
vector<collectionInGroup> cg;
|
||||
cg.clear();
|
||||
|
||||
cg=(*group).getCollections();
|
||||
|
||||
@@ -235,7 +238,8 @@ int CAFE::loadGroupsFromXML (const char * groupFile) {
|
||||
* \param snapshotFile input: char * snapshotFile
|
||||
* \return ICAFE_NORMAL if OK else first ECAFE/ICAFE error encountered
|
||||
*/
|
||||
int CAFE::restoreFromXML (const char * snapshotFile) {
|
||||
int CAFE::restoreFromXML (const char * snapshotFile)
|
||||
{
|
||||
#define __METHOD__ "CAFE::restoreFromXML(char * snapshotFile)"
|
||||
|
||||
int localStatus=ICAFE_NORMAL;
|
||||
@@ -346,15 +350,9 @@ int CAFE::restoreFromXML (const char * snapshotFile) {
|
||||
return localStatus;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief snapshot2XML \n
|
||||
* Takes a PVGroup snapshot and writes data to a timestamped file \n
|
||||
@@ -362,7 +360,8 @@ int CAFE::restoreFromXML (const char * snapshotFile) {
|
||||
* \param pg input: PVGroup pg
|
||||
* \return ICAFE_NORMAL if OK else first ECAFE/ICAFE error encountered
|
||||
*/
|
||||
int CAFE::snapshot2XML (PVGroup pg) {
|
||||
int CAFE::snapshot2XML (PVGroup pg)
|
||||
{
|
||||
#define __METHOD__ "CAFE::snapshot2XML(PVGroup pg)"
|
||||
|
||||
std::string s="<cafe:config>\n";
|
||||
@@ -372,20 +371,20 @@ int CAFE::snapshot2XML (PVGroup pg) {
|
||||
|
||||
s.append(gname);
|
||||
s.append("\">\n");
|
||||
char sBuffer[60]; char sBufferNPV[60];
|
||||
char sBuffer[60];
|
||||
char sBufferNPV[60];
|
||||
|
||||
int overallStatus=groupGet(pg.getGroupHandle(),pg);
|
||||
PVDataHolder * pvd = pg.getPVData();
|
||||
|
||||
unsigned int hl=0;
|
||||
|
||||
s.append("<cafe:npv> ");
|
||||
sprintf(sBufferNPV,"%d", pg.npv);
|
||||
sprintf(sBufferNPV,"%u", pg.npv);
|
||||
s.append(sBufferNPV);
|
||||
s.append(" </cafe:npv>\n");
|
||||
|
||||
//First determine maximum pv size
|
||||
unsigned short maxL=0; string sn="";
|
||||
unsigned short maxL=0;
|
||||
std::string sn="";
|
||||
for (unsigned int j=0; j<pg.getNPV(); ++j) {
|
||||
sn=pvd[j].getPV();
|
||||
if(sn.size() > maxL) maxL=sn.size()+0;
|
||||
@@ -402,17 +401,20 @@ int CAFE::snapshot2XML (PVGroup pg) {
|
||||
s.append(" </cafe:nelem><cafe:val> ");
|
||||
|
||||
for (unsigned int i=0; i<pvd[j].getNelem(); ++i) {
|
||||
s.append(pvd[j].getAsString(i)); s.append(" ");
|
||||
s.append(pvd[j].getAsString(i));
|
||||
s.append(" ");
|
||||
}
|
||||
s.append("</cafe:val><cafe:settable> ");
|
||||
|
||||
hl=getHandleHelper().getHandleFromPVWithinGroup(pvd[j].getPV(), pg.getGroupHandle() );
|
||||
unsigned int hl=getHandleHelper().getHandleFromPVWithinGroup(pvd[j].getPV(), pg.getGroupHandle() );
|
||||
|
||||
ChannelRegalia cr;
|
||||
getInfo().getChannelRegalia(hl, cr);
|
||||
|
||||
if ( cr.getWriteAccess() ) {
|
||||
s.append("true");} else {
|
||||
s.append("true");
|
||||
}
|
||||
else {
|
||||
s.append("false");
|
||||
}
|
||||
|
||||
@@ -441,13 +443,13 @@ int CAFE::snapshot2XML (PVGroup pg) {
|
||||
fsname.append(pg.getName());
|
||||
char s1[255];
|
||||
sprintf(s1,"_%d_%d_%d_%d:%d:%d", (1900 + ltm->tm_year),(1+ltm->tm_mon),
|
||||
ltm->tm_mday,ltm->tm_hour,ltm->tm_min,ltm->tm_sec );
|
||||
ltm->tm_mday,ltm->tm_hour,ltm->tm_min,ltm->tm_sec );
|
||||
fsname.append(s1);
|
||||
fsname.append(".xml");
|
||||
|
||||
|
||||
ofstream myfile;
|
||||
myfile.open (fsname.c_str(), ios::out);
|
||||
std::ofstream myfile;
|
||||
myfile.open (fsname.c_str(), std::ios::out);
|
||||
myfile << s;
|
||||
myfile.close();
|
||||
|
||||
@@ -466,12 +468,13 @@ int CAFE::snapshot2XML (PVGroup pg) {
|
||||
* \param fileName input: filename to which PVGroup data is written
|
||||
* \return ICAFE_NORMAL if OK else first ECAFE/ICAFE error encountered
|
||||
*/
|
||||
void CAFE::openGroupXMLFile(string fileName) {
|
||||
ofstream myfile;
|
||||
myfile.open (fileName.c_str(), ios::out);
|
||||
std::string s="<cafe:config>\n";
|
||||
myfile << s;
|
||||
return myfile.close();
|
||||
void CAFE::openGroupXMLFile(std::string fileName)
|
||||
{
|
||||
std::ofstream myfile;
|
||||
myfile.open (fileName.c_str(), std::ios::out);
|
||||
std::string s="<cafe:config>\n";
|
||||
myfile << s;
|
||||
return myfile.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -481,12 +484,13 @@ void CAFE::openGroupXMLFile(string fileName) {
|
||||
* \param fileName input: filename to which PVGroup data is written
|
||||
* \return ICAFE_NORMAL if OK else first ECAFE/ICAFE error encountered
|
||||
*/
|
||||
void CAFE::closeGroupXMLFile(string fileName) {
|
||||
ofstream myfile;
|
||||
myfile.open (fileName.c_str(), ios::app);
|
||||
std::string s="</cafe:config>\n";
|
||||
myfile << s;
|
||||
return myfile.close();
|
||||
void CAFE::closeGroupXMLFile(std::string fileName)
|
||||
{
|
||||
std::ofstream myfile;
|
||||
myfile.open (fileName.c_str(), std::ios::app);
|
||||
std::string s="</cafe:config>\n";
|
||||
myfile << s;
|
||||
return myfile.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -498,39 +502,33 @@ void CAFE::closeGroupXMLFile(string fileName) {
|
||||
* \param fileName input: filename to which PVGroup data is written
|
||||
* \return ICAFE_NORMAL if OK else first ECAFE/ICAFE error encountered
|
||||
*/
|
||||
int CAFE::group2XML (const char * grpName, string fileName) {
|
||||
int CAFE::group2XML (const char * grpName, std::string fileName)
|
||||
{
|
||||
#define __METHOD__ "CAFE::group2XML(const char *grpName, ofstream myfile)"
|
||||
|
||||
ofstream myfile;
|
||||
myfile.open (fileName.c_str(), ios::app);
|
||||
std::ofstream myfile;
|
||||
myfile.open (fileName.c_str(), std::ios::app);
|
||||
|
||||
std::string s= "\n <cafe:group id=\"" ;
|
||||
std::string gname=grpName;
|
||||
s.append(gname); s.append("\">\n");
|
||||
std::string gname=grpName;
|
||||
s.append(gname);
|
||||
s.append("\">\n");
|
||||
|
||||
vector<string> lg;
|
||||
lg.clear();
|
||||
std::vector<std::string> lg;
|
||||
lg.clear();
|
||||
|
||||
int status=CAFE::groupMemberList(grpName, lg);
|
||||
int status=CAFE::groupMemberList(grpName, lg);
|
||||
|
||||
|
||||
for (int j=0; j<lg.size(); ++j) {
|
||||
s.append(" <cafe:member> <cafe:name> ");
|
||||
s.append(lg[j]);
|
||||
s.append(" </cafe:name> </cafe:member>\n");
|
||||
}
|
||||
s.append(" </cafe:group>\n");
|
||||
for (int j=0; j<lg.size(); ++j) {
|
||||
s.append(" <cafe:member> <cafe:name> ");
|
||||
s.append(lg[j]);
|
||||
s.append(" </cafe:name> </cafe:member>\n");
|
||||
}
|
||||
s.append(" </cafe:group>\n");
|
||||
|
||||
myfile << s;
|
||||
myfile.close();
|
||||
myfile.close();
|
||||
return status;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
///
|
||||
/// \file callbackHandlerCreate.cc
|
||||
/// \file callbackHandlerCreate.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
///
|
||||
/// \date Release: January 2018
|
||||
/// \version CAFE 1.6.2
|
||||
/// cafeMutex lock repositioned so that all callbacks are returned
|
||||
/// before the lock is released. In particular
|
||||
/// change_connectionHandlerArgs(args) and change_channelRequestStatusGet(...) should be in sync.
|
||||
/// Otherwise nelem for data transfer for wf as requested by client (e.g., nelem=1)
|
||||
/// could be overwritten by native value (e.g., n=4080) in the event of a race condition.
|
||||
|
||||
|
||||
#include <cadef.h>
|
||||
#include <global.h>
|
||||
@@ -23,13 +28,13 @@ using namespace std;
|
||||
* \param args returns connection handler parameters \n
|
||||
* i.e. args.chid, args.op{CA_OP_CONN_UP, CA_OP_CONN_DOWN}
|
||||
*/
|
||||
void ChannelCreatePolicy::callbackHandlerCreate(struct connection_handler_args args) {
|
||||
void ChannelCreatePolicy::callbackHandlerCreate(struct connection_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "ChannelCreatePolicy::callbackHandlerCreate"
|
||||
|
||||
//Use for debugging
|
||||
//cout << __METHOD__ << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int _handle = (unsigned long) ca_puser(args.chid);
|
||||
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
@@ -37,222 +42,261 @@ void ChannelCreatePolicy::callbackHandlerCreate(struct connection_handler_args a
|
||||
it_handle = handle_index.find((unsigned int)_handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
//cout << (*it_handle).pv << endl;
|
||||
//cout << "handle= " << (*it_handle).getHandle() << endl; cout << endl;
|
||||
|
||||
|
||||
if (args.op == CA_OP_CONN_UP) {
|
||||
//START MUTEX LOCK
|
||||
//Modifies corresponding local variables
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_connectionHandlerArgs(args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
if (args.op == CA_OP_CONN_UP) {
|
||||
chtype buffer_TIME_Type = dbf_type_to_DBR_TIME(ca_field_type(args.chid)); //DBF_STRING
|
||||
chtype buffer_CTRL_Type = dbf_type_to_DBR_CTRL(ca_field_type(args.chid));
|
||||
chtype buffer_PRIMITIVE_TYPE = dbf_type_to_DBR (ca_field_type(args.chid));
|
||||
|
||||
//BUFFER FOR GET has DBR_TIME size
|
||||
//BUFFER FOR PUT has DBR size
|
||||
//BUFFER FOR CTRL has DBR_CTRL size
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_dataBufferSize_PRIMITIVE(buffer_PRIMITIVE_TYPE));
|
||||
handle_index.modify(it_handle, change_dataBufferSize_CTRL (buffer_CTRL_Type));
|
||||
handle_index.modify(it_handle, change_dataBufferSize_TIME (buffer_TIME_Type));
|
||||
handle_index.modify(it_handle, change_dataBufferSize_STSACK ()); //fixed size DBR_STSACK_STRING
|
||||
|
||||
if ( (*it_handle).getAccessRead() != ca_read_access(args.chid) ) {
|
||||
//cout << " This will only occur if CAFE's access right handler is not used " << endl;
|
||||
//cout << " accessRightsEventHandler not called BEFORE channelEventHandler! " << endl;
|
||||
//cout << " FORCING MODIFICATION IN HASH TABLE FOR READ ACCESS=" << ca_read_access(args.chid) << endl;
|
||||
handle_index.modify(it_handle, change_accessRead(ca_read_access(args.chid)));
|
||||
}
|
||||
if ( (*it_handle).getAccessWrite() != ca_write_access(args.chid) ) {
|
||||
//cout << " This will only occur if CAFE's access right handler is not used " << endl;
|
||||
//cout << " accessRightsEventHandler not called BEFORE channelEventHandler! " << endl;
|
||||
//cout << " FORCING MODIFICATION IN HASH TABLE FOR WRITE ACCESS=" << ca_write_access(args.chid) << endl;
|
||||
handle_index.modify(it_handle, change_accessWrite(ca_write_access(args.chid)));
|
||||
}
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
//Set prerequestStatus
|
||||
ChannelRequestStatus channelRequestStatusGet; int status;
|
||||
|
||||
//Call callback methods for all types!!
|
||||
status=(*it_handle).getCtrlWithCallback(CALLBACK_CAFE::handlerGetCtrl);
|
||||
channelRequestStatusGet = (*it_handle).getChannelRequestStatusGetCtrl();
|
||||
channelRequestStatusGet.setRequestStatus (status);
|
||||
if (status != ECA_NORMAL) {
|
||||
channelRequestStatusGet.setCallbackKind(false, false); // NOT_INITIATED NOT_TRIGGERED
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_status(status));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getCtrlWithCallback(CALLBACK_CAFE::handlerGetCtrl) reported error:" << endl;
|
||||
CAFEStatus cafeStatus; cafeStatus.report(status);
|
||||
}
|
||||
else {
|
||||
channelRequestStatusGet.setCallbackKind(true, false); //PENDING NOT_TRIGGERED
|
||||
}
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetCtrl(channelRequestStatusGet));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
//ca_flush_io();
|
||||
|
||||
status=(*it_handle).getSTSACKWithCallback(CALLBACK_CAFE::handlerGetSTSACK);
|
||||
|
||||
channelRequestStatusGet = (*it_handle).getChannelRequestStatusGetSTSACK();
|
||||
channelRequestStatusGet.setRequestStatus (status);
|
||||
if (status != ECA_NORMAL) {
|
||||
channelRequestStatusGet.setCallbackKind(false, false); // NOT_INITIATED NOT_TRIGGERED
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_status(status));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getSTSACKWithCallback(CALLBACK_CAFE::handlerGetSTSACK) reported error:" << endl;
|
||||
CAFEStatus cafeStatus; cafeStatus.report(status);
|
||||
}
|
||||
else {
|
||||
channelRequestStatusGet.setCallbackKind(true, false); //PENDING NOT_TRIGGERED
|
||||
}
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetSTSACK(channelRequestStatusGet));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
//ca_flush_io();
|
||||
|
||||
status=(*it_handle).getClassNameWithCallback(CALLBACK_CAFE::handlerGetClassName);
|
||||
|
||||
if ( status != ECA_NORMAL) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getClassNameWithCallback(CALLBACK_CAFE::handlerGetClassName) reported error:" << endl;
|
||||
CAFEStatus cafeStatus; cafeStatus.report(status);
|
||||
}
|
||||
|
||||
status=(*it_handle).getWithCallback(CALLBACK_CAFE::handlerGet);
|
||||
channelRequestStatusGet = (*it_handle).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setRequestStatus (status);
|
||||
if (status != ECA_NORMAL) {
|
||||
channelRequestStatusGet.setCallbackKind(false, false); // NOT_INITIATED NOT_TRIGGERED
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_status(status));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getWithCallback(CALLBACK_CAFE::handlerGet) reported error:" << endl;
|
||||
CAFEStatus cafeStatus; cafeStatus.report(status);
|
||||
}
|
||||
else {
|
||||
channelRequestStatusGet.setCallbackKind(true, false); //PENDING NOT_TRIGGERED
|
||||
}
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
//ca_flush_io();
|
||||
|
||||
// Check if any monitors for this channel are to be started.....
|
||||
// If monitors are to be started, then start the monitors
|
||||
// pass on handler functions
|
||||
//
|
||||
// Loop thru monitor waiting list
|
||||
|
||||
// monitor in waiting
|
||||
|
||||
vector<MonitorPolicy> mpInWaitingV =(*it_handle).getMonitorPolicyInWaitingVector();
|
||||
vector<MonitorPolicy>::iterator it;
|
||||
|
||||
//Iterate
|
||||
for (it = mpInWaitingV.begin(); it != mpInWaitingV.end(); ++it) {
|
||||
|
||||
//Check start values;
|
||||
if ((*it).getNelem()==0) {
|
||||
(*it).setNelem((*it_handle).getChannelRegalia().getNelem());
|
||||
}
|
||||
|
||||
//Check start values;
|
||||
if ((*it).getDataType()==CAFE_NOT_REQUESTED) {
|
||||
(*it).setDataType((*it_handle).getChannelRegalia().getDataType());
|
||||
}
|
||||
|
||||
//Check setMask if MASK_CTRL!
|
||||
|
||||
status=(*it_handle).monitorStart((*it));
|
||||
(*it).setStatus(status);
|
||||
|
||||
//Add to vector
|
||||
//check in to vector<monitorMap>
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_monitorPolicyInsert((*it)));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
}
|
||||
//loop
|
||||
|
||||
for (it = mpInWaitingV.begin(); it != mpInWaitingV.end(); ++it) {
|
||||
|
||||
unsigned int ID=(*it).getID();
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_monitorPolicyInWaitingErase(ID));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
}
|
||||
//loop
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// DIS-CONNECTION (i.e. from a previously connected state)
|
||||
// Setting Access Rights to boolean false. These will in any
|
||||
// case be overwritten to false by the access_rights_event_handler
|
||||
/*
|
||||
if ( (*it_handle).getAccessRead() != 0 ) {
|
||||
handle_index.modify(it_handle, change_accessRead(0));
|
||||
}
|
||||
|
||||
if ( (*it_handle).getAccessWrite() != 0 ) {
|
||||
handle_index.modify(it_handle, change_accessWrite(0));
|
||||
}
|
||||
*/
|
||||
// On disconnection invoke PyCafe Monitor callback
|
||||
|
||||
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
// monitors
|
||||
|
||||
|
||||
|
||||
vector<MonitorPolicy> mpV =(*it_handle).getMonitorPolicyVector();
|
||||
vector<MonitorPolicy>::iterator itmp;
|
||||
|
||||
|
||||
|
||||
//Iterate
|
||||
for (itmp = mpV.begin(); itmp != mpV.end(); ++itmp) {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_usrArgs( (unsigned long) (*itmp).getMonitorID() ));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
//Add datatypes etc...
|
||||
//cout << "(*it_handle).PyEventHandler(); " << (*itmp).getMonitorID() << endl;
|
||||
(*it_handle).PyEventHandler((*itmp).getMonitorID() );
|
||||
}
|
||||
#endif
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
|
||||
handle_index.modify(it_handle, change_connectionHandlerArgs(args));
|
||||
//if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
chtype buffer_TIME_Type = dbf_type_to_DBR_TIME(ca_field_type(args.chid)); //DBF_STRING
|
||||
chtype buffer_CTRL_Type = dbf_type_to_DBR_CTRL(ca_field_type(args.chid));
|
||||
chtype buffer_PRIMITIVE_TYPE = dbf_type_to_DBR (ca_field_type(args.chid));
|
||||
|
||||
//BUFFER FOR GET has DBR_TIME size
|
||||
//BUFFER FOR PUT has DBR size
|
||||
//BUFFER FOR CTRL has DBR_CTRL size
|
||||
|
||||
//////if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_dataBufferSize_PRIMITIVE(buffer_PRIMITIVE_TYPE));
|
||||
handle_index.modify(it_handle, change_dataBufferSize_CTRL (buffer_CTRL_Type));
|
||||
handle_index.modify(it_handle, change_dataBufferSize_TIME (buffer_TIME_Type));
|
||||
handle_index.modify(it_handle, change_dataBufferSize_STSACK ()); //fixed size DBR_STSACK_STRING
|
||||
|
||||
if ( (*it_handle).getAccessRead() != ca_read_access(args.chid) ) {
|
||||
//cout << " This will only occur if CAFE's access right handler is not used " << endl;
|
||||
//cout << " accessRightsEventHandler not called BEFORE channelEventHandler! " << endl;
|
||||
//cout << " FORCING MODIFICATION IN HASH TABLE FOR READ ACCESS=" << ca_read_access(args.chid) << endl;
|
||||
handle_index.modify(it_handle, change_accessRead(ca_read_access(args.chid)));
|
||||
}
|
||||
if ( (*it_handle).getAccessWrite() != ca_write_access(args.chid) ) {
|
||||
//cout << " This will only occur if CAFE's access right handler is not used " << endl;
|
||||
//cout << " accessRightsEventHandler not called BEFORE channelEventHandler! " << endl;
|
||||
//cout << " FORCING MODIFICATION IN HASH TABLE FOR WRITE ACCESS=" << ca_write_access(args.chid) << endl;
|
||||
handle_index.modify(it_handle, change_accessWrite(ca_write_access(args.chid)));
|
||||
}
|
||||
//////if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
//Set prerequestStatus
|
||||
ChannelRequestStatus channelRequestStatusGet;
|
||||
int status;
|
||||
|
||||
//cout << __METHOD__ << " handlerGet " << (*it_handle).pv << endl;
|
||||
status=(*it_handle).getWithCallback(CALLBACK_CAFE::handlerGet);
|
||||
|
||||
channelRequestStatusGet = (*it_handle).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setRequestStatus (status);
|
||||
if (status != ECA_NORMAL) {
|
||||
channelRequestStatusGet.setCallbackKind(false, false); // NOT_INITIATED NOT_TRIGGERED
|
||||
//////if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_status(status));
|
||||
//////if(MUTEX){cafeMutex.unlock();}
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getWithCallback(CALLBACK_CAFE::handlerGet) reported error:" << endl;
|
||||
CAFEStatus cafeStatus;
|
||||
cafeStatus.report(status);
|
||||
}
|
||||
else {
|
||||
channelRequestStatusGet.setCallbackKind(true, false); //PENDING NOT_TRIGGERED
|
||||
}
|
||||
|
||||
//////if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
//if(MUTEX){cafeMutex.unlock();}
|
||||
//ca_flush_io();
|
||||
|
||||
|
||||
|
||||
//cout << __METHOD__ << " handlerGetCtrl " << endl;
|
||||
//Call callback methods for all types!!
|
||||
status=(*it_handle).getCtrlWithCallback(CALLBACK_CAFE::handlerGetCtrl);
|
||||
channelRequestStatusGet = (*it_handle).getChannelRequestStatusGetCtrl();
|
||||
channelRequestStatusGet.setRequestStatus (status);
|
||||
if (status != ECA_NORMAL) {
|
||||
channelRequestStatusGet.setCallbackKind(false, false); // NOT_INITIATED NOT_TRIGGERED
|
||||
//////if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_status(status));
|
||||
//////if(MUTEX){cafeMutex.unlock();}
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getCtrlWithCallback(CALLBACK_CAFE::handlerGetCtrl) reported error:" << endl;
|
||||
CAFEStatus cafeStatus;
|
||||
cafeStatus.report(status);
|
||||
}
|
||||
else {
|
||||
channelRequestStatusGet.setCallbackKind(true, false); //PENDING NOT_TRIGGERED
|
||||
}
|
||||
|
||||
//////if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetCtrl(channelRequestStatusGet));
|
||||
//////if(MUTEX){cafeMutex.unlock();}
|
||||
//ca_flush_io();
|
||||
//cout << __METHOD__ << " handlerGetSTSACK " << endl;
|
||||
status=(*it_handle).getSTSACKWithCallback(CALLBACK_CAFE::handlerGetSTSACK);
|
||||
|
||||
channelRequestStatusGet = (*it_handle).getChannelRequestStatusGetSTSACK();
|
||||
channelRequestStatusGet.setRequestStatus (status);
|
||||
if (status != ECA_NORMAL) {
|
||||
channelRequestStatusGet.setCallbackKind(false, false); // NOT_INITIATED NOT_TRIGGERED
|
||||
//////if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_status(status));
|
||||
//////if(MUTEX){cafeMutex.unlock();}
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getSTSACKWithCallback(CALLBACK_CAFE::handlerGetSTSACK) reported error:" << endl;
|
||||
CAFEStatus cafeStatus;
|
||||
cafeStatus.report(status);
|
||||
}
|
||||
else {
|
||||
channelRequestStatusGet.setCallbackKind(true, false); //PENDING NOT_TRIGGERED
|
||||
}
|
||||
|
||||
//////if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetSTSACK(channelRequestStatusGet));
|
||||
//END MUTEX LOCK
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
//ca_flush_io();
|
||||
//cout << __METHOD__ << " handlerGetClassName" << endl;
|
||||
status=(*it_handle).getClassNameWithCallback(CALLBACK_CAFE::handlerGetClassName);
|
||||
|
||||
if ( status != ECA_NORMAL) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "getClassNameWithCallback(CALLBACK_CAFE::handlerGetClassName) reported error:" << endl;
|
||||
CAFEStatus cafeStatus;
|
||||
cafeStatus.report(status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check if any monitors for this channel are to be started.....
|
||||
// If monitors are to be started, then start the monitors
|
||||
// pass on handler functions
|
||||
//
|
||||
// Loop thru monitor waiting list
|
||||
|
||||
// monitor in waiting
|
||||
|
||||
vector<MonitorPolicy> mpInWaitingV =(*it_handle).getMonitorPolicyInWaitingVector();
|
||||
vector<MonitorPolicy>::iterator it;
|
||||
|
||||
|
||||
//std::cout << __METHOD__ << __LINE__ << " No of Monitors in Waiting " << mpInWaitingV.size() << std::endl << std::endl;
|
||||
if (mpInWaitingV.size() > 0) {
|
||||
ca_flush_io();
|
||||
}
|
||||
|
||||
//Iterate
|
||||
for (it = mpInWaitingV.begin(); it != mpInWaitingV.end(); ++it) {
|
||||
|
||||
//Check start values;
|
||||
if ((*it).getNelem()==0) {
|
||||
(*it).setNelem((*it_handle).getChannelRegalia().getNelem());
|
||||
}
|
||||
|
||||
//Check start values;
|
||||
if ((*it).getDataType()==CAFE_NOT_REQUESTED) {
|
||||
(*it).setDataType((*it_handle).getChannelRegalia().getDataType());
|
||||
}
|
||||
|
||||
//Check setMask if MASK_CTRL!
|
||||
|
||||
//std::cout << __METHOD__ << __LINE__ << " STARTING MONITOR for pv " << (*it_handle).pv << std::endl;
|
||||
status=(*it_handle).monitorStart((*it));
|
||||
(*it).setStatus(status);
|
||||
//std::cout << __METHOD__ << __LINE__ << " STARTed MONITOR for pv " << (*it_handle).pv << " with status" << status << std::endl;
|
||||
//Add to vector
|
||||
//check in to vector<monitorMap>
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_monitorPolicyInsert((*it)));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
}
|
||||
//loop
|
||||
|
||||
for (it = mpInWaitingV.begin(); it != mpInWaitingV.end(); ++it) {
|
||||
|
||||
unsigned int ID=(*it).getID();
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_monitorPolicyInWaitingErase(ID));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
}
|
||||
//loop
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
<< " called with an invalid CAFE handle:" << _handle << endl;
|
||||
cout << "Actually this should not happen and this line should never appear!! " << endl;
|
||||
// DIS-CONNECTION (i.e. from a previously connected state)
|
||||
// Setting Access Rights to boolean false. These will in any
|
||||
// case be overwritten to false by the access_rights_event_handler
|
||||
/*
|
||||
if ( (*it_handle).getAccessRead() != 0 ) {
|
||||
handle_index.modify(it_handle, change_accessRead(0));
|
||||
}
|
||||
|
||||
if ( (*it_handle).getAccessWrite() != 0 ) {
|
||||
handle_index.modify(it_handle, change_accessWrite(0));
|
||||
}
|
||||
*/
|
||||
// On disconnection invoke PyCafe Monitor callback
|
||||
|
||||
//Modifies corresponding local variables
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_connectionHandlerArgs(args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
// monitors
|
||||
|
||||
vector<MonitorPolicy> mpV =(*it_handle).getMonitorPolicyVector();
|
||||
vector<MonitorPolicy>::iterator itmp;
|
||||
|
||||
//Iterate
|
||||
for (itmp = mpV.begin(); itmp != mpV.end(); ++itmp) {
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_usrArgs( (unsigned long) (*itmp).getMonitorID() ));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
//Add datatypes etc...
|
||||
//cout << "(*it_handle).PyEventHandler(); " << (*itmp).getMonitorID() << endl;
|
||||
(*it_handle).PyEventHandler((*itmp).getMonitorID() );
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
|
||||
<< " called with an invalid CAFE handle:" << _handle << endl;
|
||||
cout << "Actually this should not happen and this line should never appear!! " << endl;
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
/// \file callbackHandlerMonitor.cc
|
||||
/// \file callbackHandlerMonitor.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -23,7 +23,8 @@ using namespace std;
|
||||
* with a pointer to the retrieved value
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void MonitorPolicy::callbackHandlerMonitor( struct event_handler_args args) {
|
||||
void MonitorPolicy::callbackHandlerMonitor( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "MonitorPolicy::callbackHandlerMonitor"
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
@@ -41,12 +42,15 @@ void MonitorPolicy::callbackHandlerMonitor( struct event_handler_args args) {
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
//cout << (*it_handle).getPV() << " " << (*it_handle).getHandle() << endl;
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
if (args.type < DBR_GR_STRING) {
|
||||
PVDataHolder pvd(args.count);
|
||||
(*it_handle).getPVDataHolder(pvd);
|
||||
@@ -60,68 +64,116 @@ void MonitorPolicy::callbackHandlerMonitor( struct event_handler_args args) {
|
||||
////pvc.print();
|
||||
cout << "val/C/= " << pvc.getAsString(0) << endl;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAVE_ZEROMQ
|
||||
if (SF_WITH_PULSE_ID) {
|
||||
|
||||
cafeConduit_set::iterator itcs;
|
||||
unsigned long long pulseID=0;
|
||||
PVDataHolder pvd;
|
||||
cafeConduit_set_by_pv & pv_index = cs.get<by_pv> ();
|
||||
cafeConduit_set_by_pv::iterator it_pv;
|
||||
it_pv = pv_index.find(SF_PULSE_ID_PV);
|
||||
|
||||
// Three possibilities of getting a match!
|
||||
if (it_pv != pv_index.end()) {
|
||||
if ((*it_pv).getChannelID() != NULL) {
|
||||
(*it_pv).getPVDataHolder(pvd);
|
||||
pulseID = (unsigned long long) pvd.getAsLongLong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Loop through all elements and search for pv match
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
if ((*itcs).getChannelID() != NULL && (*itcs).getPV()==SF_PULSE_ID_PV) {
|
||||
(*itcs).getPVDataHolder(pvd);
|
||||
pulseID = (unsigned long long) pvd.getAsLongLong();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
|
||||
handle_index.modify(it_handle, change_beamEventNo(pulseID));
|
||||
(*it_handle).getPVDataHolder(pvd);
|
||||
//handle_index.modify(it_handle, change_mapPulseID(pvd));
|
||||
handle_index.modify(it_handle, change_dequePulseID(pvd));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
} // if SF_WITH_PULSE_ID
|
||||
#endif
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Callback function for monitor method is invoked
|
||||
* with a pointer to the retrieved value; also fires a user supplied Python callback.
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void MonitorPolicy::PyCallbackHandlerMonitorData (struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "MonitorPolicy::PyCallbackHandlerMonitorData"
|
||||
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int _handle = (unsigned long) ca_puser(args.chid);// args.usr; // ca_puser(args.chid);
|
||||
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
cafeConduit_set_by_handle::iterator it_handle;
|
||||
|
||||
it_handle = handle_index.find((unsigned int)_handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
|
||||
if (args.type < DBR_GR_STRING) {
|
||||
|
||||
(*it_handle).PyDataEventHandler();
|
||||
|
||||
}
|
||||
else if (args.type < DBR_PUT_ACKT) {
|
||||
|
||||
(*it_handle).PyCtrlEventHandler();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Callback function for monitor method is invoked
|
||||
* with a pointer to the retrieved value; also fires a user supplied Python callback.
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void MonitorPolicy::PyCallbackHandlerMonitorData (struct event_handler_args args) {
|
||||
#define __METHOD__ "MonbitorPolicy::PyCallbackHandlerMonitorData"
|
||||
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int _handle = (unsigned long) ca_puser(args.chid);// args.usr; // ca_puser(args.chid);
|
||||
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
cafeConduit_set_by_handle::iterator it_handle;
|
||||
|
||||
it_handle = handle_index.find((unsigned int)_handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
|
||||
if (args.type < DBR_GR_STRING) {
|
||||
|
||||
(*it_handle).PyDataEventHandler();
|
||||
|
||||
}
|
||||
else if (args.type < DBR_PUT_ACKT) {
|
||||
|
||||
(*it_handle).PyCtrlEventHandler();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -133,45 +185,50 @@ return;
|
||||
* with a pointer to the retrieved value; also fires a user supplied Python callback.
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void MonitorPolicy::PyCallbackHandlerMonitor (struct event_handler_args args) {
|
||||
void MonitorPolicy::PyCallbackHandlerMonitor (struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "MonitorPolicy::PyCallbackHandlerMonitor"
|
||||
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
|
||||
return;
|
||||
}
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int _handle = (unsigned long) ca_puser(args.chid);// args.usr; // ca_puser(args.chid);
|
||||
unsigned int _handle = (unsigned long) ca_puser(args.chid);// args.usr; // ca_puser(args.chid);
|
||||
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
cafeConduit_set_by_handle::iterator it_handle;
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
cafeConduit_set_by_handle::iterator it_handle;
|
||||
|
||||
it_handle = handle_index.find((unsigned int)_handle);
|
||||
it_handle = handle_index.find((unsigned int)_handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
|
||||
(*it_handle).PyEventHandler();
|
||||
|
||||
#endif
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
|
||||
(*it_handle).PyEventHandler();
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
return;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
|
||||
462
src/conduit.cpp
462
src/conduit.cpp
@@ -1,25 +1,25 @@
|
||||
///
|
||||
/// \file conduit.cc
|
||||
/// \file conduit.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: September 2015
|
||||
/// \version CAFE 1.1.0
|
||||
///
|
||||
|
||||
#include "conduit.h"
|
||||
#include "helper.h"
|
||||
#include <conduit.h>
|
||||
#include <helper.h>
|
||||
|
||||
unsigned int Conduit::handleNext=0; //4294967295;
|
||||
unsigned int MonitorPolicy::idNext=0xfff; //4095
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
Conduit::Conduit( ){};
|
||||
Conduit::Conduit( ) {};
|
||||
|
||||
/**
|
||||
* CAFEConduit destructor \n
|
||||
* Good place to clean up!
|
||||
* Good place to clean up!
|
||||
*/
|
||||
Conduit::~Conduit(){};
|
||||
Conduit::~Conduit() {};
|
||||
|
||||
|
||||
/*
|
||||
@@ -32,13 +32,13 @@ Conduit::Conduit(const char * _pv, ca_client_context *_ccc, bool _pyCafeFlag) {
|
||||
cout << "when " << _channelRequestPolicy.getWhenToFlushSendBuffer() << endl;
|
||||
cout << "wait " << _channelRequestPolicy.getWaitKind() << endl;
|
||||
cout << "method " << _channelRequestPolicy.getMethodKind() << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
Conduit::Conduit(_pv, _ccc, _pyCafeFlag);
|
||||
cout << "when " << _channelRequestPolicy.getWhenToFlushSendBuffer() << endl;
|
||||
cout << "wait " << _channelRequestPolicy.getWaitKind() << endl;
|
||||
cout << "method " << _channelRequestPolicy.getMethodKind() << endl;
|
||||
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -51,46 +51,47 @@ Conduit::Conduit(const char * _pv, ca_client_context *_ccc, bool _pyCafeFlag) {
|
||||
* \param _pyCafeFlag input: bool
|
||||
* \param _channelRequestPolicyPut input: ChannelRequestPolicyPut
|
||||
* \param _channelRequestPolicyGet input: ChannelRequestPolicyGet
|
||||
* \param _channelGetActionWhenMonitorPolicyGet input: ChannelGetActionWhenPolicyGet
|
||||
* \param _channelGetActionWhenMonitorPolicy input: ChannelGetActionWhenPolicy
|
||||
*/
|
||||
Conduit::Conduit(const char * _pv, ca_client_context *_ccc,
|
||||
ChannelRequestPolicy _channelRequestPolicyPut, ChannelRequestPolicy _channelRequestPolicyGet,
|
||||
ChannelGetActionWhenMonitorPolicy _channelGetActionWhenMonitorPolicy,
|
||||
bool _pyCafeFlag) {
|
||||
Conduit::Conduit(const char * _pv, ca_client_context *_ccc,
|
||||
ChannelRequestPolicy _channelRequestPolicyPut, ChannelRequestPolicy _channelRequestPolicyGet,
|
||||
ChannelGetActionWhenMonitorPolicy _channelGetActionWhenMonitorPolicy,
|
||||
bool _pyCafeFlag)
|
||||
{
|
||||
|
||||
// To avoid the following compilation error
|
||||
// conduit.cpp:41: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
|
||||
// conduit.cpp:41: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
|
||||
//epicsAlarmSeverityStrings= {"NO_ALARM","MINOR","MAJOR","INVALID"};
|
||||
epicsAlarmSeverityStrings[0]=(const char *) "NO_ALARM";
|
||||
epicsAlarmSeverityStrings[1]=(const char *) "MINOR";
|
||||
epicsAlarmSeverityStrings[2]=(const char *) "MAJOR";
|
||||
epicsAlarmSeverityStrings[3]=(const char *) "INVALID";
|
||||
epicsAlarmSeverityStrings[0]=(const char *) "NO_ALARM";
|
||||
epicsAlarmSeverityStrings[1]=(const char *) "MINOR";
|
||||
epicsAlarmSeverityStrings[2]=(const char *) "MAJOR";
|
||||
epicsAlarmSeverityStrings[3]=(const char *) "INVALID";
|
||||
//epicsAlarmConditionStrings = {"NO_ALARM","READ","WRITE","HIHI","HIGH",
|
||||
//"LOLO","LOW","STATE","COS", "COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
|
||||
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS", "WRITE_ACCESS"};
|
||||
//"LOLO","LOW","STATE","COS", "COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
|
||||
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS", "WRITE_ACCESS"};
|
||||
epicsAlarmConditionStrings[0]= (const char *) "NO_ALARM";
|
||||
epicsAlarmConditionStrings[1]= (const char *) "READ";
|
||||
epicsAlarmConditionStrings[2]= (const char *) "WRITE";
|
||||
epicsAlarmConditionStrings[3]= (const char *) "HIHI";
|
||||
epicsAlarmConditionStrings[4]= (const char *) "HIGH";
|
||||
epicsAlarmConditionStrings[5]= (const char *) "LOLO";
|
||||
epicsAlarmConditionStrings[6]= (const char *) "LOW";
|
||||
epicsAlarmConditionStrings[7]= (const char *) "STATE";
|
||||
epicsAlarmConditionStrings[2]= (const char *) "WRITE";
|
||||
epicsAlarmConditionStrings[3]= (const char *) "HIHI";
|
||||
epicsAlarmConditionStrings[4]= (const char *) "HIGH";
|
||||
epicsAlarmConditionStrings[5]= (const char *) "LOLO";
|
||||
epicsAlarmConditionStrings[6]= (const char *) "LOW";
|
||||
epicsAlarmConditionStrings[7]= (const char *) "STATE";
|
||||
epicsAlarmConditionStrings[8]= (const char *) "COS";
|
||||
epicsAlarmConditionStrings[9]= (const char *) "COMM";
|
||||
epicsAlarmConditionStrings[10]= (const char *) "TIMEOUT";
|
||||
epicsAlarmConditionStrings[11]= (const char *) "HWLIMIT";
|
||||
epicsAlarmConditionStrings[12]= (const char *) "CALC";
|
||||
epicsAlarmConditionStrings[13]= (const char *) "SCAN";
|
||||
epicsAlarmConditionStrings[14]= (const char *) "LINK";
|
||||
epicsAlarmConditionStrings[9]= (const char *) "COMM";
|
||||
epicsAlarmConditionStrings[10]= (const char *) "TIMEOUT";
|
||||
epicsAlarmConditionStrings[11]= (const char *) "HWLIMIT";
|
||||
epicsAlarmConditionStrings[12]= (const char *) "CALC";
|
||||
epicsAlarmConditionStrings[13]= (const char *) "SCAN";
|
||||
epicsAlarmConditionStrings[14]= (const char *) "LINK";
|
||||
epicsAlarmConditionStrings[15]= (const char *) "SOFT";
|
||||
epicsAlarmConditionStrings[16]= (const char *) "BAD_SUB";
|
||||
epicsAlarmConditionStrings[17]= (const char *) "UDF";
|
||||
epicsAlarmConditionStrings[18]= (const char *) "DISABLE";
|
||||
epicsAlarmConditionStrings[19]= (const char *) "SIMM";
|
||||
epicsAlarmConditionStrings[20]= (const char *) "READ_ACCESS";
|
||||
epicsAlarmConditionStrings[21]= (const char *) "WRITE_ACCESS";
|
||||
|
||||
epicsAlarmConditionStrings[16]= (const char *) "BAD_SUB";
|
||||
epicsAlarmConditionStrings[17]= (const char *) "UDF";
|
||||
epicsAlarmConditionStrings[18]= (const char *) "DISABLE";
|
||||
epicsAlarmConditionStrings[19]= (const char *) "SIMM";
|
||||
epicsAlarmConditionStrings[20]= (const char *) "READ_ACCESS";
|
||||
epicsAlarmConditionStrings[21]= (const char *) "WRITE_ACCESS";
|
||||
|
||||
ccc = _ccc;
|
||||
pvAlias = _pv;
|
||||
pv = _pv;
|
||||
@@ -100,7 +101,10 @@ Conduit::Conduit(const char * _pv, ca_client_context *_ccc,
|
||||
++handleNext; // 0 reserved for handle not found
|
||||
}
|
||||
|
||||
pyCafeFlag=_pyCafeFlag;
|
||||
pyCafeFlag=_pyCafeFlag;
|
||||
|
||||
mapPulseIDBufferSize=SF_PULSE_ID_BUFFER_SIZE;
|
||||
|
||||
|
||||
handle = handleNext;
|
||||
groupHandle= 0;
|
||||
@@ -109,14 +113,30 @@ Conduit::Conduit(const char * _pv, ca_client_context *_ccc,
|
||||
|
||||
alarmStatus=-1;
|
||||
alarmSeverity=-1;
|
||||
|
||||
|
||||
//New Oct. 2018
|
||||
desc="";
|
||||
//hhsv=-1;
|
||||
//hsv =-1;
|
||||
//lsv =-1;
|
||||
//llsv=-1;
|
||||
|
||||
aSevStruct.hhsv=-1;
|
||||
aSevStruct.hsv =-1;
|
||||
aSevStruct.lsv =-1;
|
||||
aSevStruct.llsv=-1;
|
||||
|
||||
hasDesc=false;
|
||||
hasAlarmSevStruct=false;
|
||||
|
||||
ts.secPastEpoch=0;
|
||||
ts.nsec=0;
|
||||
|
||||
usrArgs= (unsigned long) 0;
|
||||
dataType= NULL; //(chtype) NULL;
|
||||
dbrDataType= NULL; //(chtype) NULL;
|
||||
cafeDbrType=CAFENUM::DBR_NONE;
|
||||
usrArgs= (unsigned long) 0;
|
||||
dataType= (chtype) NULL;
|
||||
dbrDataType= (chtype) NULL;
|
||||
cafeDbrType=CAFENUM::DBR_NONE;
|
||||
|
||||
beamEventNo=0;
|
||||
|
||||
@@ -144,89 +164,112 @@ Conduit::Conduit(const char * _pv, ca_client_context *_ccc,
|
||||
hasNewData=true; // used by HandleHelper.getMonitorAction(); start with true
|
||||
|
||||
//channelRequestPolicyPut
|
||||
|
||||
channelRequestPolicyPut.setPolicy(_channelRequestPolicyPut.getWhenToFlushSendBuffer(),
|
||||
_channelRequestPolicyPut.getWaitKind(), _channelRequestPolicyPut.getMethodKind());
|
||||
|
||||
channelRequestPolicyGet.setPolicy(_channelRequestPolicyGet.getWhenToFlushSendBuffer(),
|
||||
_channelRequestPolicyGet.getWaitKind(), _channelRequestPolicyGet.getMethodKind());
|
||||
|
||||
//Use same policy for get ctrl
|
||||
channelRequestPolicyGetCtrl.setPolicy(_channelRequestPolicyGet.getWhenToFlushSendBuffer(),
|
||||
_channelRequestPolicyGet.getWaitKind(), _channelRequestPolicyGet.getMethodKind());
|
||||
|
||||
channelGetActionWhenMonitorPolicy.setActionKind(_channelGetActionWhenMonitorPolicy.getActionKind());
|
||||
|
||||
//cout << "when /" << channelRequestPolicyMaster.getWhenToFlushSendBuffer() << endl;
|
||||
//cout << "wait /" << channelRequestPolicyMaster.getWaitKind() << endl;
|
||||
//cout << "method /" << channelRequestPolicyMaster.getMethodKind() << endl;
|
||||
|
||||
channelRequestPolicyPut.setPolicy(_channelRequestPolicyPut.getWhenToFlushSendBuffer(),
|
||||
_channelRequestPolicyPut.getWaitKind(), _channelRequestPolicyPut.getMethodKind());
|
||||
|
||||
channelRequestPolicyGet.setPolicy(_channelRequestPolicyGet.getWhenToFlushSendBuffer(),
|
||||
_channelRequestPolicyGet.getWaitKind(), _channelRequestPolicyGet.getMethodKind());
|
||||
|
||||
//Use same policy for get ctrl
|
||||
channelRequestPolicyGetCtrl.setPolicy(_channelRequestPolicyGet.getWhenToFlushSendBuffer(),
|
||||
_channelRequestPolicyGet.getWaitKind(), _channelRequestPolicyGet.getMethodKind());
|
||||
|
||||
channelGetActionWhenMonitorPolicy.setActionKind(_channelGetActionWhenMonitorPolicy.getActionKind());
|
||||
|
||||
//cout << "when /" << channelRequestPolicyMaster.getWhenToFlushSendBuffer() << endl;
|
||||
//cout << "wait /" << channelRequestPolicyMaster.getWaitKind() << endl;
|
||||
//cout << "method /" << channelRequestPolicyMaster.getMethodKind() << endl;
|
||||
|
||||
//Define default policies
|
||||
//channelRequestPolicyPut.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
|
||||
//CAFENUM::NO_WAIT, CAFENUM::WITH_CALLBACK_DEFAULT);
|
||||
//CAFENUM::NO_WAIT, CAFENUM::WITH_CALLBACK_DEFAULT);
|
||||
|
||||
//channelRequestPolicyGet.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
|
||||
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITHOUT_CALLBACK);
|
||||
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITHOUT_CALLBACK);
|
||||
|
||||
//channelRequestPolicyGetCtrl.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
|
||||
// CAFENUM::WAIT, CAFENUM::WITHOUT_CALLBACK); //WITH_CALLBACK_DEFAULT);
|
||||
// CAFENUM::WAIT, CAFENUM::WITHOUT_CALLBACK); //WITH_CALLBACK_DEFAULT);
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
|
||||
#if HAVE_PYCAFE_EXT
|
||||
//Do nothing as PyCafe_ext is compiled
|
||||
|
||||
#else
|
||||
//Give non Python APIs (e.g. MATLAB) a chance to turn this off
|
||||
//MATLAB needs to turn this off
|
||||
if (pyCafeFlag) {
|
||||
//Py_Initialize();
|
||||
import_PyCafe(); // Use PyCafe_api.h
|
||||
}
|
||||
#endif
|
||||
#if HAVE_PYCAFE_EXT
|
||||
//Do nothing as PyCafe_ext is compiled
|
||||
|
||||
#else
|
||||
//Give non Python APIs (e.g. MATLAB) a chance to turn this off
|
||||
//MATLAB needs to turn this off
|
||||
|
||||
//Careful With That GIL, Eugene
|
||||
//Any method that calls this from Python, e.g., open, must be done so ***with*** the GIL
|
||||
if (pyCafeFlag) {
|
||||
//Py_Initialize();
|
||||
|
||||
import_PyCafe(); // Use PyCafe_api.h
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if HAVE_PYTHON_H
|
||||
void * Conduit::PyGetHandler() const {
|
||||
py_cb_handle_get_wrapper(handle);
|
||||
return (void *) 0;
|
||||
void * Conduit::PyGetHandler() const
|
||||
{
|
||||
|
||||
py_cb_handle_get_wrapper(handle);
|
||||
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
void * Conduit::PyPutHandler() const {
|
||||
py_cb_handle_put_wrapper(handle);
|
||||
return (void *) 0;
|
||||
void * Conduit::PyPutHandler() const
|
||||
{
|
||||
|
||||
py_cb_handle_put_wrapper(handle);
|
||||
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
void * Conduit::PyEventHandler() const {
|
||||
//py_cb_handle_wrapper(handle);
|
||||
py_cb_handle_monid_wrapper(handle, (unsigned long) usrArgs);
|
||||
return (void *) 0;
|
||||
void * Conduit::PyEventHandler() const
|
||||
{
|
||||
//py_cb_handle_wrapper(handle);
|
||||
|
||||
py_cb_handle_monid_wrapper(handle, (unsigned long) usrArgs);
|
||||
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
|
||||
void * Conduit::PyEventHandler(unsigned int monid) const {
|
||||
//py_cb_handle_wrapper(handle);
|
||||
py_cb_handle_monid_wrapper(handle, monid);
|
||||
return (void *) 0;
|
||||
void * Conduit::PyEventHandler(unsigned int monid) const
|
||||
{
|
||||
//py_cb_handle_wrapper(handle);
|
||||
|
||||
py_cb_handle_monid_wrapper(handle, monid);
|
||||
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
void * Conduit::PyDataEventHandler() const{
|
||||
PVDataHolder pvd(channelRequestMetaData.nelem);
|
||||
//size is set in conduitEventHandlerArgs.h
|
||||
getPVDataHolder(pvd);
|
||||
py_cb_wrapper(pvd, handle, pv);
|
||||
return (void *) 0;
|
||||
void * Conduit::PyDataEventHandler() const
|
||||
{
|
||||
|
||||
PVDataHolder pvd(channelRequestMetaData.nelem);
|
||||
//size is set in conduitEventHandlerArgs.h
|
||||
getPVDataHolder(pvd);
|
||||
py_cb_wrapper(pvd, handle, pv);
|
||||
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
void * Conduit::PyCtrlEventHandler() const{
|
||||
PVCtrlHolder pvc(channelRequestMetaCtrl.nelem);
|
||||
//size is set in conduitEventHandlerArgs.h
|
||||
getPVCtrlHolder(pvc);
|
||||
py_cb_ctrl_wrapper(pvc, handle, pv);
|
||||
return (void *) 0;
|
||||
void * Conduit::PyCtrlEventHandler() const
|
||||
{
|
||||
|
||||
PVCtrlHolder pvc(channelRequestMetaCtrl.nelem);
|
||||
//size is set in conduitEventHandlerArgs.h
|
||||
getPVCtrlHolder(pvc);
|
||||
py_cb_ctrl_wrapper(pvc, handle, pv);
|
||||
|
||||
return (void *) 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -242,11 +285,12 @@ void * Conduit::PyCtrlEventHandler() const{
|
||||
* \return ECA_ALLOCMEM - Unable to allocate memory
|
||||
* \return ECA_DISCONN - Channel is disconnected
|
||||
*/
|
||||
int Conduit::put(void) const {
|
||||
int Conduit::put(void) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::put()"
|
||||
|
||||
return ca_array_put(channelRequestMetaPrimitive.dbrDataType, channelRequestMetaPrimitive.nelem,
|
||||
channelRegalia.channelID, putBuffer);
|
||||
channelRegalia.channelID, putBuffer);
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -258,17 +302,18 @@ int Conduit::put(void) const {
|
||||
* \param callbackHandlerPut input: pCallback
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::putWithCallback(pCallback callbackHandlerPut) const {
|
||||
int Conduit::putWithCallback(pCallback callbackHandlerPut) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::putWithCallback(pCallback callbackHandlerPut) "
|
||||
|
||||
//cout << "channelRequestMetaPrimitive.nelem: " << channelRequestMetaPrimitive.nelem << endl;
|
||||
//for (int i=0; i< channelRequestMetaPrimitive.nelem; ++i) {
|
||||
// cout << (*(&((putBuffer)->fltval)+i)) << " [" << i << "] " << endl;
|
||||
//}
|
||||
|
||||
|
||||
//for (int i=0; i< channelRequestMetaPrimitive.nelem; ++i) {
|
||||
// cout << (*(&((putBuffer)->fltval)+i)) << " [" << i << "] " << endl;
|
||||
//}
|
||||
|
||||
|
||||
return ca_array_put_callback(channelRequestMetaPrimitive.dbrDataType, channelRequestMetaPrimitive.nelem,
|
||||
channelRegalia.channelID, putBuffer, callbackHandlerPut,(void *) (long long) handle );
|
||||
channelRegalia.channelID, putBuffer, callbackHandlerPut,(void *) (long long) handle );
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -278,10 +323,11 @@ int Conduit::putWithCallback(pCallback callbackHandlerPut) const {
|
||||
* Retrieves PV data through channel access into the Conduit::dataBuffer
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::get(void) const {
|
||||
int Conduit::get(void) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::get(void) "
|
||||
|
||||
|
||||
|
||||
return ca_array_get(channelRequestMetaData.dbrDataType, channelRequestMetaData.nelem,
|
||||
channelRegalia.channelID, dataBuffer);
|
||||
|
||||
@@ -294,12 +340,15 @@ int Conduit::get(void) const {
|
||||
* \param callbackHandlerGet input: pCallback
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::getWithCallback(pCallback callbackHandlerGet) const {
|
||||
int Conduit::getWithCallback(pCallback callbackHandlerGet) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::getCallback(pCallback callbackHandlerGet) "
|
||||
|
||||
|
||||
//std::cout << __FILE__ << "//" << __METHOD__ << std::endl;
|
||||
//std::cout << "nelem= " << channelRequestMetaData.nelem << " handle = " << handle << endl;
|
||||
|
||||
return ca_array_get_callback(channelRequestMetaData.dbrDataType, channelRequestMetaData.nelem,
|
||||
channelRegalia.channelID,callbackHandlerGet,(void *) (long long) handle );
|
||||
channelRegalia.channelID,callbackHandlerGet,(void *) (long long) handle );
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -310,12 +359,13 @@ int Conduit::getWithCallback(pCallback callbackHandlerGet) const {
|
||||
* Retrieves Ctrl data through channel access into the Conduit::ctrlBuffer
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::getCtrl(void) const {
|
||||
int Conduit::getCtrl(void) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::getCtrl(void) "
|
||||
|
||||
|
||||
return ca_array_get(channelRequestMetaCtrl.dbrDataType, channelRequestMetaCtrl.nelem,
|
||||
channelRegalia.channelID, ctrlBuffer);
|
||||
channelRegalia.channelID, ctrlBuffer);
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -326,14 +376,15 @@ int Conduit::getCtrl(void) const {
|
||||
* \param callbackHandlerCtrl input: pCallback
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::getCtrlWithCallback(pCallback callbackHandlerCtrl) const {
|
||||
int Conduit::getCtrlWithCallback(pCallback callbackHandlerCtrl) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::getCtrlCallback(pCallback callbackHandlerCtrl) "
|
||||
|
||||
|
||||
return ca_array_get_callback(channelRequestMetaCtrl.dbrDataType,
|
||||
channelRequestMetaCtrl.nelem,
|
||||
//min(channelRequestMetaCtrl.nelem,max_nelem_for_ctrl_buffer),
|
||||
channelRegalia.channelID, callbackHandlerCtrl, (void *) (long long) handle);
|
||||
channelRequestMetaCtrl.nelem,
|
||||
//min(channelRequestMetaCtrl.nelem,max_nelem_for_ctrl_buffer),
|
||||
channelRegalia.channelID, callbackHandlerCtrl, (void *) (long long) handle);
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -345,11 +396,12 @@ int Conduit::getCtrlWithCallback(pCallback callbackHandlerCtrl) const {
|
||||
* \param callbackHandlerSTSACK input: pCallback
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::getSTSACKWithCallback(pCallback callbackHandlerSTSACK) const {
|
||||
int Conduit::getSTSACKWithCallback(pCallback callbackHandlerSTSACK) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::getSTSACKWithCallback(pCallback callbackHandlerSTSACK) "
|
||||
|
||||
return ca_array_get_callback(DBR_STSACK_STRING, channelRequestMetaSTSACK.nelem,
|
||||
channelRegalia.channelID, callbackHandlerSTSACK, (void *) (long long) handle);
|
||||
channelRegalia.channelID, callbackHandlerSTSACK, (void *) (long long) handle);
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -361,11 +413,12 @@ int Conduit::getSTSACKWithCallback(pCallback callbackHandlerSTSACK) const {
|
||||
* \param callbackHandlerClassName input: pCallback
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::getClassNameWithCallback(pCallback callbackHandlerClassName) const {
|
||||
int Conduit::getClassNameWithCallback(pCallback callbackHandlerClassName) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::getClassNameWithCallback(pCallback callbackHandlerClassName) "
|
||||
|
||||
return ca_array_get_callback(DBR_CLASS_NAME, 1,
|
||||
channelRegalia.channelID, callbackHandlerClassName, (void *)(long long) handle);
|
||||
channelRegalia.channelID, callbackHandlerClassName, (void *)(long long) handle);
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -375,7 +428,8 @@ int Conduit::getClassNameWithCallback(pCallback callbackHandlerClassName) const
|
||||
* \param _pvd output: PVDataHolder
|
||||
* \return ECA_NORMAL if OK else ECA error
|
||||
*/
|
||||
int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
int Conduit::getPVDataHolder(PVDataHolder & _pvd) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::getPVDataHolder(PVDataHolder & _pvd) "
|
||||
|
||||
Helper helper;
|
||||
@@ -385,19 +439,20 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
chtype channelType = channelRequestMetaData.getDbrDataType();
|
||||
CAFENUM::DBR_TYPE dbrTypeClass=helper.convertToCAFEDbrTypeClass(channelType);
|
||||
|
||||
|
||||
|
||||
if ( channelRegalia.getCafeConnectionState() != ICAFE_CS_NEVER_CONN && channelRegalia.getCafeConnectionState() != ICAFE_CS_CLOSED) {
|
||||
|
||||
switch(dbrTypeClass)
|
||||
{
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
case CAFENUM::DBR_STS:
|
||||
case CAFENUM::DBR_TIME:
|
||||
switch(dbrTypeClass) {
|
||||
case CAFENUM::DBR_PRIMITIVE:
|
||||
case CAFENUM::DBR_STS:
|
||||
case CAFENUM::DBR_TIME:
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "CAFE INTERNAL FUNNY: dbrTypeClass = " << dbrTypeClass <<
|
||||
" is NOT appropriate for this method" << endl;
|
||||
" is NOT appropriate for this method" << endl;
|
||||
cout << "Method does not deal with this DBR_TYPE: "
|
||||
<< dbr_type_to_text(channelType) << endl;
|
||||
break;
|
||||
@@ -407,15 +462,14 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
|
||||
unsigned int offset = channelRequestMetaData.getOffset(); //channelRequestMetaDataClient.getOffset();
|
||||
unsigned int nelem = channelRequestMetaData.getNelem()-offset;
|
||||
|
||||
nelem=min(_pvd.nelem,nelem); // Add this for getCache method
|
||||
|
||||
|
||||
|
||||
nelem=min(_pvd.nelem,nelem); // Add this for getCache method
|
||||
|
||||
_pvd.alarmStatus = -1;//alarmStatus;
|
||||
_pvd.alarmSeverity = -1;//alarmSeverity;
|
||||
_pvd.ts.nsec = 0;//ts;
|
||||
_pvd.ts.secPastEpoch= 0;
|
||||
|
||||
_pvd.nelem = min(_pvd.size,nelem); //channelRequestMetaData.getNelem();
|
||||
_pvd.beamEventNo = beamEventNo;
|
||||
_pvd.status = status;
|
||||
@@ -434,26 +488,25 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
memcpy( _pvd.strs, &(((struct dbr_ctrl_enum *) ctrlBuffer)->strs), sizeof(_pvd.strs)) ;
|
||||
//for (int i=0; i<_pvd.noStr; ++i) cout << __METHOD__ << i << " " << _pvd.strs[i] << endl;
|
||||
}
|
||||
|
||||
switch (channelType)
|
||||
{
|
||||
|
||||
switch (channelType) {
|
||||
case DBR_TIME_DOUBLE:
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].d = (*(&((dataBuffer)->tdblval.value)+i+offset));
|
||||
}
|
||||
_pvd.ts = ((struct dbr_time_double *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_double *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_double *) dataBuffer)->severity;
|
||||
|
||||
_pvd.ts = ((struct dbr_time_double *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_double *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_double *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
case DBR_TIME_FLOAT:
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
case DBR_TIME_FLOAT:
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].f = (*(&((dataBuffer)->tfltval.value)+i+offset));
|
||||
}
|
||||
_pvd.ts = (epicsTimeStamp) ((struct dbr_time_float *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_float *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_float *) dataBuffer)->severity;
|
||||
_pvd.ts = (epicsTimeStamp) ((struct dbr_time_float *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_float *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_float *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -461,9 +514,9 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].l = (*(&((dataBuffer)->tlngval.value)+i+offset));
|
||||
}
|
||||
_pvd.ts = ((struct dbr_time_long *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_long *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_long *) dataBuffer)->severity;
|
||||
_pvd.ts = ((struct dbr_time_long *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_long *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_long *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -471,9 +524,9 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].s = (*(&((dataBuffer)->tshrtval.value)+i+offset));
|
||||
}
|
||||
_pvd.ts = ((struct dbr_time_short *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_short *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_short *) dataBuffer)->severity;
|
||||
_pvd.ts = ((struct dbr_time_short *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_short *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_short *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -481,9 +534,9 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].us = (*(&((dataBuffer)->tenmval.value)+i+offset));
|
||||
}
|
||||
_pvd.ts = ((struct dbr_time_enum *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_enum *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_enum *) dataBuffer)->severity;
|
||||
_pvd.ts = ((struct dbr_time_enum *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_enum *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_enum *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -491,9 +544,9 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].ch = (*(&((dataBuffer)->tchrval.value)+i+offset));
|
||||
}
|
||||
_pvd.ts = ((struct dbr_time_char *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_char *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_char *) dataBuffer)->severity;
|
||||
_pvd.ts = ((struct dbr_time_char *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_char *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_char *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -501,9 +554,9 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
strcpy(_pvd.val[i].str, (*(&((dataBuffer)->tstrval.value)+i+offset)));
|
||||
}
|
||||
_pvd.ts = ((struct dbr_time_string *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_string *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_string *) dataBuffer)->severity;
|
||||
_pvd.ts = ((struct dbr_time_string *) dataBuffer)->stamp;
|
||||
_pvd.alarmStatus = ((struct dbr_time_string *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_time_string *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -511,8 +564,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].d = (*(&((dataBuffer)->sdblval.value)+i+offset));
|
||||
}
|
||||
_pvd.alarmStatus = ((struct dbr_sts_double *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_double *) dataBuffer)->severity;
|
||||
_pvd.alarmStatus = ((struct dbr_sts_double *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_double *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -520,8 +573,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].f = (*(&((dataBuffer)->sfltval.value)+i+offset));
|
||||
}
|
||||
_pvd.alarmStatus = ((struct dbr_sts_float *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_float *) dataBuffer)->severity;
|
||||
_pvd.alarmStatus = ((struct dbr_sts_float *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_float *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -529,8 +582,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].l = (*(&((dataBuffer)->slngval.value)+i+offset));
|
||||
}
|
||||
_pvd.alarmStatus = ((struct dbr_sts_int *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_int *) dataBuffer)->severity;
|
||||
_pvd.alarmStatus = ((struct dbr_sts_int *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_int *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -538,8 +591,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].s = (*(&((dataBuffer)->sshrtval.value)+i+offset));
|
||||
}
|
||||
_pvd.alarmStatus = ((struct dbr_sts_short *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_short *) dataBuffer)->severity;
|
||||
_pvd.alarmStatus = ((struct dbr_sts_short *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_short *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -547,8 +600,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].us = (*(&((dataBuffer)->senmval.value)+i+offset));
|
||||
}
|
||||
_pvd.alarmStatus = ((struct dbr_sts_enum *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_enum *) dataBuffer)->severity;
|
||||
_pvd.alarmStatus = ((struct dbr_sts_enum *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_enum *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -556,8 +609,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
_pvd.val[i].ch = (*(&((dataBuffer)->schrval.value)+i+offset));
|
||||
}
|
||||
_pvd.alarmStatus = ((struct dbr_sts_char *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_char *) dataBuffer)->severity;
|
||||
_pvd.alarmStatus = ((struct dbr_sts_char *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_char *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -565,8 +618,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
for (unsigned int i=0; i<_pvd.nelem; ++i) {
|
||||
strcpy(_pvd.val[i].str, (*(&((dataBuffer)->sstrval.value)+i+offset)));
|
||||
}
|
||||
_pvd.alarmStatus = ((struct dbr_sts_string *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_string *) dataBuffer)->severity;
|
||||
_pvd.alarmStatus = ((struct dbr_sts_string *) dataBuffer)->status;
|
||||
_pvd.alarmSeverity = ((struct dbr_sts_string *) dataBuffer)->severity;
|
||||
|
||||
break;
|
||||
|
||||
@@ -614,22 +667,24 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
|
||||
case TYPENOTCONN:
|
||||
if ( channelRegalia.getCafeConnectionState() != ICAFE_CS_NEVER_CONN && channelRegalia.getCafeConnectionState() != ICAFE_CS_CLOSED ) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "ERROR CAFE_TYPENOTCONN: dataType: "
|
||||
<< channelType << " : " << dbr_type_to_text(channelType) << endl;
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "ERROR CAFE_TYPENOTCONN: dataType: "
|
||||
<< channelType << " : " << dbr_type_to_text(channelType) << endl;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "The switch case does not support this channelType: "
|
||||
<< channelType << " : " << dbr_type_to_text(channelType) << endl;
|
||||
<< channelType << " : " << dbr_type_to_text(channelType) << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
//Do this to prevent overflow error in epicsTime time(ts) routines!
|
||||
//This bad number can occur in timeouts
|
||||
if(_pvd.ts.nsec>1000000000) {_pvd.ts.nsec=0;}
|
||||
|
||||
//Do this to prevent overflow error in epicsTime time(ts) routines!
|
||||
//This bad number can occur in timeouts
|
||||
if(_pvd.ts.nsec>1000000000) {
|
||||
_pvd.ts.nsec=0;
|
||||
}
|
||||
|
||||
|
||||
return ICAFE_NORMAL;
|
||||
#undef __METHOD__
|
||||
@@ -642,7 +697,8 @@ int Conduit::getPVDataHolder(PVDataHolder & _pvd) const {
|
||||
* \param _pvc output: PVCtrlHolder
|
||||
* \return ICAFE_NORMAL if OK else ICAFE error
|
||||
*/
|
||||
int Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) const {
|
||||
int Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) const
|
||||
{
|
||||
#define __METHOD__ " Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) "
|
||||
|
||||
Helper helper;
|
||||
@@ -653,17 +709,16 @@ int Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) const {
|
||||
|
||||
if ( channelRegalia.getCafeConnectionState() != ICAFE_CS_NEVER_CONN && channelRegalia.getCafeConnectionState() != ICAFE_CS_CLOSED ) {
|
||||
|
||||
switch(dbrTypeClass)
|
||||
{
|
||||
case CAFENUM::DBR_GR:
|
||||
case CAFENUM::DBR_CTRL:
|
||||
switch(dbrTypeClass) {
|
||||
case CAFENUM::DBR_GR:
|
||||
case CAFENUM::DBR_CTRL:
|
||||
break;
|
||||
default:
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "CAFE INTERNAL FUNNY: dbrTypeClass = " << dbrTypeClass <<
|
||||
" is NOT appropriate for this method" << endl;
|
||||
" is NOT appropriate for this method" << endl;
|
||||
cout << "Method does not deal with this DBR_TYPE: "
|
||||
<< dbr_type_to_text(channelType) << endl;
|
||||
<< dbr_type_to_text(channelType) << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -701,8 +756,7 @@ int Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) const {
|
||||
}
|
||||
|
||||
|
||||
switch (channelType)
|
||||
{
|
||||
switch (channelType) {
|
||||
|
||||
case DBR_CTRL_CHAR:
|
||||
for (unsigned int i=0; i<_pvc.nelem; ++i) {
|
||||
@@ -834,8 +888,8 @@ int Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) const {
|
||||
_pvc.alarmStatus = ((struct dbr_ctrl_enum *) ctrlBuffer)->status;
|
||||
_pvc.alarmSeverity = ((struct dbr_ctrl_enum *) ctrlBuffer)->severity;
|
||||
_pvc.noStr = ((struct dbr_ctrl_enum *) ctrlBuffer)->no_str;
|
||||
memcpy(_pvc.strs , &(((struct dbr_ctrl_enum *) ctrlBuffer)->strs),
|
||||
sizeof(char)*MAX_ENUM_STRING_SIZE*MAX_ENUM_STATES);
|
||||
memcpy(_pvc.strs, &(((struct dbr_ctrl_enum *) ctrlBuffer)->strs),
|
||||
sizeof(char)*MAX_ENUM_STRING_SIZE*MAX_ENUM_STATES);
|
||||
|
||||
//no units
|
||||
memcpy(_pvc.units,"",sizeof(char[MAX_UNITS_SIZE]));
|
||||
@@ -874,6 +928,8 @@ int Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) const {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ICAFE_NORMAL;
|
||||
|
||||
#undef __METHOD__
|
||||
@@ -891,7 +947,8 @@ int Conduit::getPVCtrlHolder(PVCtrlHolder & _pvc) const {
|
||||
* \return ECA_BADTYPE - invalid DBR_XXXX type
|
||||
* \return ECA_ALLOCMEM - a local database event add failed
|
||||
*/
|
||||
int Conduit::monitorStart(MonitorPolicy &mp) const {
|
||||
int Conduit::monitorStart(MonitorPolicy &mp) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::monitorStart(MonitorPolicy mp)"
|
||||
|
||||
|
||||
@@ -899,7 +956,7 @@ int Conduit::monitorStart(MonitorPolicy &mp) const {
|
||||
|
||||
evid eventID;
|
||||
int status = ca_create_subscription(mp.getDbrDataType(), mp.getNelem(), channelRegalia.channelID, mp.getMask(),
|
||||
mp.getHandler(), (void *) mp.getUserArgs(), &eventID);
|
||||
mp.getHandler(), (void *) mp.getUserArgs(), &eventID);
|
||||
|
||||
mp.setEventID(eventID);
|
||||
return status;
|
||||
@@ -912,7 +969,8 @@ int Conduit::monitorStart(MonitorPolicy &mp) const {
|
||||
* \param eventID input: evid
|
||||
* \return ECA_NORMAL if OK else ECA_BADCHID (corrupted CHID)
|
||||
*/
|
||||
int Conduit::monitorStop(evid eventID) const {
|
||||
int Conduit::monitorStop(evid eventID) const
|
||||
{
|
||||
#define __METHOD__ "Conduit::monitorStop(evid eventID)"
|
||||
|
||||
return ca_clear_subscription(eventID);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file conduitGroup.cc
|
||||
/// \file conduitGroup.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date November 2014
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -11,20 +11,24 @@
|
||||
//include <oldAccess.h>
|
||||
//include <Python.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
unsigned int ConduitGroup::groupHandleNext=0;
|
||||
|
||||
/**
|
||||
* ConduitGroup destructor \n
|
||||
* Good place to clean up!
|
||||
* Good place to clean up!
|
||||
*/
|
||||
ConduitGroup::~ConduitGroup(void){
|
||||
ConduitGroup::~ConduitGroup(void)
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* ConduitGroup constructor \n
|
||||
*
|
||||
*/
|
||||
ConduitGroup::ConduitGroup(void){
|
||||
ConduitGroup::ConduitGroup(void)
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +41,8 @@ ConduitGroup::ConduitGroup(void){
|
||||
* \param _mHandle handlt to Conduit object
|
||||
*/
|
||||
ConduitGroup::ConduitGroup(const char * _groupName, ca_client_context * _ccc, CA_SYNC_GID _groupID,
|
||||
unsigned int _nMember, unsigned int * _mHandle){
|
||||
unsigned int _nMember, unsigned int * _mHandle)
|
||||
{
|
||||
|
||||
ccc = _ccc;
|
||||
groupName = _groupName;
|
||||
@@ -49,7 +54,7 @@ ConduitGroup::ConduitGroup(const char * _groupName, ca_client_context * _ccc, C
|
||||
|
||||
channelTimeoutPolicySGGet.setTimeout(DEFAULT_TIMEOUT_SG_PEND_IO);
|
||||
channelTimeoutPolicySGPut.setTimeout(DEFAULT_TIMEOUT_SG_PEND_IO);
|
||||
|
||||
|
||||
channelTimeoutPolicySGGet.setDefaultTimeout(DEFAULT_TIMEOUT_SG_PEND_IO);
|
||||
channelTimeoutPolicySGPut.setDefaultTimeout(DEFAULT_TIMEOUT_SG_PEND_IO);
|
||||
|
||||
@@ -71,7 +76,8 @@ ConduitGroup::ConduitGroup(const char * _groupName, ca_client_context * _ccc, C
|
||||
* Retrieves PV data through channel access into the CAFEConduit::dataBuffer
|
||||
* \return ICAFE_NORMAL if OK
|
||||
*/
|
||||
int ConduitGroup::get(void) const{
|
||||
int ConduitGroup::get(void) const
|
||||
{
|
||||
#define __METHOD__ "ConduitGroup::get(void) const"
|
||||
|
||||
|
||||
@@ -88,10 +94,10 @@ int ConduitGroup::get(void) const{
|
||||
//Returns ECA_NORMAL, ECA_BADSYNCGRP, ECA_BADCHID, ECA_BADCOUNT,
|
||||
//ECA_BADTYPE, ECA_GETFAIL, or 192 if not connected!
|
||||
mStatus[i]=ca_sg_array_get (groupID,
|
||||
(*it_handle).channelRequestMetaData.dbrDataType,
|
||||
(*it_handle).channelRequestMetaData.nelem,
|
||||
(*it_handle).channelRegalia.channelID,
|
||||
(*it_handle).dataBuffer);
|
||||
(*it_handle).channelRequestMetaData.dbrDataType,
|
||||
(*it_handle).channelRequestMetaData.nelem,
|
||||
(*it_handle).channelRegalia.channelID,
|
||||
(*it_handle).dataBuffer);
|
||||
}
|
||||
}
|
||||
} //for
|
||||
@@ -99,15 +105,15 @@ int ConduitGroup::get(void) const{
|
||||
|
||||
//returns ECA_NORMAL, ECA_TIMEOUT, ECA_EVDISALLOW, ECA_BADSYNCGRP
|
||||
|
||||
int groupStatus=ECA_NORMAL;
|
||||
int groupStatus=ECA_NORMAL;
|
||||
|
||||
groupStatus=ca_sg_block(groupID, channelTimeoutPolicySGGet.getTimeout() ); //timeout_sg_pend_io );
|
||||
groupStatus=ca_sg_block(groupID, channelTimeoutPolicySGGet.getTimeout() ); //timeout_sg_pend_io );
|
||||
|
||||
//Withdraw this test for now; not required
|
||||
//while ( (ca_sg_test((*it_groupHandle).getGroupID()) == ECA_IOINPROGRESS
|
||||
// || gStatus == ECA_TIMEOUT) && channelTimeoutPolicySGGet.getSelfGoverningTimeout()
|
||||
// && ntries<channelTimeoutPolicySGGet.getNtries()
|
||||
//)
|
||||
//Withdraw this test for now; not required
|
||||
//while ( (ca_sg_test((*it_groupHandle).getGroupID()) == ECA_IOINPROGRESS
|
||||
// || gStatus == ECA_TIMEOUT) && channelTimeoutPolicySGGet.getSelfGoverningTimeout()
|
||||
// && ntries<channelTimeoutPolicySGGet.getNtries()
|
||||
//)
|
||||
|
||||
if (groupStatus== ECA_TIMEOUT) {
|
||||
CAFEStatus cafeStatus;
|
||||
@@ -121,7 +127,7 @@ int ConduitGroup::get(void) const{
|
||||
cafeStatus.report(groupStatus);
|
||||
}
|
||||
|
||||
return groupStatus;
|
||||
return groupStatus;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -130,7 +136,8 @@ return groupStatus;
|
||||
* Sets PV data from the Conduit::dataBuffer through channel access
|
||||
* \return ICAFE_NORMAL if OK
|
||||
*/
|
||||
int ConduitGroup::put(void) const {
|
||||
int ConduitGroup::put(void) const
|
||||
{
|
||||
#define __METHOD__ "ConduitGroup::put(void) const"
|
||||
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
@@ -146,10 +153,10 @@ int ConduitGroup::put(void) const {
|
||||
//Returns ECA_NORMAL, ECA_BADSYNCGRP, ECA_BADCHID, ECA_BADCOUNT,
|
||||
//ECA_BADTYPE, ECA_GETFAIL, or 192 if not connected!
|
||||
mStatus[i]=ca_sg_array_put (groupID,
|
||||
(*it_handle).channelRequestMetaPrimitive.dbrDataType,
|
||||
(*it_handle).channelRequestMetaPrimitive.nelem,
|
||||
(*it_handle).channelRegalia.channelID,
|
||||
(*it_handle).putBuffer);
|
||||
(*it_handle).channelRequestMetaPrimitive.dbrDataType,
|
||||
(*it_handle).channelRequestMetaPrimitive.nelem,
|
||||
(*it_handle).channelRegalia.channelID,
|
||||
(*it_handle).putBuffer);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -158,36 +165,36 @@ int ConduitGroup::put(void) const {
|
||||
//returns ECA_NORMAL, ECA_TIMEOUT, ECA_EVDISALLOW, ECA-BADSYNCGRP
|
||||
|
||||
|
||||
int groupStatus=ECA_NORMAL;
|
||||
int groupStatus=ECA_NORMAL;
|
||||
|
||||
groupStatus=ca_sg_block(groupID, channelTimeoutPolicySGPut.getTimeout() ); // timeout_sg_pend_io );
|
||||
groupStatus=ca_sg_block(groupID, channelTimeoutPolicySGPut.getTimeout() ); // timeout_sg_pend_io );
|
||||
|
||||
|
||||
// epics code for ca_sg_block
|
||||
/*
|
||||
ca_client_context *pcac;
|
||||
int status = fetchClientContext ( &pcac );
|
||||
if ( status == ECA_NORMAL ) {
|
||||
CASG * pcasg;
|
||||
{
|
||||
epicsGuard < epicsMutex > guard ( pcac->mutex );
|
||||
pcasg = pcac->lookupCASG ( guard, groupID );
|
||||
if ( pcasg ) {
|
||||
status = pcasg->block (
|
||||
pcac->pCallbackGuard.get (), guard, channelTimeoutPolicySGPut.getTimeout() );
|
||||
}
|
||||
else {
|
||||
status = ECA_BADSYNCGRP;
|
||||
}
|
||||
}
|
||||
if ( pcasg ) {
|
||||
sync_group_reset ( *pcac, *pcasg );
|
||||
}
|
||||
}
|
||||
*/
|
||||
//ca_poll();
|
||||
//ca_sg_test(groupID);
|
||||
//sleep(1);
|
||||
// epics code for ca_sg_block
|
||||
/*
|
||||
ca_client_context *pcac;
|
||||
int status = fetchClientContext ( &pcac );
|
||||
if ( status == ECA_NORMAL ) {
|
||||
CASG * pcasg;
|
||||
{
|
||||
epicsGuard < epicsMutex > guard ( pcac->mutex );
|
||||
pcasg = pcac->lookupCASG ( guard, groupID );
|
||||
if ( pcasg ) {
|
||||
status = pcasg->block (
|
||||
pcac->pCallbackGuard.get (), guard, channelTimeoutPolicySGPut.getTimeout() );
|
||||
}
|
||||
else {
|
||||
status = ECA_BADSYNCGRP;
|
||||
}
|
||||
}
|
||||
if ( pcasg ) {
|
||||
sync_group_reset ( *pcac, *pcasg );
|
||||
}
|
||||
}
|
||||
*/
|
||||
//ca_poll();
|
||||
//ca_sg_test(groupID);
|
||||
//sleep(1);
|
||||
|
||||
|
||||
|
||||
@@ -198,6 +205,6 @@ int ConduitGroup::put(void) const {
|
||||
}
|
||||
//groupStatus is ECA_NORMAL even if one of the channels is disconnected
|
||||
|
||||
return groupStatus;
|
||||
return groupStatus;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
4110
src/connect.cpp
4110
src/connect.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file connectCallbacks.cc
|
||||
/// \file connectCallbacks.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -25,7 +25,8 @@ extern epicsMutex cafeMutex;
|
||||
* - whenever the access rights of a connected channel changes \n
|
||||
* \param args output: access_rights_handler_args parameters \n
|
||||
*/
|
||||
void Connect::callbackHandlerAccessRights(struct access_rights_handler_args args) {
|
||||
void Connect::callbackHandlerAccessRights(struct access_rights_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "Connect::callbackHandlerAccessRights"
|
||||
|
||||
//Note: At first connection the no of elements is unknown!
|
||||
@@ -40,9 +41,13 @@ void Connect::callbackHandlerAccessRights(struct access_rights_handler_args args
|
||||
it_handle = handle_index.find((unsigned int) _handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_accessRightsHandlerArgs(args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -57,14 +62,15 @@ void Connect::callbackHandlerAccessRights(struct access_rights_handler_args args
|
||||
* \param args output: exception_handler_args parameters \n
|
||||
*
|
||||
*/
|
||||
void Connect::callbackHandlerException(struct exception_handler_args args) {
|
||||
void Connect::callbackHandlerException(struct exception_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "Connect::callbackHandlerException"
|
||||
|
||||
// This routine is called on disconnect before the connection handler
|
||||
// cout << "-------------------------------------------------------------" << endl;
|
||||
// cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
// cout << "Warning: Virtual circuit disconnect" << endl;
|
||||
// cout << "Exception Handler Args has status = " << args.stat << endl;
|
||||
// This routine is called on disconnect before the connection handler
|
||||
// cout << "-------------------------------------------------------------" << endl;
|
||||
// cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
// cout << "Warning: Virtual circuit disconnect" << endl;
|
||||
// cout << "Exception Handler Args has status = " << args.stat << endl;
|
||||
|
||||
unsigned int _handle=0;
|
||||
|
||||
@@ -73,21 +79,21 @@ void Connect::callbackHandlerException(struct exception_handler_args args) {
|
||||
|
||||
|
||||
if (args.chid) {
|
||||
strcpy(pName , ca_name(args.chid));
|
||||
strcpy(pName, ca_name(args.chid));
|
||||
_handle = (unsigned long) ca_puser(args.chid);
|
||||
sprintf(buf,
|
||||
"%s with request handle=%d, channel=%s, op=%ld, datatype=%s, count=%ld. %s",
|
||||
args.ctx, (unsigned int) _handle, pName, args.op, dbr_type_to_text (args.type), args.count,
|
||||
"Possibly an IOC has been switched off or is rebooting.");
|
||||
"%s with request handle=%d, channel=%s, op=%ld, datatype=%s, count=%ld. %s",
|
||||
args.ctx, (unsigned int) _handle, pName, args.op, dbr_type_to_text (args.type), args.count,
|
||||
"Possibly an IOC has been switched off or is rebooting.");
|
||||
|
||||
}
|
||||
// This case is more usual(!)
|
||||
else {
|
||||
strcpy(pName , "unknown");
|
||||
strcpy(pName, "unknown");
|
||||
sprintf(buf,
|
||||
"%s with channel=%s, op=%ld, datatype=%s, count=%ld. %s",
|
||||
args.ctx, pName, args.op, dbr_type_to_text (args.type), args.count,
|
||||
"Possibly an IOC has been switched off or is rebooting.\n");
|
||||
"%s with channel=%s, op=%ld, datatype=%s, count=%ld. %s",
|
||||
args.ctx, pName, args.op, dbr_type_to_text (args.type), args.count,
|
||||
"Possibly an IOC has been switched off or is rebooting.\n");
|
||||
}
|
||||
|
||||
ca_signal (args.stat, buf);
|
||||
|
||||
1334
src/connectGroup.cpp
1334
src/connectGroup.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file enumStrings.cc
|
||||
/// \file enumStrings.cpp
|
||||
/// \author Modified by Jan Chrin, PSI from Astari's C++11 version \n
|
||||
/// Using boost::begin() boost::end() for C++
|
||||
/// \date Release, February 2015
|
||||
@@ -13,21 +13,18 @@
|
||||
|
||||
|
||||
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) {}
|
||||
};
|
||||
@@ -42,7 +39,7 @@ std::ostream& operator<<(std::ostream& str, enumConstRefHolder<T> const& data)
|
||||
}
|
||||
else {
|
||||
return str << "ERROR: enumStrings.h reports data.enumVal= " << data.enumVal
|
||||
<< " DOES NOT HAVE A STRING EQUIVALENT!";
|
||||
<< " DOES NOT HAVE A STRING EQUIVALENT!";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,28 +59,33 @@ 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 ) ));
|
||||
std::find (boost::begin(enumStrings<T>::data), boost::end(enumStrings<T>::data), value ) ));
|
||||
}
|
||||
|
||||
|
||||
if (data.enumVal > boost::size( enumStrings<T>::data) ) {
|
||||
|
||||
std::cout << "ERROR: enumStrings.h reports data.enumVal = " << data.enumVal
|
||||
<< " is out of enum range = " << boost::size( enumStrings<T>::data) << std::endl;
|
||||
<< " is out of enum range = " << boost::size( enumStrings<T>::data) << std::endl;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
enumConstRefHolder<T> enumToString(T const& e) {return enumConstRefHolder<T>(e);}
|
||||
enumConstRefHolder<T> enumToString(T const& e)
|
||||
{
|
||||
return enumConstRefHolder<T>(e);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
enumRefHolder<T> enumFromString(T& e) {return enumRefHolder<T>(e);}
|
||||
enumRefHolder<T> enumFromString(T& e)
|
||||
{
|
||||
return enumRefHolder<T>(e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file exceptionsHelper.cc
|
||||
/// \file exceptionsHelper.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release, February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "exceptionsHelper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* \brief Populates the CAFEException_pv struct; precedes throw(e)
|
||||
* \param pv input: process variable
|
||||
@@ -19,8 +21,9 @@
|
||||
* \return struct CAFEException_pv
|
||||
*/
|
||||
CAFEException_pv ExceptionsHelper::prepareCAFEException_pv(const char *pv, const char *pvAlias,
|
||||
unsigned int handle, chid pCh, int status,
|
||||
const char * source, unsigned int ln) {
|
||||
unsigned int handle, chid pCh, int status,
|
||||
const char * source, unsigned int ln)
|
||||
{
|
||||
#define __METHOD__ "Connect::prepareCAFEException_pv"
|
||||
|
||||
CAFEException_pv e;
|
||||
@@ -65,25 +68,26 @@ CAFEException_pv ExceptionsHelper::prepareCAFEException_pv(const char *pv, const
|
||||
* \brief Prints CAFEException_pv to std out
|
||||
* \param e input: struct CAFEException
|
||||
*/
|
||||
void ExceptionsHelper::printCAFEException_pv(CAFEException_pv & e) {
|
||||
void ExceptionsHelper::printCAFEException_pv(CAFEException_pv & e)
|
||||
{
|
||||
#define __METHOD__ "ExceptionsHelper::printCAFEException_pv"
|
||||
|
||||
cout << "------------------------------------" << endl;
|
||||
cout << __METHOD__ << endl;
|
||||
cout << "------------------------------------" << endl;
|
||||
cout << "Handle : " << e.handle << endl;
|
||||
cout << "Process Variable (PV): " << e.pv << endl;
|
||||
if ( strcmp(e.pv,e.pvAlias) ) {
|
||||
cout << "------------------------------------" << endl;
|
||||
cout << __METHOD__ << endl;
|
||||
cout << "------------------------------------" << endl;
|
||||
cout << "Handle : " << e.handle << endl;
|
||||
cout << "Process Variable (PV): " << e.pv << endl;
|
||||
if ( strcmp(e.pv,e.pvAlias) ) {
|
||||
cout << "PV Alias : " << e.pvAlias << endl;
|
||||
}
|
||||
cout << "PV Native Type : " << e.dataTypeNative << " ("
|
||||
<< e.dataTypeNativeText << ") " << endl;
|
||||
cout << "Status Code : " << e.statusCode << endl;
|
||||
cout << "Status Message : " << e.statusCodeText << endl;
|
||||
cout << "Error Description : " << e.statusMessage << endl;
|
||||
cout << "Source Method/Line : " << e.source << "/" << e.ln << endl;
|
||||
cout << "------------------------------------" << endl;
|
||||
return;
|
||||
}
|
||||
cout << "PV Native Type : " << e.dataTypeNative << " ("
|
||||
<< e.dataTypeNativeText << ") " << endl;
|
||||
cout << "Status Code : " << e.statusCode << endl;
|
||||
cout << "Status Message : " << e.statusCodeText << endl;
|
||||
cout << "Error Description : " << e.statusMessage << endl;
|
||||
cout << "Source Method/Line : " << e.source << "/" << e.ln << endl;
|
||||
cout << "------------------------------------" << endl;
|
||||
return;
|
||||
|
||||
#undef __METHOD__
|
||||
}
|
||||
@@ -99,8 +103,9 @@ void ExceptionsHelper::printCAFEException_pv(CAFEException_pv & e) {
|
||||
* \return struct CAFEException_group
|
||||
*/
|
||||
CAFEException_group ExceptionsHelper::prepareCAFEException_group(char groupName[PVNAME_SIZE],
|
||||
unsigned int ghandle, int status,
|
||||
const char * source, unsigned int ln) {
|
||||
unsigned int ghandle, int status,
|
||||
const char * source, unsigned int ln)
|
||||
{
|
||||
#define __METHOD__ "Connect::prepareCAFEExceptionGroup"
|
||||
|
||||
CAFEException_group e;
|
||||
|
||||
2090
src/granules.cpp
2090
src/granules.cpp
File diff suppressed because it is too large
Load Diff
2747
src/handleHelper.cpp
2747
src/handleHelper.cpp
File diff suppressed because it is too large
Load Diff
157
src/helper.cpp
157
src/helper.cpp
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file helper.cc
|
||||
/// \file helper.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -20,28 +20,29 @@ using namespace std;
|
||||
* \param pv input: process variable name
|
||||
* \param pvStripped output: process variable name stripped of forward and trailing spaces
|
||||
*/
|
||||
void Helper::removeLeadingAndTrailingSpacesDbrString(const char * pv, char pvStripped[MAX_STRING_SIZE]) {
|
||||
void Helper::removeLeadingAndTrailingSpacesDbrString(const char * pv, char pvStripped[MAX_STRING_SIZE])
|
||||
{
|
||||
#define __METHOD__ "Helper::removeLeadingAndTrailingSpacesDbrString(const char * pv, char[MAX_STRING_SIZE])"
|
||||
// Remove leading and trailing blanks
|
||||
std::string pvS=pv;
|
||||
// Remove leading and trailing blanks
|
||||
std::string pvS=pv;
|
||||
|
||||
size_t found1 = pvS.find_first_not_of(" ");
|
||||
size_t found2 = pvS.find_last_not_of (" ");
|
||||
size_t found1 = pvS.find_first_not_of(" ");
|
||||
size_t found2 = pvS.find_last_not_of (" ");
|
||||
|
||||
if (found1!=std::string::npos && found2 !=std::string::npos) {
|
||||
if (found1!=std::string::npos && found2 !=std::string::npos) {
|
||||
|
||||
size_t found21 = std::min((int)((found2+1)-found1), (int) (MAX_STRING_SIZE-1));
|
||||
size_t length = pvS.copy(pvStripped,found21,found1);
|
||||
size_t found21 = std::min((int)((found2+1)-found1), (int) (MAX_STRING_SIZE-1));
|
||||
size_t length = pvS.copy(pvStripped,found21,found1);
|
||||
|
||||
pvStripped[length]='\0'; //required
|
||||
pvStripped[length]='\0'; //required
|
||||
|
||||
}
|
||||
else {
|
||||
std::strcpy(pvStripped,"");
|
||||
}
|
||||
else {
|
||||
std::strcpy(pvStripped,"");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
@@ -51,28 +52,29 @@ void Helper::removeLeadingAndTrailingSpacesDbrString(const char * pv, char pvStr
|
||||
* \param pv input: process variable name
|
||||
* \param pvStripped output: process variable name stripped of forward and trailing spaces
|
||||
*/
|
||||
void Helper::removeLeadingAndTrailingSpacesPseudo(const char * pv, char pvStripped[PVGROUP_PSEUDO_SIZE]) {
|
||||
void Helper::removeLeadingAndTrailingSpacesPseudo(const char * pv, char pvStripped[PVGROUP_PSEUDO_SIZE])
|
||||
{
|
||||
#define __METHOD__ "Helper::removeLeadingAndTrailingSpacesPseudo(const char * pv, char[PVGROUP_PSEUDO_SIZE])"
|
||||
// Remove leading and trailing blanks
|
||||
std::string pvS=pv;
|
||||
// Remove leading and trailing blanks
|
||||
std::string pvS=pv;
|
||||
|
||||
size_t found1 = pvS.find_first_not_of(" ");
|
||||
size_t found2 = pvS.find_last_not_of (" ");
|
||||
size_t found1 = pvS.find_first_not_of(" ");
|
||||
size_t found2 = pvS.find_last_not_of (" ");
|
||||
|
||||
if (found1!=std::string::npos && found2 !=std::string::npos) {
|
||||
if (found1!=std::string::npos && found2 !=std::string::npos) {
|
||||
|
||||
size_t found21 = std::min((int)((found2+1)-found1), (int) (PVGROUP_PSEUDO_SIZE-1));
|
||||
size_t length = pvS.copy(pvStripped,found21,found1);
|
||||
size_t found21 = std::min((int)((found2+1)-found1), (int) (PVGROUP_PSEUDO_SIZE-1));
|
||||
size_t length = pvS.copy(pvStripped,found21,found1);
|
||||
|
||||
pvStripped[length]='\0'; //required
|
||||
pvStripped[length]='\0'; //required
|
||||
|
||||
}
|
||||
else {
|
||||
std::strcpy(pvStripped,"isEmpty");
|
||||
}
|
||||
else {
|
||||
std::strcpy(pvStripped,"isEmpty");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
#undef __METHOD__
|
||||
}
|
||||
|
||||
@@ -82,7 +84,8 @@ void Helper::removeLeadingAndTrailingSpacesPseudo(const char * pv, char pvStripp
|
||||
* \param pv input: process variable name
|
||||
* \param pvStripped output: process variable name stripped of forward and trailing spaces
|
||||
*/
|
||||
void Helper::removeLeadingAndTrailingSpaces(const char * pv, char pvStripped[PVNAME_SIZE]) {
|
||||
void Helper::removeLeadingAndTrailingSpaces(const char * pv, char pvStripped[PVNAME_SIZE])
|
||||
{
|
||||
#define __METHOD__ "Helper::removeLeadingAndTrailingSpaces(const char * pv, char[PVNAME_SIZE])"
|
||||
// Remove leading and trailing blanks
|
||||
std::string pvS=pv;
|
||||
@@ -92,7 +95,7 @@ void Helper::removeLeadingAndTrailingSpaces(const char * pv, char pvStripped[PVN
|
||||
|
||||
if (found1!=std::string::npos && found2 !=std::string::npos) {
|
||||
|
||||
size_t found21 = std::min((int)((found2+1)-found1), (int) (PVNAME_SIZE-1));
|
||||
size_t found21 = std::min((int)((found2+1)-found1), (int) (PVNAME_SIZE-1));
|
||||
size_t length = pvS.copy(pvStripped,found21,found1);
|
||||
|
||||
pvStripped[length]='\0'; //required
|
||||
@@ -116,13 +119,14 @@ void Helper::removeLeadingAndTrailingSpaces(const char * pv, char pvStripped[PVN
|
||||
* \param ghs input: size of gs (group handle set)
|
||||
* \return unique identifier
|
||||
*/
|
||||
unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context * ccc, unsigned int ghs) {
|
||||
unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context * ccc, unsigned int ghs)
|
||||
{
|
||||
#define __METHOD__ "Helper::convertToUniqueNumber(const char * pv, ca_client_context * ccc, unsigned int ghs)"
|
||||
|
||||
std::string myString=pv;
|
||||
char s[12];
|
||||
|
||||
sprintf(s,"%ld", (unsigned long) ccc);
|
||||
sprintf(s,"%lu", (unsigned long) ccc);
|
||||
|
||||
|
||||
unsigned int numberPV = 0;
|
||||
@@ -133,28 +137,28 @@ unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context *
|
||||
|
||||
numberContext = atoi(s);
|
||||
|
||||
unsigned int intValueIs=0;
|
||||
unsigned int intValueIs=0;
|
||||
unsigned int iL=0;
|
||||
|
||||
|
||||
for (unsigned int i=0; i< myString.size(); i++) {
|
||||
|
||||
intValueIs= (unsigned int) myString[i];
|
||||
ld=1;
|
||||
|
||||
if ( (intValueIs >47 && intValueIs < 58) ||
|
||||
(intValueIs >64 && intValueIs < 91) ||
|
||||
(intValueIs >97 && intValueIs < 123) ) {
|
||||
dpow=pow((float) 42, (int) iL%4);
|
||||
ld = static_cast<unsigned int>(dpow);
|
||||
++iL;
|
||||
}
|
||||
else {
|
||||
iL=0;
|
||||
}
|
||||
|
||||
numberPV += (intValueIs*ld*(i+1));
|
||||
|
||||
intValueIs= (unsigned int) myString[i];
|
||||
ld=1;
|
||||
|
||||
if ( (intValueIs >47 && intValueIs < 58) ||
|
||||
(intValueIs >64 && intValueIs < 91) ||
|
||||
(intValueIs >97 && intValueIs < 123) ) {
|
||||
dpow=pow((float) 42, (int) iL%4);
|
||||
ld = static_cast<unsigned int>(dpow);
|
||||
++iL;
|
||||
}
|
||||
else {
|
||||
iL=0;
|
||||
}
|
||||
|
||||
numberPV += (intValueIs*ld*(i+1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int final=(numberPV+numberContext+((ghs+1)*10000+ghs));
|
||||
@@ -169,13 +173,14 @@ unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context *
|
||||
* \param ccc input: current context
|
||||
* \return unique identifier
|
||||
*/
|
||||
unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context * ccc) {
|
||||
unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context * ccc)
|
||||
{
|
||||
#define __METHOD__ "Helper::convertToUniqueNumber(const char * pv, ca_client_context * ccc)"
|
||||
|
||||
std::string myString=pv;
|
||||
char s[12];
|
||||
|
||||
sprintf(s,"%ld", (unsigned long) ccc);
|
||||
sprintf(s,"%lu", (unsigned long) ccc);
|
||||
|
||||
unsigned int numberPV = 0;
|
||||
unsigned int numberContext =0 ;
|
||||
@@ -185,29 +190,29 @@ unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context *
|
||||
numberContext = atoi(s);
|
||||
|
||||
|
||||
unsigned int intValueIs=0;
|
||||
unsigned int intValueIs=0;
|
||||
unsigned int iL=0;
|
||||
|
||||
for (unsigned int i=0; i< myString.size(); i++) {
|
||||
|
||||
intValueIs= (unsigned int) myString[i];
|
||||
ld=1;
|
||||
|
||||
if ( (intValueIs >47 && intValueIs < 58) ||
|
||||
(intValueIs >64 && intValueIs < 91) ||
|
||||
(intValueIs >97 && intValueIs < 123) ) {
|
||||
dpow=pow((float)42, (int)iL%4);
|
||||
ld = static_cast<unsigned int>(dpow);
|
||||
++iL;
|
||||
}
|
||||
else {
|
||||
iL=0;
|
||||
}
|
||||
|
||||
numberPV += (intValueIs*ld*(i+1));
|
||||
for (unsigned int i=0; i< myString.size(); i++) {
|
||||
|
||||
intValueIs= (unsigned int) myString[i];
|
||||
ld=1;
|
||||
|
||||
if ( (intValueIs >47 && intValueIs < 58) ||
|
||||
(intValueIs >64 && intValueIs < 91) ||
|
||||
(intValueIs >97 && intValueIs < 123) ) {
|
||||
dpow=pow((float)42, (int)iL%4);
|
||||
ld = static_cast<unsigned int>(dpow);
|
||||
++iL;
|
||||
}
|
||||
else {
|
||||
iL=0;
|
||||
}
|
||||
|
||||
numberPV += (intValueIs*ld*(i+1));
|
||||
|
||||
}
|
||||
|
||||
|
||||
return (numberPV+numberContext);
|
||||
#undef __METHOD__
|
||||
}
|
||||
@@ -219,7 +224,8 @@ unsigned int Helper::convertToUniqueNumber(const char * pv, ca_client_context *
|
||||
* \param _chtype input: channel type
|
||||
* \return CAFENUM::DBR_TYPE
|
||||
*/
|
||||
CAFENUM::DBR_TYPE Helper::convertToCAFEDbrTypeClass(const chtype _chtype) const {
|
||||
CAFENUM::DBR_TYPE Helper::convertToCAFEDbrTypeClass(const chtype _chtype) const
|
||||
{
|
||||
#define __METHOD__ "Helper::convertToCAFEDbrTypeClass(const chtype _chtype)"
|
||||
|
||||
if (_chtype>=DBR_STRING && _chtype <= DBR_DOUBLE) {
|
||||
@@ -259,7 +265,8 @@ CAFENUM::DBR_TYPE Helper::convertToCAFEDbrTypeClass(const chtype _chtype) const
|
||||
* \param nChar input: size of array
|
||||
* \return std:string The concatinated string
|
||||
*/
|
||||
std::string Helper::concatToString(dbr_char_t * inpChar, unsigned int nChar){
|
||||
std::string Helper::concatToString(dbr_char_t * inpChar, unsigned int nChar)
|
||||
{
|
||||
|
||||
std::string psWF = "";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file loadCollectionXMLParser.cc
|
||||
/// \file loadCollectionXMLParser.cpp
|
||||
/// \author Jan Chrin, G. Prekas, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
|
||||
#include "loadCollectionXMLParser.h"
|
||||
#include <loadCollectionXMLParser.h>
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
const QString& loadCollectionXMLParser::tagConfig = "config";
|
||||
@@ -18,14 +18,17 @@ const QString& loadCollectionXMLParser::tagAttribute = "attribute";
|
||||
const QString& loadCollectionXMLParser::tagMember = "member";
|
||||
const QString& loadCollectionXMLParser::tagDevice = "device";
|
||||
|
||||
loadCollectionXMLParser::loadCollectionXMLParser() {
|
||||
loadCollectionXMLParser::loadCollectionXMLParser()
|
||||
{
|
||||
}
|
||||
|
||||
loadCollectionXMLParser::~loadCollectionXMLParser() {
|
||||
loadCollectionXMLParser::~loadCollectionXMLParser()
|
||||
{
|
||||
}
|
||||
|
||||
bool loadCollectionXMLParser::startElement(const QString& namespaceURI, const QString& localName,
|
||||
const QString& qName, const QXmlAttributes& atts) {
|
||||
const QString& qName, const QXmlAttributes& atts)
|
||||
{
|
||||
|
||||
bool error = false;
|
||||
|
||||
@@ -35,37 +38,47 @@ bool loadCollectionXMLParser::startElement(const QString& namespaceURI, const QS
|
||||
devCollection = deviceCollection();
|
||||
devCollection.name = atts.value("id").toAscii().constData();
|
||||
state=NotWaiting;
|
||||
} else if (localName.compare(tagDescription, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagDescription, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForDescription;
|
||||
} else if (localName.compare(tagAttributes, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagAttributes, Qt::CaseInsensitive) == 0) {
|
||||
state=NotWaiting;
|
||||
} else if (localName.compare(tagAttribute, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagAttribute, Qt::CaseInsensitive) == 0) {
|
||||
state=WaitingForAttribute;
|
||||
} else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
cMember=collectionMember();
|
||||
cMember.devicePosition = atts.value("pos").toFloat();
|
||||
state=NotWaiting;
|
||||
} else if (localName.compare(tagDevice, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagDevice, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForDevice;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
error = true;
|
||||
}
|
||||
return !error;
|
||||
}
|
||||
|
||||
bool loadCollectionXMLParser::endElement(const QString& namespaceURI, const QString& localName,
|
||||
const QString& qName) {
|
||||
const QString& qName)
|
||||
{
|
||||
if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
deviceCollectionV.push_back(devCollection);
|
||||
} else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
devCollection.cMembers.push_back(cMember);
|
||||
} else if (localName.compare(tagAttribute, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagAttribute, Qt::CaseInsensitive) == 0) {
|
||||
devCollection.attributes.push_back(attributeName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool loadCollectionXMLParser::characters(const QString& ch) {
|
||||
bool loadCollectionXMLParser::characters(const QString& ch)
|
||||
{
|
||||
bool error = false;
|
||||
|
||||
std::string data = ch.trimmed().toAscii().constData();;
|
||||
@@ -73,24 +86,24 @@ bool loadCollectionXMLParser::characters(const QString& ch) {
|
||||
|
||||
switch (state) {
|
||||
|
||||
case WaitingForDevice:
|
||||
cMember.deviceName = data;
|
||||
//printf( "Waiting for Device %s \n", data.c_str());
|
||||
break;
|
||||
case WaitingForDescription:
|
||||
//printf( "Waiting for Description %s \n", data.c_str());
|
||||
devCollection.description = data;
|
||||
break;
|
||||
case WaitingForAttribute:
|
||||
//printf( "Waiting for Attribute %s \n", data.c_str());
|
||||
attributeName = data;
|
||||
break;
|
||||
case NotWaiting:
|
||||
break;
|
||||
default:
|
||||
error = true;
|
||||
printf("Unexpected state in loadCollectionXMLParser::characters : '%s'\n", data.c_str());
|
||||
break;
|
||||
case WaitingForDevice:
|
||||
cMember.deviceName = data;
|
||||
//printf( "Waiting for Device %s \n", data.c_str());
|
||||
break;
|
||||
case WaitingForDescription:
|
||||
//printf( "Waiting for Description %s \n", data.c_str());
|
||||
devCollection.description = data;
|
||||
break;
|
||||
case WaitingForAttribute:
|
||||
//printf( "Waiting for Attribute %s \n", data.c_str());
|
||||
attributeName = data;
|
||||
break;
|
||||
case NotWaiting:
|
||||
break;
|
||||
default:
|
||||
error = true;
|
||||
printf("Unexpected state in loadCollectionXMLParser::characters : '%s'\n", data.c_str());
|
||||
break;
|
||||
}
|
||||
return !error;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file loadGroupXMLParser.cc
|
||||
/// \file loadGroupXMLParser.cpp
|
||||
/// \author Jan Chrin, G. Prekas, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
|
||||
#include "loadGroupXMLParser.h"
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#if HAVE_LIBQTXML
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -28,108 +28,129 @@ const QString&loadGroupXMLParser::tagId = "id";
|
||||
const QString&loadGroupXMLParser::tagAttrib = "attribute";
|
||||
const QString&loadGroupXMLParser::tagCollectiveType = "collectivetype";
|
||||
|
||||
loadGroupXMLParser::loadGroupXMLParser() {
|
||||
loadGroupXMLParser::loadGroupXMLParser()
|
||||
{
|
||||
}
|
||||
|
||||
loadGroupXMLParser::~loadGroupXMLParser() {
|
||||
loadGroupXMLParser::~loadGroupXMLParser()
|
||||
{
|
||||
}
|
||||
|
||||
bool loadGroupXMLParser::startElement(const QString& namespaceURI, const QString& localName,
|
||||
const QString& qName, const QXmlAttributes& atts) {
|
||||
bool loadGroupXMLParser::startElement(const QString& namespaceURI, const QString& localName,
|
||||
const QString& qName, const QXmlAttributes& atts)
|
||||
{
|
||||
|
||||
bool error = false;
|
||||
|
||||
if (localName.compare(tagCollection_list, Qt::CaseInsensitive) == 0) {
|
||||
|
||||
}else if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
group = deviceGroup();
|
||||
group.id = atts.value("id").toAscii().constData();
|
||||
|
||||
} else if (localName.compare(tagDescription, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagDescription, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForDescription;
|
||||
} else if (localName.compare(tagStatusGroup, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagStatusGroup, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForStatusGroup;
|
||||
} else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForMember;
|
||||
} else if (localName.compare(tagName, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagName, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForName;
|
||||
} else if (localName.compare(tagNelem, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagNelem, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForNelem;
|
||||
} else if (localName.compare(tagStatus, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagStatus, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForStatus;
|
||||
} else if (localName.compare(tagRule, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagRule, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForRule;
|
||||
} else if (localName.compare(tagDataType, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagDataType, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForDataType;
|
||||
} else if (localName.compare(tagCollection, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagCollection, Qt::CaseInsensitive) == 0) {
|
||||
collection = collectionInGroup();
|
||||
} else if (localName.compare(tagId, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagId, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForId;
|
||||
} else if (localName.compare(tagAttrib, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagAttrib, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForAttrib;
|
||||
} else if (localName.compare(tagCollectiveType, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagCollectiveType, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForCollectiveType;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
error = true;
|
||||
|
||||
}
|
||||
return !error;
|
||||
}
|
||||
|
||||
bool loadGroupXMLParser::endElement(const QString& namespaceURI,
|
||||
const QString& localName, const QString& qName) {
|
||||
bool loadGroupXMLParser::endElement(const QString& namespaceURI,
|
||||
const QString& localName, const QString& qName)
|
||||
{
|
||||
if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
groups.push_back(group);
|
||||
} else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
group.xmlMembers.push_back(xmlMem);
|
||||
} else if (localName.compare(tagCollection, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagCollection, Qt::CaseInsensitive) == 0) {
|
||||
group.collections.push_back(collection);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool loadGroupXMLParser::characters(const QString& ch) {
|
||||
bool loadGroupXMLParser::characters(const QString& ch)
|
||||
{
|
||||
bool error = false;
|
||||
|
||||
std::string data = ch.trimmed().toAscii().constData();
|
||||
|
||||
switch (state) {
|
||||
case WaitingForDescription:
|
||||
group.description = data;
|
||||
break;
|
||||
case WaitingForStatusGroup:
|
||||
case WaitingForMember:
|
||||
break;
|
||||
|
||||
case WaitingForName:
|
||||
xmlMem=data;
|
||||
break;
|
||||
case WaitingForNelem:
|
||||
case WaitingForDescription:
|
||||
group.description = data;
|
||||
break;
|
||||
case WaitingForStatusGroup:
|
||||
case WaitingForMember:
|
||||
break;
|
||||
|
||||
break;
|
||||
case WaitingForStatus:
|
||||
case WaitingForName:
|
||||
xmlMem=data;
|
||||
break;
|
||||
case WaitingForNelem:
|
||||
|
||||
break;
|
||||
case WaitingForRule:
|
||||
break;
|
||||
case WaitingForStatus:
|
||||
|
||||
break;
|
||||
case WaitingForDataType:
|
||||
break;
|
||||
case WaitingForRule:
|
||||
|
||||
break;
|
||||
case WaitingForId:
|
||||
collection.id = data;
|
||||
break;
|
||||
case WaitingForAttrib:
|
||||
collection.attrib = data;
|
||||
break;
|
||||
case WaitingForCollectiveType:
|
||||
break;
|
||||
default:
|
||||
error = true;
|
||||
printf("Unexpected state in loadGroupXMLParser::characters: '%s'\n", data.c_str());
|
||||
break;
|
||||
}
|
||||
return !error;
|
||||
break;
|
||||
case WaitingForDataType:
|
||||
|
||||
break;
|
||||
case WaitingForId:
|
||||
collection.id = data;
|
||||
break;
|
||||
case WaitingForAttrib:
|
||||
collection.attrib = data;
|
||||
break;
|
||||
case WaitingForCollectiveType:
|
||||
break;
|
||||
default:
|
||||
error = true;
|
||||
printf("Unexpected state in loadGroupXMLParser::characters: '%s'\n", data.c_str());
|
||||
break;
|
||||
}
|
||||
return !error;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
32
src/makefile
32
src/makefile
@@ -111,21 +111,21 @@ AMTAR = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run tar
|
||||
#if HAVE_ZEROMQ
|
||||
#libcafe_la_SOURCES += cafeService.cpp
|
||||
#endif
|
||||
AM_CPPFLAGS = -fexceptions -fPIC -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml -I$(top_srcdir)/include
|
||||
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
|
||||
AM_CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml -I/opt/gfa/python-3.5/latest/include/python3.5m -I$(top_srcdir)/include
|
||||
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64 -L/opt/gfa/python-3.5/latest/lib -Wl,-rpath,/opt/gfa/python-3.5/latest/lib
|
||||
AR = ar
|
||||
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoconf
|
||||
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoheader
|
||||
AUTOMAKE = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run automake-1.11
|
||||
AWK = gawk
|
||||
CAFE_CPPFLAGS = -I$(top_srcdir)/include
|
||||
CC = gcc
|
||||
CC = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -g -O2
|
||||
CPP = gcc -E
|
||||
CPPFLAGS = -fexceptions -fPIC -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
|
||||
CXX = g++
|
||||
CXXCPP = g++ -E
|
||||
CPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc -E
|
||||
CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml -I/opt/gfa/python-3.5/latest/include/python3.5m
|
||||
CXX = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++
|
||||
CXXCPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++ -E
|
||||
CXXDEPMODE = depmode=gcc3
|
||||
CXXFLAGS = -g -O2
|
||||
CYGPATH_W = echo
|
||||
@@ -146,9 +146,9 @@ INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_SCRIPT = ${INSTALL}
|
||||
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
|
||||
LD = /usr/bin/ld -m elf_x86_64
|
||||
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
|
||||
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64 -L/opt/gfa/python-3.5/latest/lib -Wl,-rpath,/opt/gfa/python-3.5/latest/lib
|
||||
LIBOBJS =
|
||||
LIBS = -lQtXml -lQtCore
|
||||
LIBS = -lpython3.5m -lQtXml -lQtCore
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LIPO =
|
||||
LN_S = ln -s
|
||||
@@ -164,22 +164,22 @@ OTOOL64 =
|
||||
PACKAGE = cafe
|
||||
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
|
||||
PACKAGE_NAME = CAFE
|
||||
PACKAGE_STRING = CAFE 1.0.0
|
||||
PACKAGE_STRING = CAFE 1.8.0
|
||||
PACKAGE_TARNAME = cafe
|
||||
PACKAGE_VERSION = 1.0.0
|
||||
PACKAGE_VERSION = 1.8.0
|
||||
PATH_SEPARATOR = :
|
||||
RANLIB = ranlib
|
||||
SED = /bin/sed
|
||||
SET_MAKE =
|
||||
SHELL = /bin/sh
|
||||
STRIP = strip
|
||||
VERSION = 1.0.0
|
||||
VERSION = 1.8.0
|
||||
abs_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/src
|
||||
abs_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/src
|
||||
abs_top_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
|
||||
abs_top_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
|
||||
ac_ct_CC = gcc
|
||||
ac_ct_CXX = g++
|
||||
ac_ct_CC = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
|
||||
ac_ct_CXX =
|
||||
ac_ct_DUMPBIN =
|
||||
am__include = include
|
||||
am__leading_dot = .
|
||||
@@ -207,7 +207,7 @@ htmldir = ${docdir}
|
||||
includedir = ${prefix}/include
|
||||
infodir = ${datarootdir}/info
|
||||
install_sh = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/install-sh
|
||||
libdir = /opt/gfa/cafe/cpp/cafe-1.5.0-final-2/lib
|
||||
libdir = /opt/gfa/cafe/python/python-3.5/pycafe-1.8.0/lib
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
@@ -216,7 +216,7 @@ mandir = ${datarootdir}/man
|
||||
mkdir_p = /bin/mkdir -p
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.5.0-final-2
|
||||
prefix = /opt/gfa/cafe/python/python-3.5/pycafe-1.8.0
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file methodCallbacks.cc
|
||||
/// \file methodCallbacks.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "methodCallbacks.h"
|
||||
#include "connect.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//in methodCallbacks.h
|
||||
//include <config.h>
|
||||
|
||||
@@ -22,7 +24,8 @@
|
||||
* Callback function for when putWithCallback method is invoked
|
||||
* \param args input: event handler_args structure
|
||||
*/
|
||||
void CALLBACK_CAFE::PyHandlerPut( struct event_handler_args args) {
|
||||
void CALLBACK_CAFE::PyHandlerPut( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "CALLBACK_CAFE::PyHandlerPut"
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
@@ -32,8 +35,8 @@ void CALLBACK_CAFE::PyHandlerPut( struct event_handler_args args) {
|
||||
}
|
||||
|
||||
|
||||
// cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
|
||||
// cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
|
||||
unsigned int _handle = (unsigned long) args.usr;
|
||||
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
@@ -41,63 +44,63 @@ void CALLBACK_CAFE::PyHandlerPut( struct event_handler_args args) {
|
||||
|
||||
it_handle = handle_index.find((unsigned int) _handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
|
||||
//Change Channel Policy to NO_WAIT(?)
|
||||
//Change Channel Policy to NO_WAIT(?)
|
||||
|
||||
ChannelRequestStatus channelRequestStatusPut=(*it_handle).getChannelRequestStatusPut();
|
||||
ChannelRequestStatus channelRequestStatusPut=(*it_handle).getChannelRequestStatusPut();
|
||||
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
|
||||
handle_index.modify(it_handle, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
handle_index.modify(it_handle, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
|
||||
//if HAVE_PYTHON_H
|
||||
|
||||
(*it_handle).PyPutHandler();
|
||||
|
||||
//endif
|
||||
|
||||
}
|
||||
else {
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
//if HAVE_PYTHON_H
|
||||
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
ChannelRequestStatus channelRequestStatusPut=(*itcs).getChannelRequestStatusPut();
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
handle_index.modify(itcs, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
//if HAVE_PYTHON_H
|
||||
(*it_handle).PyPutHandler();
|
||||
//endif
|
||||
(*it_handle).PyPutHandler();
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//endif
|
||||
|
||||
if (!internalFlag) {
|
||||
}
|
||||
else {
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
ChannelRequestStatus channelRequestStatusPut=(*itcs).getChannelRequestStatusPut();
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
handle_index.modify(itcs, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
//if HAVE_PYTHON_H
|
||||
(*it_handle).PyPutHandler();
|
||||
//endif
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
if (!internalFlag) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -111,10 +114,11 @@ return;
|
||||
* with a pointer to the retrieved value
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void CALLBACK_CAFE::PyHandlerGet( struct event_handler_args args) {
|
||||
void CALLBACK_CAFE::PyHandlerGet( struct event_handler_args args)
|
||||
{
|
||||
|
||||
#define __METHOD__ "CALLBACK_CAFE::PyHandlerGet"
|
||||
|
||||
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
@@ -122,7 +126,7 @@ void CALLBACK_CAFE::PyHandlerGet( struct event_handler_args args) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int _handle = (unsigned long) args.usr; // ca_puser(args.chid);
|
||||
|
||||
|
||||
@@ -131,64 +135,72 @@ void CALLBACK_CAFE::PyHandlerGet( struct event_handler_args args) {
|
||||
|
||||
it_handle = handle_index.find(_handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGet=(*it_handle).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
ChannelRequestStatus channelRequestStatusGet=(*it_handle).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
//cout << __METHOD__ << " CALLBACK DONE " << (*it_handle).getChannelRequestStatusGet().getCallbackProgressKind() << endl;
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
|
||||
//if HAVE_PYTHON_H
|
||||
(*it_handle).PyGetHandler();
|
||||
//endif
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
//cout << __METHOD__ << " CALLBACK DONE " << (*it_handle).getChannelRequestStatusGet().getCallbackProgressKind() << endl;
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
else {
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through tcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGet=(*itcs).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
handle_index.modify(itcs, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
|
||||
//if HAVE_PYTHON_H
|
||||
(*it_handle).PyGetHandler();
|
||||
//endif
|
||||
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//if HAVE_PYTHON_H
|
||||
(*it_handle).PyGetHandler();
|
||||
//endif
|
||||
|
||||
if (!internalFlag) {
|
||||
}
|
||||
else {
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through tcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGet=(*itcs).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
handle_index.modify(itcs, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
//if HAVE_PYTHON_H
|
||||
(*it_handle).PyGetHandler();
|
||||
//endif
|
||||
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!internalFlag) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
|
||||
};
|
||||
@@ -198,11 +210,94 @@ return;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Callback function for pulseID PV method is invoked
|
||||
* \param args input: event handler_args structure
|
||||
*/
|
||||
void CALLBACK_CAFE::handlerPulseID( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "CALLBACK_CAFE::handlerPulseID"
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int _handle = (unsigned long) args.usr;
|
||||
unsigned long long pulse_id=0;
|
||||
|
||||
|
||||
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
|
||||
cafeConduit_set_by_handle::iterator it_handle;
|
||||
|
||||
|
||||
it_handle = handle_index.find((unsigned int) _handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
//std::cout << (*it_handle).getPV() << " / " << (*it_handle).getHandle() ;
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
|
||||
PVDataHolder pvd;
|
||||
(*it_handle).getPVDataHolder(pvd);
|
||||
pulse_id = pvd.getAsULongLong();
|
||||
//std::cout << " / pulse ID " << pulse_id << std::endl;
|
||||
handle_index.modify(it_handle, change_beamEventNo(pulse_id));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
PVDataHolder pvd;
|
||||
(*it_handle).getPVDataHolder(pvd);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
cafeConduit_set::iterator itcs;
|
||||
|
||||
// Loop through all elements
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
if ((*itcs).getChannelID() != NULL) {
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_beamEventNo(pulse_id));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Callback function for when putWithCallback method is invoked
|
||||
* \param args input: event handler_args structure
|
||||
*/
|
||||
void CALLBACK_CAFE::handlerPut( struct event_handler_args args) {
|
||||
void CALLBACK_CAFE::handlerPut( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "CALLBACK_CAFE::handlerPut"
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
@@ -218,55 +313,55 @@ void CALLBACK_CAFE::handlerPut( struct event_handler_args args) {
|
||||
|
||||
it_handle = handle_index.find((unsigned int) _handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
|
||||
//Change Channel Policy to NO_WAIT(?)
|
||||
//Change Channel Policy to NO_WAIT(?)
|
||||
|
||||
ChannelRequestStatus channelRequestStatusPut=(*it_handle).getChannelRequestStatusPut();
|
||||
ChannelRequestStatus channelRequestStatusPut=(*it_handle).getChannelRequestStatusPut();
|
||||
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
|
||||
handle_index.modify(it_handle, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
handle_index.modify(it_handle, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
}
|
||||
else {
|
||||
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
ChannelRequestStatus channelRequestStatusPut=(*itcs).getChannelRequestStatusPut();
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
handle_index.modify(itcs, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!internalFlag) {
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
if(MUTEX)cafeMutex.lock();
|
||||
ChannelRequestStatus channelRequestStatusPut=(*itcs).getChannelRequestStatusPut();
|
||||
channelRequestStatusPut.setCallbackKind(false, true);
|
||||
handle_index.modify(itcs, change_channelRequestStatusPut(channelRequestStatusPut));
|
||||
if(MUTEX)cafeMutex.unlock();
|
||||
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
if (!internalFlag) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -277,7 +372,8 @@ return;
|
||||
* with a pointer to the retrieved value
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void CALLBACK_CAFE::handlerGet( struct event_handler_args args) {
|
||||
void CALLBACK_CAFE::handlerGet( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "CALLBACK_CAFE::handlerGet"
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
@@ -288,55 +384,62 @@ void CALLBACK_CAFE::handlerGet( struct event_handler_args args) {
|
||||
|
||||
unsigned int _handle = (unsigned long) args.usr; // ca_puser(args.chid);
|
||||
|
||||
|
||||
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()) {
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGet=(*it_handle).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
ChannelRequestStatus channelRequestStatusGet=(*it_handle).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
//cout << __METHOD__ << " CALLBACK DONE " << (*it_handle).getChannelRequestStatusGet().getCallbackProgressKind() << endl;
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
else {
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
//cout << __METHOD__ << " CALLBACK DONE " << (*it_handle).getChannelRequestStatusGet().getCallbackProgressKind() << endl;
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through tcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGet=(*itcs).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
handle_index.modify(itcs, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!internalFlag) {
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through tcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGet=(*itcs).getChannelRequestStatusGet();
|
||||
channelRequestStatusGet.setCallbackKind(false, true);
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
handle_index.modify(itcs, change_channelRequestStatusGet(channelRequestStatusGet));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!internalFlag) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -346,7 +449,8 @@ return;
|
||||
* with a pointer to the retrieved value
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void CALLBACK_CAFE::handlerGetCtrl( struct event_handler_args args) {
|
||||
void CALLBACK_CAFE::handlerGetCtrl( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "CALLBACK_CAFE::handlerGetCtrl "
|
||||
|
||||
|
||||
@@ -364,50 +468,66 @@ void CALLBACK_CAFE::handlerGetCtrl( struct event_handler_args args) {
|
||||
it_handle = handle_index.find(_handle);
|
||||
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
ChannelRequestStatus channelRequestStatusGetCtrl=(*it_handle).getChannelRequestStatusGetCtrl();
|
||||
channelRequestStatusGetCtrl.setCallbackKind(false, true);
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetCtrl(channelRequestStatusGetCtrl));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
ChannelRequestStatus channelRequestStatusGetCtrl=(*it_handle).getChannelRequestStatusGetCtrl();
|
||||
channelRequestStatusGetCtrl.setCallbackKind(false, true);
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetCtrl(channelRequestStatusGetCtrl));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
else {
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
}
|
||||
else {
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
ChannelRequestStatus channelRequestStatusGetCtrl=(*itcs).getChannelRequestStatusGetCtrl();
|
||||
channelRequestStatusGetCtrl.setCallbackKind(false, true);
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_channelRequestStatusGetCtrl(channelRequestStatusGetCtrl));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!internalFlag) {
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
ChannelRequestStatus channelRequestStatusGetCtrl=(*itcs).getChannelRequestStatusGetCtrl();
|
||||
channelRequestStatusGetCtrl.setCallbackKind(false, true);
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_channelRequestStatusGetCtrl(channelRequestStatusGetCtrl));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
if (!internalFlag) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -418,17 +538,18 @@ return;
|
||||
* with a pointer to the retrieved value
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void CALLBACK_CAFE::handlerGetSTSACK( struct event_handler_args args) {
|
||||
void CALLBACK_CAFE::handlerGetSTSACK( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "CALLBACK_CAFE::handlerGetSTSACK "
|
||||
|
||||
|
||||
if (args.status !=ECA_NORMAL) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int _handle = (unsigned long) args.usr; // ca_puser(args.chid);
|
||||
|
||||
@@ -437,52 +558,68 @@ void CALLBACK_CAFE::handlerGetSTSACK( struct event_handler_args args) {
|
||||
|
||||
it_handle = handle_index.find(_handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
ChannelRequestStatus channelRequestStatusGetSTSACK=(*it_handle).getChannelRequestStatusGetSTSACK();
|
||||
|
||||
channelRequestStatusGetSTSACK.setCallbackKind(false, true);
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetSTSACK(channelRequestStatusGetSTSACK));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
else {
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
ChannelRequestStatus channelRequestStatusGetSTSACK=(*it_handle).getChannelRequestStatusGetSTSACK();
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
channelRequestStatusGetSTSACK.setCallbackKind(false, true);
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetSTSACK(channelRequestStatusGetSTSACK));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
}
|
||||
else {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
ChannelRequestStatus channelRequestStatusGetSTSACK=(*itcs).getChannelRequestStatusGetSTSACK();
|
||||
channelRequestStatusGetSTSACK.setCallbackKind(false, true);
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_channelRequestStatusGetSTSACK(channelRequestStatusGetSTSACK));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
if (!internalFlag) {
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through itcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
ChannelRequestStatus channelRequestStatusGetSTSACK=(*itcs).getChannelRequestStatusGetSTSACK();
|
||||
channelRequestStatusGetSTSACK.setCallbackKind(false, true);
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_channelRequestStatusGetSTSACK(channelRequestStatusGetSTSACK));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!internalFlag) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
@@ -493,7 +630,8 @@ return;
|
||||
* with a pointer to the retrieved value
|
||||
* \param args input: event handler arguments
|
||||
*/
|
||||
void CALLBACK_CAFE::handlerGetClassName( struct event_handler_args args) {
|
||||
void CALLBACK_CAFE::handlerGetClassName( struct event_handler_args args)
|
||||
{
|
||||
#define __METHOD__ "CALLBACK_CAFE::handlerGetClassName "
|
||||
|
||||
|
||||
@@ -511,54 +649,70 @@ void CALLBACK_CAFE::handlerGetClassName( struct event_handler_args args) {
|
||||
|
||||
it_handle = handle_index.find(_handle);
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
|
||||
ChannelRequestStatus channelRequestStatusGetClassName=(*it_handle).getChannelRequestStatusGetClassName();
|
||||
|
||||
channelRequestStatusGetClassName.setCallbackKind(false, true);
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetClassName(channelRequestStatusGetClassName));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_eventHandlerArgs (args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
else {
|
||||
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
ChannelRequestStatus channelRequestStatusGetClassName=(*it_handle).getChannelRequestStatusGetClassName();
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through tcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
channelRequestStatusGetClassName.setCallbackKind(false, true);
|
||||
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
ChannelRequestStatus channelRequestStatusGetClassName=(*it_handle).getChannelRequestStatusGetClassName();
|
||||
channelRequestStatusGetClassName.setCallbackKind(false, true);
|
||||
if(MUTEX){cafeMutex.lock();}
|
||||
handle_index.modify(itcs, change_channelRequestStatusGetClassName(channelRequestStatusGetClassName));
|
||||
if(MUTEX){cafeMutex.unlock();}
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(it_handle, change_channelRequestStatusGetClassName(channelRequestStatusGetClassName));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (!internalFlag) {
|
||||
bool internalFlag=false;
|
||||
cafeConduit_set::iterator itcs;
|
||||
// Loop through all elements and search for handle
|
||||
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
|
||||
|
||||
if ( (*itcs).getHandle()==_handle) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
cout << " INFORMATION to author: MATCHed Handle= " << _handle << " to PV= " << (*itcs).getPV() << endl;
|
||||
cout << " by looping through tcs::iterator, since the by_handle::iterator was NOT found! " << endl;
|
||||
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_eventHandlerArgs (args));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
ChannelRequestStatus channelRequestStatusGetClassName=(*it_handle).getChannelRequestStatusGetClassName();
|
||||
channelRequestStatusGetClassName.setCallbackKind(false, true);
|
||||
if(MUTEX) {
|
||||
cafeMutex.lock();
|
||||
}
|
||||
handle_index.modify(itcs, change_channelRequestStatusGetClassName(channelRequestStatusGetClassName));
|
||||
if(MUTEX) {
|
||||
cafeMutex.unlock();
|
||||
}
|
||||
|
||||
internalFlag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
if (!internalFlag) {
|
||||
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
|
||||
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
#undef __METHOD__
|
||||
};
|
||||
|
||||
|
||||
1055
src/policyHelper.cpp
1055
src/policyHelper.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file restorePVGroupXMLParser.cc
|
||||
/// \file restorePVGroupXMLParser.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Release: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -16,7 +16,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
|
||||
vector<string> SplitString(const char *str, char c)
|
||||
using namespace std;
|
||||
|
||||
std::vector<std::string> SplitString(const char *str, char c)
|
||||
{
|
||||
vector<string> result;
|
||||
do {
|
||||
@@ -25,7 +27,8 @@ vector<string> SplitString(const char *str, char c)
|
||||
str++;
|
||||
}
|
||||
result.push_back(string(begin, str));
|
||||
} while (0 != *str++);
|
||||
}
|
||||
while (0 != *str++);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -43,16 +46,20 @@ const QString&restorePVGroupXMLParser::tagRule = "rule";
|
||||
const QString&restorePVGroupXMLParser::tagVal = "val";
|
||||
const QString&restorePVGroupXMLParser::tagSettable = "settable";
|
||||
|
||||
restorePVGroupXMLParser::restorePVGroupXMLParser() { icount=0;
|
||||
restorePVGroupXMLParser::restorePVGroupXMLParser()
|
||||
{
|
||||
icount=0;
|
||||
}
|
||||
|
||||
restorePVGroupXMLParser::~restorePVGroupXMLParser() {
|
||||
restorePVGroupXMLParser::~restorePVGroupXMLParser()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool restorePVGroupXMLParser::startElement(const QString& namespaceURI, const QString& localName,
|
||||
const QString& qName, const QXmlAttributes& atts) {
|
||||
const QString& qName, const QXmlAttributes& atts)
|
||||
{
|
||||
|
||||
|
||||
bool error = false;
|
||||
@@ -60,59 +67,75 @@ bool restorePVGroupXMLParser::startElement(const QString& namespaceURI, const QS
|
||||
if (localName.compare(tagConfig, Qt::CaseInsensitive) == 0) {
|
||||
|
||||
state = WaitingForConfig;
|
||||
} else if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
group = PVGroup();
|
||||
group.setName ( atts.value("id").toAscii().constData() );
|
||||
pvd = new PVDataHolder[500]; //read in npv
|
||||
state = WaitingForGroup;
|
||||
} else if (localName.compare(tagNPV, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagNPV, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForNPV;
|
||||
} else if (localName.compare(tagDescription, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagDescription, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForDescription;
|
||||
} else if (localName.compare(tagStatusGroup, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagStatusGroup, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForStatusGroup;
|
||||
} else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForMember;
|
||||
} else if (localName.compare(tagName, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagName, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForName;
|
||||
} else if (localName.compare(tagNelem, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagNelem, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForNelem;
|
||||
} else if (localName.compare(tagStatus, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagStatus, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForStatus;
|
||||
} else if (localName.compare(tagRule, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagRule, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForRule;
|
||||
} else if (localName.compare(tagVal, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagVal, Qt::CaseInsensitive) == 0) {
|
||||
|
||||
state = WaitingForVal;
|
||||
} else if (localName.compare(tagSettable, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagSettable, Qt::CaseInsensitive) == 0) {
|
||||
state = WaitingForSettable;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
error = true;
|
||||
}
|
||||
return !error;
|
||||
}
|
||||
|
||||
bool restorePVGroupXMLParser::endElement(const QString& namespaceURI,
|
||||
const QString& localName, const QString& qName) {
|
||||
if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
group.setPVData(pvd);
|
||||
group.npv=icount;
|
||||
const QString& localName, const QString& qName)
|
||||
{
|
||||
if (localName.compare(tagGroup, Qt::CaseInsensitive) == 0) {
|
||||
group.setPVData(pvd);
|
||||
group.npv=icount;
|
||||
|
||||
|
||||
} else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
if(settable)++icount;
|
||||
} else if (localName.compare(tagNPV, Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
else if (localName.compare(tagMember, Qt::CaseInsensitive) == 0) {
|
||||
if(settable)++icount;
|
||||
}
|
||||
else if (localName.compare(tagNPV, Qt::CaseInsensitive) == 0) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool restorePVGroupXMLParser::characters(const QString& ch) {
|
||||
bool restorePVGroupXMLParser::characters(const QString& ch)
|
||||
{
|
||||
|
||||
bool error = false;
|
||||
|
||||
@@ -120,66 +143,69 @@ bool restorePVGroupXMLParser::characters(const QString& ch) {
|
||||
|
||||
|
||||
switch (state) {
|
||||
case WaitingForDescription:
|
||||
case WaitingForDescription:
|
||||
|
||||
case WaitingForGroup:
|
||||
case WaitingForConfig:
|
||||
case WaitingForStatusGroup:
|
||||
case WaitingForGroup:
|
||||
case WaitingForConfig:
|
||||
case WaitingForStatusGroup:
|
||||
|
||||
case WaitingForMember:
|
||||
case WaitingForMember:
|
||||
|
||||
break;
|
||||
case WaitingForNPV:
|
||||
break;
|
||||
case WaitingForNPV:
|
||||
|
||||
break;
|
||||
case WaitingForName:
|
||||
break;
|
||||
case WaitingForName:
|
||||
|
||||
strcpy(pvd[icount].pv,data.c_str());
|
||||
break;
|
||||
case WaitingForNelem:
|
||||
pvd[icount].setNelem ( strtol(data.c_str(), NULL, 10) );
|
||||
break;
|
||||
case WaitingForStatus:
|
||||
strcpy(pvd[icount].pv,data.c_str());
|
||||
break;
|
||||
case WaitingForNelem:
|
||||
pvd[icount].setNelem ( strtol(data.c_str(), NULL, 10) );
|
||||
break;
|
||||
case WaitingForStatus:
|
||||
|
||||
break;
|
||||
case WaitingForRule:
|
||||
break;
|
||||
case WaitingForRule:
|
||||
|
||||
break;
|
||||
case WaitingForVal:
|
||||
break;
|
||||
case WaitingForVal:
|
||||
|
||||
//if elements > 1, then break up string
|
||||
//read no of elements and break up with space as deliminater!
|
||||
if ( pvd[icount].getNelem() >1) {
|
||||
//parse string
|
||||
//if elements > 1, then break up string
|
||||
//read no of elements and break up with space as deliminater!
|
||||
if ( pvd[icount].getNelem() >1) {
|
||||
//parse string
|
||||
|
||||
vector<string> v; v.clear(); v.reserve(pvd[icount].getNelem());
|
||||
v = SplitString(data.c_str(), ' ');
|
||||
dbr_string_t * arr = new dbr_string_t[ pvd[icount].getNelem()];
|
||||
vector<string> v;
|
||||
v.clear();
|
||||
v.reserve(pvd[icount].getNelem());
|
||||
v = SplitString(data.c_str(), ' ');
|
||||
dbr_string_t * arr = new dbr_string_t[ pvd[icount].getNelem()];
|
||||
|
||||
for (size_t i=0; i<v.size(); ++i) {
|
||||
strcpy(arr[i], v[i].c_str());
|
||||
}
|
||||
|
||||
pvd[icount].set(arr);
|
||||
}
|
||||
else {
|
||||
pvd[icount].set(data);
|
||||
}
|
||||
break;
|
||||
case WaitingForSettable:
|
||||
if ( strcmp(data.c_str(),"true")==0) {
|
||||
settable = true;
|
||||
} else {
|
||||
settable=false;
|
||||
for (size_t i=0; i<v.size(); ++i) {
|
||||
strcpy(arr[i], v[i].c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error = true;
|
||||
printf("Unexpected: '%s'\n", data.c_str());
|
||||
break;
|
||||
}
|
||||
return !error;
|
||||
pvd[icount].set(arr);
|
||||
}
|
||||
else {
|
||||
pvd[icount].set(data);
|
||||
}
|
||||
break;
|
||||
case WaitingForSettable:
|
||||
if ( strcmp(data.c_str(),"true")==0) {
|
||||
settable = true;
|
||||
}
|
||||
else {
|
||||
settable=false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error = true;
|
||||
printf("Unexpected: '%s'\n", data.c_str());
|
||||
break;
|
||||
}
|
||||
return !error;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// \file transpose.cc
|
||||
/// \file transpose.cpp
|
||||
/// \author Jan Chrin, PSI
|
||||
/// \date Relase: February 2015
|
||||
/// \version CAFE 1.0.0
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "transpose.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* \brief Converts data from CTYPE to native type
|
||||
* in preparation for transmission to CA Server
|
||||
@@ -18,7 +20,7 @@
|
||||
* \return ICAFE_NORMAL as local data conversion should not incur an error
|
||||
*/
|
||||
int Transpose<dbr_string_t>::putString
|
||||
(const unsigned int _handle, dbr_string_t * val)
|
||||
(const unsigned int _handle, dbr_string_t * val)
|
||||
{
|
||||
#define __METHOD__ "Transpose<CTYPE>::putString"
|
||||
|
||||
@@ -33,9 +35,11 @@ int Transpose<dbr_string_t>::putString
|
||||
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaPrimitive().getDbrDataType();
|
||||
|
||||
dbr_ctrl_enum * dataEnum;
|
||||
dbr_ctrl_enum * dataEnum;
|
||||
dbr_short_t noStrings =0;
|
||||
|
||||
HandleHelper helper;
|
||||
|
||||
bool allStringsAreValid=true;
|
||||
// Client is String
|
||||
// Native type is one of the following
|
||||
@@ -45,8 +49,6 @@ int Transpose<dbr_string_t>::putString
|
||||
switch(dbrTypeRequest_DataBuffer) {
|
||||
|
||||
case DBR_STRING://0
|
||||
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
strcpy( *((dbr_string_t *) (PVDataL) +i), val[i]);
|
||||
}
|
||||
@@ -65,7 +67,7 @@ int Transpose<dbr_string_t>::putString
|
||||
else {
|
||||
cout << __FILE__<< "//" << __METHOD__ << "//" << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_SHORT CONVERSION for ELEMENT " << i
|
||||
<< " of " << nelem << " !! " << endl;
|
||||
<< " of " << nelem << " !! " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << val[i];
|
||||
cout << " TO SHORT; PUT REQUEST NOT MADE!" << endl;
|
||||
@@ -106,40 +108,49 @@ int Transpose<dbr_string_t>::putString
|
||||
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
|
||||
|
||||
|
||||
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
dbr_string_t a;
|
||||
|
||||
//sprintf(a, "%s", val[i]);
|
||||
//Remove leading and blank spaces
|
||||
dbr_string_t valTrimmed; //Previously referred to as varaible a;
|
||||
helper.removeLeadingAndTrailingSpaces((const char*) val[i], valTrimmed);
|
||||
|
||||
char *b = (char *) val[i];
|
||||
char *c;
|
||||
// Remove leading blanks
|
||||
c = b;
|
||||
while (c != '\0' && *c == ' ') {
|
||||
c++;
|
||||
}
|
||||
b = c;
|
||||
/*
|
||||
dbr_string_t a;
|
||||
|
||||
// Remove trailing blanks
|
||||
c = b + strlen (b) - 1;
|
||||
while (c >= b)
|
||||
{
|
||||
if (*c == ' ') {
|
||||
*c = '\0';
|
||||
// This was reported at www.programmingforums.org/thread35790.html to cause a bus error!?
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
c--;
|
||||
}
|
||||
//sprintf(a, "%s", val[i]);
|
||||
|
||||
sprintf(a, "%s", b);
|
||||
char *b = (char *) val[i];
|
||||
char *c;
|
||||
// Remove leading blanks
|
||||
c = b;
|
||||
while (c != '\0' && *c == ' ') {
|
||||
c++;
|
||||
}
|
||||
b = c;
|
||||
|
||||
// Remove trailing blanks
|
||||
c = b + strlen (b) - 1;
|
||||
while (c >= b)
|
||||
{
|
||||
if (*c == ' ') {
|
||||
*c = '\0';
|
||||
// This was reported at www.programmingforums.org/thread35790.html to cause a bus error!?
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
c--;
|
||||
}
|
||||
|
||||
sprintf(a, "%s", b);
|
||||
*/
|
||||
|
||||
bool isValidString=false;
|
||||
for (int j=0; j<noStrings; ++j) {
|
||||
|
||||
if (strcmp((char *)a, stig[j] ) ==0) {
|
||||
if (strcmp((char *)valTrimmed, stig[j] ) ==0) {
|
||||
|
||||
dbr_enum_t us= (unsigned short) j;
|
||||
*((dbr_enum_t *) (PVDataL) + i ) = us;
|
||||
@@ -157,7 +168,7 @@ int Transpose<dbr_string_t>::putString
|
||||
|
||||
dbr_enum_t us=0;
|
||||
ss.clear();
|
||||
ss.str(a);
|
||||
ss.str(valTrimmed);
|
||||
ss>>us;
|
||||
|
||||
// Is this a valid number?
|
||||
@@ -173,7 +184,7 @@ int Transpose<dbr_string_t>::putString
|
||||
cout << __FILE__ << "//" << __METHOD__ << "//" << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_ENUM MATCHING for ELEMENT " << i << " of " << nelem << " !! " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: '";
|
||||
cout << a; //val[i];
|
||||
cout << valTrimmed; //val[i];
|
||||
cout << "' TO A VALID ENUM INDEX; PUT REQUEST NOT MADE!" << endl; //AT THE MERCY OF THE CA SERVER!" << endl;
|
||||
cout << "VALID ENUM OPTIONS ARE: " << endl;
|
||||
|
||||
@@ -197,30 +208,30 @@ int Transpose<dbr_string_t>::putString
|
||||
ss.clear();
|
||||
ss.str(val[i]);
|
||||
ss>>ch;
|
||||
char *b = (char *) val[i];
|
||||
|
||||
char *b = (char *) val[i];
|
||||
|
||||
//cout << b << " " << *b << endl;
|
||||
//cout << (unsigned short *) b << " " << (unsigned short *) *b << endl;
|
||||
|
||||
//cout << b << " " << *b << endl;
|
||||
//cout << (unsigned short *) b << " " << (unsigned short *) *b << endl;
|
||||
|
||||
|
||||
if ( !ss.fail()) {
|
||||
*((dbr_char_t *) (PVDataL) + i ) = ch;
|
||||
}
|
||||
|
||||
else if (b != '\0') {
|
||||
|
||||
*((dbr_char_t *) (PVDataL) + i ) = *b;
|
||||
|
||||
}
|
||||
|
||||
else if (*b != '\0') {
|
||||
|
||||
*((dbr_char_t *) (PVDataL) + i ) = *b;
|
||||
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "//" << __METHOD__ << "//" << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_CHAR CONVERSION for ELEMENT index " << i << " in array of length " << nelem;
|
||||
cout << ", i.e., with index range [0-" << (nelem-1) << "] " << " !! " << endl;
|
||||
cout << ", i.e., with index range [0-" << (nelem-1) << "] " << " !! " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << val[i];
|
||||
cout << " TO UNSIGNED CHAR; PUT REQUEST NOT MADE!" << endl; //AT THE MERCY OF THE CA SERVER!" << endl; //NOT MADE!" << endl;
|
||||
allStringsAreValid=false;
|
||||
allStringsAreValid=false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -267,14 +278,18 @@ int Transpose<dbr_string_t>::putString
|
||||
allStringsAreValid=false;
|
||||
|
||||
// *((dbr_double_t *) (PVDataL) + i ) = (dbr_double_t) strtod(val[i],NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}//for
|
||||
break;
|
||||
} //switch
|
||||
|
||||
if(!allStringsAreValid) {return ECAFE_NO_CONVERT;}
|
||||
else {return ICAFE_NORMAL;}
|
||||
if(!allStringsAreValid) {
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
else {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -311,7 +326,8 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaPrimitive().getDbrDataType();
|
||||
|
||||
|
||||
dbr_ctrl_enum * dataEnum;
|
||||
HandleHelper helper;
|
||||
dbr_ctrl_enum * dataEnum;
|
||||
dbr_short_t noStrings =0;
|
||||
|
||||
bool allStringsAreValid=true;
|
||||
@@ -342,7 +358,7 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
else {
|
||||
cout << __FILE__ << "//" << __METHOD__ << "//" << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_SHORT CONVERSION for ELEMENT " << i
|
||||
<< " of " << nelem << " !! " << endl;
|
||||
<< " of " << nelem << " !! " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << val[i].str;
|
||||
cout << " TO SHORT; PUT REQUEST NOT MADE!" << endl;
|
||||
@@ -384,8 +400,12 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
dbr_string_t a;
|
||||
//dbr_string_t a;
|
||||
|
||||
dbr_string_t valTrimmed; //Previously referred to as varaible a;
|
||||
helper.removeLeadingAndTrailingSpaces((const char*) val[i].str, valTrimmed);
|
||||
|
||||
/*
|
||||
//sprintf(a, "%s", val[i]);
|
||||
|
||||
char *b = (char *) val[i].str;
|
||||
@@ -412,11 +432,11 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
}
|
||||
|
||||
sprintf(a, "%s", b);
|
||||
|
||||
*/
|
||||
bool isValidString=false;
|
||||
for (int j=0; j<noStrings; ++j) {
|
||||
|
||||
if (strcmp((char *)a, stig[j] ) ==0) {
|
||||
if (strcmp((char *)valTrimmed, stig[j] ) ==0) { // previously a
|
||||
|
||||
dbr_enum_t us= (unsigned short) j;
|
||||
*((dbr_enum_t *) (PVDataL) + i ) = us;
|
||||
@@ -434,7 +454,7 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
|
||||
dbr_enum_t us=0;
|
||||
ss.clear();
|
||||
ss.str(a);
|
||||
ss.str(valTrimmed); //
|
||||
ss>>us;
|
||||
|
||||
// Is this a valid number?
|
||||
@@ -450,7 +470,7 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
cout << __FILE__ << "//" << __METHOD__ << "//" << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_ENUM MATCHING for ELEMENT " << i << " of " << nelem << " !! " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: '";
|
||||
cout << a; //val[i];
|
||||
cout << valTrimmed; //val[i];
|
||||
cout << "' TO UNSIGNED SHORT; PUT REQUEST NOT MADE!" << endl; //AT THE MERCY OF THE CA SERVER!" << endl;
|
||||
cout << "VALID ENUM OPTIONS ARE: " << endl;
|
||||
|
||||
@@ -475,22 +495,22 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
ss.str(val[i].str);
|
||||
ss>>ch;
|
||||
|
||||
char *b = (char *) val[i].str;
|
||||
|
||||
char *b = (char *) val[i].str;
|
||||
|
||||
if ( !ss.fail()) {
|
||||
*((dbr_char_t *) (PVDataL) + i ) = ch;
|
||||
}
|
||||
else if (b != '\0') {
|
||||
*((dbr_char_t *) (PVDataL) + i ) = *b;
|
||||
}
|
||||
}
|
||||
else if (*b != '\0') {
|
||||
*((dbr_char_t *) (PVDataL) + i ) = *b;
|
||||
}
|
||||
else {
|
||||
cout << __FILE__ << "//" << __METHOD__ << "//" << __LINE__ << endl;
|
||||
cout << "***WARNING*** NO STRING TO DBR_CHAR CONVERSION for ELEMENT index " << i << " in array of length " << nelem;
|
||||
cout << ", i.e., with index range [0-" << (nelem-1) << "] " << " !! " << endl;
|
||||
cout << ", i.e., with index range [0-" << (nelem-1) << "] " << " !! " << endl;
|
||||
cout << "***WARNING*** COULD NOT CONVERT: ";
|
||||
cout << val[i].str;
|
||||
cout << " TO UNSIGNED CHAR; PUT REQUEST NOT MADE!" << endl; //AT THE MERCY OF THE CA SERVER!" << endl; //NOT MADE!" << endl;
|
||||
allStringsAreValid=false;
|
||||
allStringsAreValid=false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -538,14 +558,18 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
allStringsAreValid=false;
|
||||
|
||||
// *((dbr_double_t *) (PVDataL) + i ) = (dbr_double_t) strtod(val[i],NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}//for
|
||||
break;
|
||||
} //switch
|
||||
|
||||
if(!allStringsAreValid) {return ECAFE_NO_CONVERT;}
|
||||
else {return ICAFE_NORMAL;}
|
||||
if(!allStringsAreValid) {
|
||||
return ECAFE_NO_CONVERT;
|
||||
}
|
||||
else {
|
||||
return ICAFE_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -570,10 +594,10 @@ int Transpose<dbr_string_t>::putString(const unsigned int _handle, CAFE_DATATY
|
||||
* \return ICAFE_NORMAL as local data conversion should not incur an error
|
||||
*/
|
||||
int Transpose<dbr_string_t>::get(
|
||||
const unsigned int _handle,
|
||||
dbr_string_t * val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts,
|
||||
bool isCacheRequest)
|
||||
const unsigned int _handle,
|
||||
dbr_string_t * val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts,
|
||||
bool isCacheRequest)
|
||||
{
|
||||
#define __METHOD__ "Transpose<dbr_string_t>::get()"
|
||||
|
||||
@@ -586,56 +610,55 @@ int Transpose<dbr_string_t>::get(
|
||||
|
||||
PVDataL = (*it_handle).getDataBuffer ();
|
||||
offset = (*it_handle).getChannelRequestMetaDataClient().getOffset();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isCacheRequest) {
|
||||
offset = (*it_handle).getChannelRequestMetaData().getOffset( );
|
||||
offset = (*it_handle).getChannelRequestMetaData().getOffset( );
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelemCache(); //-(*it_handle).getChannelRequestMetaData().getOffset(); //-offset;
|
||||
//nelem = min(nelem, (*it_handle).getChannelRequestMetaData().getNelem()-offset);
|
||||
//nelem = min(nelem, (*it_handle).getChannelRequestMetaData().getNelem()-offset);
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelem()-offset;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Something wrong, just read last element
|
||||
if (nelem <=0) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Something funny with the offset; just read last element! " << endl;
|
||||
cout << "Changing offset from=" << offset;
|
||||
//Something wrong, just read last element
|
||||
if (nelem <=0) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Something funny with the offset; just read last element! " << endl;
|
||||
cout << "Changing offset from=" << offset;
|
||||
|
||||
offset = (*it_handle).getChannelRequestMetaData().getNelem()-1;
|
||||
if(isCacheRequest) {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelemCache(); //-(*it_handle).getChannelRequestMetaData().getOffset(); //-offset;
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelem()-offset;
|
||||
offset = (*it_handle).getChannelRequestMetaData().getNelem()-1;
|
||||
if(isCacheRequest) {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelemCache(); //-(*it_handle).getChannelRequestMetaData().getOffset(); //-offset;
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelem()-offset;
|
||||
}
|
||||
|
||||
cout << " to=" << offset << endl;
|
||||
}
|
||||
|
||||
cout << " to=" << offset << endl;
|
||||
}
|
||||
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaData().getDbrDataType();
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaData().getDbrDataType();
|
||||
|
||||
|
||||
dbr_ctrl_enum * dataEnum;
|
||||
dbr_short_t noStrings =0;
|
||||
dbr_ctrl_enum * dataEnum;
|
||||
dbr_short_t noStrings =0;
|
||||
|
||||
ts.secPastEpoch=0;
|
||||
ts.nsec =0;
|
||||
alarmStatus =0;
|
||||
alarmSeverity =0;
|
||||
/// stringstream ssss;//create a stringstream
|
||||
ts.secPastEpoch=0;
|
||||
ts.nsec =0;
|
||||
alarmStatus =0;
|
||||
alarmSeverity =0;
|
||||
/// stringstream ssss;//create a stringstream
|
||||
|
||||
//dbrTypeRequest_DataBuffer is the chtype used in ca_get
|
||||
//Only ever fille the Union with the native type as
|
||||
//dbrTypeRequest_DataBuffer is the chtype used in ca_get
|
||||
//Only ever fille the Union with the native type as
|
||||
|
||||
|
||||
switch (dbrTypeRequest_DataBuffer)
|
||||
{
|
||||
|
||||
switch (dbrTypeRequest_DataBuffer) {
|
||||
case DBR_CHAR:
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
sprintf(val[i], "%u", (*(&((PVDataL)->charval)+i+offset)));
|
||||
@@ -650,7 +673,7 @@ int Transpose<dbr_string_t>::get(
|
||||
|
||||
case DBR_DOUBLE:
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
sprintf(val[i], "%.15f",(*(&((PVDataL)->doubleval)+i+offset)));
|
||||
sprintf(val[i], "%.15f",(*(&((PVDataL)->doubleval)+i+offset)));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -675,47 +698,47 @@ int Transpose<dbr_string_t>::get(
|
||||
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
if (noStrings==noEmptyStrings) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
|
||||
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
|
||||
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
if (noStrings==noEmptyStrings) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
|
||||
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
|
||||
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
|
||||
}
|
||||
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
|
||||
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
|
||||
}
|
||||
else {
|
||||
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
|
||||
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
|
||||
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
|
||||
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
|
||||
}
|
||||
else {
|
||||
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
|
||||
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
|
||||
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if native DataType is ENUM then overwrite call Enum method and then convert to string!
|
||||
//for (unsigned int i=0; i<nelem; ++i) {
|
||||
// sprintf(val[i], "%s", stig[(*(&((PVDataL)->enmval)+i+offset))] );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -770,43 +793,43 @@ int Transpose<dbr_string_t>::get(
|
||||
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
|
||||
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
|
||||
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig)) ;
|
||||
|
||||
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
if (noStrings==noEmptyStrings) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
|
||||
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
|
||||
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
if (noStrings==noEmptyStrings) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
|
||||
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
|
||||
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
|
||||
}
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
|
||||
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
|
||||
}
|
||||
else {
|
||||
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
|
||||
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
|
||||
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
|
||||
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
|
||||
}
|
||||
else {
|
||||
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
|
||||
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
|
||||
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if native DataType is ENUM then overwrite call Enum method and then convert to string!
|
||||
//for (unsigned int i=0; i<nelem; ++i) {
|
||||
@@ -882,45 +905,45 @@ int Transpose<dbr_string_t>::get(
|
||||
dataEnum = (dbr_ctrl_enum *) (*it_handle).getCtrlBuffer();
|
||||
|
||||
noStrings = ((struct dbr_ctrl_enum *) dataEnum)->no_str;
|
||||
|
||||
|
||||
memcpy( stig, &(((struct dbr_ctrl_enum *) dataEnum)->strs), sizeof(stig )) ;
|
||||
|
||||
|
||||
//if native DataType is ENUM then overwrite call Enum method and then convert to string!
|
||||
//Check data type
|
||||
//cout << "Classname " << (*it_handle).getChannelRegalia().getClassName() << endl;
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
if (noStrings==noEmptyStrings) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
|
||||
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
|
||||
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
|
||||
}
|
||||
|
||||
//Check data type
|
||||
//cout << "Classname " << (*it_handle).getChannelRegalia().getClassName() << endl;
|
||||
|
||||
unsigned int noEmptyStrings=0;
|
||||
//Check for empty strings:
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
if (strcmp(stig[j],"")==0) {
|
||||
++noEmptyStrings;
|
||||
}
|
||||
}
|
||||
if (noStrings==noEmptyStrings) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
|
||||
cout << "BADLY CONFIGURED EPICS " << (*it_handle).getChannelRegalia().getClassName() << " RECORD. " << endl;
|
||||
cout << "CHANNEL: " << (*it_handle).getPV() << " (handle=" << (*it_handle).getHandle() <<") " << endl;
|
||||
}
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
|
||||
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
|
||||
}
|
||||
else {
|
||||
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
|
||||
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
|
||||
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) < noStrings) && (noStrings!=noEmptyStrings)) {
|
||||
sprintf(val[i], "%s", stig[(*(&((PVDataL)->tenmval.value)+i+offset))] );
|
||||
}
|
||||
else {
|
||||
sprintf(val[i], "%d", (*(&((PVDataL)->tenmval.value)+i+offset)) );
|
||||
if ( ((*(&((PVDataL)->tenmval.value)+i+offset)) >= noStrings) ) {
|
||||
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
|
||||
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
|
||||
cout << "VALUE (unsigned short) = " << (*(&((PVDataL)->tenmval.value)+i+offset)) << endl;
|
||||
cout << "NO OF ENUMERATED STRINGS = " << noStrings << " WITH VALUES: " << endl;
|
||||
for (unsigned int j=0; j<noStrings; ++j) {
|
||||
cout << stig[j] << " [" <<j << "] ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ts = ((struct dbr_time_enum *) PVDataL)->stamp;
|
||||
alarmStatus = ((struct dbr_time_enum *) PVDataL)->status;
|
||||
@@ -937,15 +960,15 @@ int Transpose<dbr_string_t>::get(
|
||||
break;
|
||||
}
|
||||
|
||||
//helper function to set TimeStamps!
|
||||
//cout <<__METHOD__ << endl;
|
||||
//cout << "_dbrType" << _dbrTypeRequest_DataBuffer<< endl;
|
||||
//cout << ts.secPastEpoch << " " << ts.nsec << endl;
|
||||
//helper function to set TimeStamps!
|
||||
//cout <<__METHOD__ << endl;
|
||||
//cout << "_dbrType" << _dbrTypeRequest_DataBuffer<< endl;
|
||||
//cout << ts.secPastEpoch << " " << ts.nsec << endl;
|
||||
|
||||
if(!isCacheRequest) {
|
||||
HandleHelper handleHelper;
|
||||
handleHelper.setSTS(_handle, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
if(!isCacheRequest) {
|
||||
HandleHelper handleHelper;
|
||||
handleHelper.setSTS(_handle, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -970,9 +993,10 @@ int Transpose<dbr_string_t>::get(
|
||||
* \return ICAFE_NORMAL
|
||||
*/
|
||||
int Transpose<dbr_string_t>::getCtrl(
|
||||
const unsigned int _handle, dbr_string_t * val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity,
|
||||
bool isCacheRequest){
|
||||
const unsigned int _handle, dbr_string_t * val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity,
|
||||
bool isCacheRequest)
|
||||
{
|
||||
#define __METHOD__ "Transpose<dbr_string_t>::getCtrl"
|
||||
|
||||
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
|
||||
@@ -982,56 +1006,56 @@ int Transpose<dbr_string_t>::getCtrl(
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
PVDataL = (*it_handle).getCtrlBuffer ();
|
||||
PVDataL = (*it_handle).getCtrlBuffer ();
|
||||
|
||||
offset = (*it_handle).getChannelRequestMetaCtrlClient().getOffset();
|
||||
|
||||
if (isCacheRequest) {
|
||||
offset = (*it_handle).getChannelRequestMetaCtrl().getOffset( );
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelemCache(); //-(*it_handle).getChannelRequestMetaCtrl().getOffset(); //-offset;
|
||||
//nelem = min(nelem, (*it_handle).getChannelRequestMetaCtrl().getNelem()-offset);
|
||||
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelem()-offset;
|
||||
}
|
||||
//Something wrong, just read last element
|
||||
if (nelem <=0) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Something funny with the offset; just read last element! " << endl;
|
||||
cout << "Changing offset from=" << offset;
|
||||
offset = (*it_handle).getChannelRequestMetaCtrlClient().getOffset();
|
||||
|
||||
if (isCacheRequest) {
|
||||
offset = (*it_handle).getChannelRequestMetaCtrl().getOffset( );
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelemCache(); //-(*it_handle).getChannelRequestMetaCtrl().getOffset(); //-offset;
|
||||
//nelem = min(nelem, (*it_handle).getChannelRequestMetaCtrl().getNelem()-offset);
|
||||
|
||||
offset = (*it_handle).getChannelRequestMetaCtrl().getNelem()-1;
|
||||
if(isCacheRequest) {
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelemCache(); //-(*it_handle).getChannelRequestMetaCtrl().getOffset(); //-offset;
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelem()-offset;
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelem()-offset;
|
||||
}
|
||||
cout << " to=" << offset << endl;
|
||||
}
|
||||
//Something wrong, just read last element
|
||||
if (nelem <=0) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Something funny with the offset; just read last element! " << endl;
|
||||
cout << "Changing offset from=" << offset;
|
||||
|
||||
dbrTypeRequest_CtrlBuffer = (*it_handle).getChannelRequestMetaCtrl().getDbrDataType();
|
||||
offset = (*it_handle).getChannelRequestMetaCtrl().getNelem()-1;
|
||||
if(isCacheRequest) {
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelemCache(); //-(*it_handle).getChannelRequestMetaCtrl().getOffset(); //-offset;
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaCtrl().getNelem()-offset;
|
||||
}
|
||||
cout << " to=" << offset << endl;
|
||||
}
|
||||
|
||||
dbrTypeRequest_CtrlBuffer = (*it_handle).getChannelRequestMetaCtrl().getDbrDataType();
|
||||
|
||||
|
||||
//cout << __METHOD__ << endl;
|
||||
//cout << " dbrTypeRequest_CtrlBuffer " << dbrTypeRequest_CtrlBuffer << endl;
|
||||
|
||||
//cout << __METHOD__ << endl;
|
||||
//cout << " dbrTypeRequest_CtrlBuffer " << dbrTypeRequest_CtrlBuffer << endl;
|
||||
|
||||
|
||||
alarmStatus = -1;
|
||||
alarmSeverity = -1;
|
||||
|
||||
switch (dbrTypeRequest_CtrlBuffer) {
|
||||
case DBR_CTRL_STRING:
|
||||
memcpy(val, &(&((PVDataL)->cstrval.value))[offset], sizeof(dbr_string_t)*nelem);
|
||||
alarmStatus = ((struct dbr_sts_string *) PVDataL)->status;
|
||||
alarmSeverity = ((struct dbr_sts_string *) PVDataL)->severity;
|
||||
break;
|
||||
alarmStatus = -1;
|
||||
alarmSeverity = -1;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (dbrTypeRequest_CtrlBuffer) {
|
||||
case DBR_CTRL_STRING:
|
||||
memcpy(val, &(&((PVDataL)->cstrval.value))[offset], sizeof(dbr_string_t)*nelem);
|
||||
alarmStatus = ((struct dbr_sts_string *) PVDataL)->status;
|
||||
alarmSeverity = ((struct dbr_sts_string *) PVDataL)->severity;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -1060,8 +1084,8 @@ int Transpose<dbr_string_t>::getCtrl(
|
||||
* \return ICAFE_NORMAL as local data conversion should not incur an error
|
||||
*/
|
||||
int Transpose<CAFE_DATATYPE_UNION>::get(//const CAFEConduit &cc,
|
||||
const unsigned int _handle, CAFE_DATATYPE_UNION_SEQ val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts, bool isCacheRequest)
|
||||
const unsigned int _handle, CAFE_DATATYPE_UNION_SEQ val,
|
||||
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts, bool isCacheRequest)
|
||||
{
|
||||
#define __METHOD__ "Transpose<CAFE_DATATYPE_UNION_SEQ>::get()"
|
||||
|
||||
@@ -1072,52 +1096,52 @@ int Transpose<CAFE_DATATYPE_UNION>::get(//const CAFEConduit &cc,
|
||||
|
||||
if (it_handle != handle_index.end()) {
|
||||
|
||||
PVDataL = (*it_handle).getDataBuffer ();
|
||||
PVDataL = (*it_handle).getDataBuffer ();
|
||||
|
||||
offset = (*it_handle).getChannelRequestMetaDataClient().getOffset();
|
||||
|
||||
offset = (*it_handle).getChannelRequestMetaDataClient().getOffset();
|
||||
|
||||
|
||||
|
||||
if(isCacheRequest) {
|
||||
offset = (*it_handle).getChannelRequestMetaData().getOffset( );
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelemCache(); //-offset;
|
||||
//nelem = min(nelem, (*it_handle).getChannelRequestMetaData().getNelem()-offset);
|
||||
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelem()-offset;
|
||||
}
|
||||
|
||||
|
||||
//Something wrong, just read last element
|
||||
if (nelem <=0) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Something funny with the offset; just read last element! " << endl;
|
||||
cout << "Changing offset from=" << offset;
|
||||
//offset = cc.getNelemRequest()-1;
|
||||
//nelem = cc.getNelemRequest()-offset;
|
||||
offset = (*it_handle).getChannelRequestMetaData().getNelem()-1;
|
||||
if(isCacheRequest) {
|
||||
offset = (*it_handle).getChannelRequestMetaData().getOffset( );
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelemCache(); //-offset;
|
||||
//nelem = min(nelem, (*it_handle).getChannelRequestMetaData().getNelem()-offset);
|
||||
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelem()-offset;
|
||||
}
|
||||
cout << " to=" << offset << endl;
|
||||
}
|
||||
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaData().getDbrDataType();
|
||||
|
||||
ts.secPastEpoch=0;
|
||||
ts.nsec =0;
|
||||
alarmStatus =-1;
|
||||
alarmSeverity =-1;
|
||||
//Something wrong, just read last element
|
||||
if (nelem <=0) {
|
||||
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
|
||||
cout << "Something funny with the offset; just read last element! " << endl;
|
||||
cout << "Changing offset from=" << offset;
|
||||
//offset = cc.getNelemRequest()-1;
|
||||
//nelem = cc.getNelemRequest()-offset;
|
||||
offset = (*it_handle).getChannelRequestMetaData().getNelem()-1;
|
||||
if(isCacheRequest) {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelemCache(); //-offset;
|
||||
}
|
||||
else {
|
||||
nelem = (*it_handle).getChannelRequestMetaData().getNelem()-offset;
|
||||
}
|
||||
cout << " to=" << offset << endl;
|
||||
}
|
||||
|
||||
//dbrTypeRequest_DataBuffer is the chtype used in ca_get
|
||||
//Only ever fille the Union with the native type as
|
||||
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaData().getDbrDataType();
|
||||
|
||||
switch (dbrTypeRequest_DataBuffer)
|
||||
{
|
||||
ts.secPastEpoch=0;
|
||||
ts.nsec =0;
|
||||
alarmStatus =-1;
|
||||
alarmSeverity =-1;
|
||||
|
||||
|
||||
//dbrTypeRequest_DataBuffer is the chtype used in ca_get
|
||||
//Only ever fille the Union with the native type as
|
||||
|
||||
switch (dbrTypeRequest_DataBuffer) {
|
||||
case DBR_CHAR:
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
val[i].ch = (*(&((PVDataL)->charval)+i+offset));
|
||||
@@ -1212,7 +1236,7 @@ int Transpose<CAFE_DATATYPE_UNION>::get(//const CAFEConduit &cc,
|
||||
|
||||
case DBR_STS_STRING:
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
strcpy(val[i].str , (*(&((PVDataL)->sstrval.value)+i+offset))) ;
|
||||
strcpy(val[i].str, (*(&((PVDataL)->sstrval.value)+i+offset))) ;
|
||||
}
|
||||
alarmStatus = ((struct dbr_sts_string *) PVDataL)->status;
|
||||
alarmSeverity = ((struct dbr_sts_string *) PVDataL)->severity;
|
||||
@@ -1238,8 +1262,10 @@ int Transpose<CAFE_DATATYPE_UNION>::get(//const CAFEConduit &cc,
|
||||
break;
|
||||
|
||||
case DBR_TIME_DOUBLE:
|
||||
|
||||
for (unsigned int i=0; i<nelem; ++i) {
|
||||
val[i].d = (*(&((PVDataL)->tdblval.value)+i+offset)) ;
|
||||
|
||||
}
|
||||
ts = ((struct dbr_time_double *) PVDataL)->stamp;
|
||||
alarmStatus = ((struct dbr_time_double *) PVDataL)->status;
|
||||
@@ -1283,15 +1309,15 @@ int Transpose<CAFE_DATATYPE_UNION>::get(//const CAFEConduit &cc,
|
||||
break;
|
||||
}
|
||||
}
|
||||
//helper function to set TimeStamps!
|
||||
//cout <<__METHOD__ << endl;
|
||||
//cout << "_dbrType" << _dbrTypeRequest_DataBuffer<< endl;
|
||||
//cout << ts.secPastEpoch << " " << ts.nsec << endl;
|
||||
//helper function to set TimeStamps!
|
||||
//cout <<__METHOD__ << endl;
|
||||
//cout << "_dbrType" << _dbrTypeRequest_DataBuffer<< endl;
|
||||
//cout << ts.secPastEpoch << " " << ts.nsec << endl;
|
||||
|
||||
if(!isCacheRequest) {
|
||||
HandleHelper handleHelper;
|
||||
handleHelper.setSTS(_handle, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
if(!isCacheRequest) {
|
||||
HandleHelper handleHelper;
|
||||
handleHelper.setSTS(_handle, alarmStatus, alarmSeverity, ts);
|
||||
}
|
||||
|
||||
else {
|
||||
cafeStatus.report(ECAFE_INVALID_HANDLE);
|
||||
|
||||
Reference in New Issue
Block a user