mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
client: moved shortenable to roi in reciever, roi not yet written in master file
This commit is contained in:
@ -146,19 +146,6 @@ typedef struct {
|
||||
} sls_detector_module;
|
||||
|
||||
|
||||
/**
|
||||
@short structure for a region of interest
|
||||
|
||||
xmin,xmax,ymin,ymax define the limits of the region
|
||||
*/
|
||||
typedef struct {
|
||||
int xmin; /**< is the roi xmin (in channel number) */
|
||||
int xmax; /**< is the roi xmax (in channel number)*/
|
||||
int ymin; /**< is the roi ymin (in channel number)*/
|
||||
int ymax; /**< is the roi ymax (in channel number)*/
|
||||
} ROI ;
|
||||
|
||||
|
||||
/* /\* */
|
||||
/* @short structure for a generic integer array */
|
||||
/* *\/ */
|
||||
|
@ -43,12 +43,12 @@ multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
||||
|
||||
multiSlsDetector::~multiSlsDetector() {
|
||||
// delete zmq sockets first
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
detectors.clear();
|
||||
@ -101,12 +101,12 @@ T multiSlsDetector::callDetectorMember(T (slsDetector::*somefunc)())
|
||||
return minusOneIfDifferent(values);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::callDetectorMember(string (slsDetector::*somefunc)()) {
|
||||
string concatenatedValue, firstValue;
|
||||
std::string multiSlsDetector::callDetectorMember(std::string (slsDetector::*somefunc)()) {
|
||||
std::string concatenatedValue, firstValue;
|
||||
bool valueNotSame = false;
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
string thisValue = (detectors[idet]->*somefunc)();
|
||||
std::string thisValue = (detectors[idet]->*somefunc)();
|
||||
;
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
@ -347,14 +347,14 @@ double* multiSlsDetector::decodeData(int* datain, int& nn, double* fdata) {
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
int multiSlsDetector::writeDataFile(std::string fname, double* data, double* err,
|
||||
double* ang, char dataformat, int nch) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to write formatted data file "
|
||||
<< getTotalNumberOfChannels() << endl;
|
||||
#endif
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
int choff = 0, off = 0; //idata,
|
||||
double *pe = err, *pa = ang;
|
||||
int nch_left = nch, n; //, nd;
|
||||
@ -365,7 +365,7 @@ int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
if (data == NULL)
|
||||
return FAIL;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -399,8 +399,8 @@ int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
}
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
ofstream outfile;
|
||||
int multiSlsDetector::writeDataFile(std::string fname, int* data) {
|
||||
std::ofstream outfile;
|
||||
int choff = 0, off = 0;
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to write raw data file " << endl;
|
||||
@ -409,7 +409,7 @@ int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
if (data == NULL)
|
||||
return FAIL;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
#ifdef VERBOSE
|
||||
@ -430,22 +430,22 @@ int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
}
|
||||
}
|
||||
|
||||
int multiSlsDetector::readDataFile(string fname, double* data, double* err,
|
||||
int multiSlsDetector::readDataFile(std::string fname, double* data, double* err,
|
||||
double* ang, char dataformat) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to read formatted data file " << endl;
|
||||
#endif
|
||||
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
int iline = 0;
|
||||
string str;
|
||||
std::string str;
|
||||
int choff = 0, off = 0;
|
||||
double *pe = err, *pa = ang;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Opening file " << fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -469,19 +469,19 @@ int multiSlsDetector::readDataFile(string fname, double* data, double* err,
|
||||
return iline;
|
||||
}
|
||||
|
||||
int multiSlsDetector::readDataFile(string fname, int* data) {
|
||||
int multiSlsDetector::readDataFile(std::string fname, int* data) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to read raw data file " << endl;
|
||||
#endif
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
int iline = 0;
|
||||
string str;
|
||||
std::string str;
|
||||
int choff = 0, off = 0;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Opening file " << fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -501,17 +501,17 @@ int multiSlsDetector::readDataFile(string fname, int* data) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
std::string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
int64_t multiMask, slsMask = 0;
|
||||
string retval = "";
|
||||
std::string retval = "";
|
||||
char sNumber[100];
|
||||
critical = 0;
|
||||
|
||||
multiMask = getErrorMask();
|
||||
if (multiMask) {
|
||||
if (multiMask & MULTI_DETECTORS_NOT_ADDED) {
|
||||
retval.append("Detectors not added:\n" + string(getNotAddedList()) +
|
||||
string("\n"));
|
||||
retval.append("Detectors not added:\n" + std::string(getNotAddedList()) +
|
||||
std::string("\n"));
|
||||
critical = 1;
|
||||
}
|
||||
if (multiMask & MULTI_HAVE_DIFFERENT_VALUES) {
|
||||
@ -529,13 +529,13 @@ string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
if (multiMask & (1 << idet)) {
|
||||
//append detector id
|
||||
sprintf(sNumber, "%d", idet);
|
||||
retval.append("Detector " + string(sNumber) + string(":\n"));
|
||||
retval.append("Detector " + std::string(sNumber) + std::string(":\n"));
|
||||
//get sls det error mask
|
||||
slsMask = detectors[idet]->getErrorMask();
|
||||
#ifdef VERYVERBOSE
|
||||
//append sls det error mask
|
||||
sprintf(sNumber, "0x%lx", slsMask);
|
||||
retval.append("Error Mask " + string(sNumber) + string("\n"));
|
||||
retval.append("Error Mask " + std::string(sNumber) + std::string("\n"));
|
||||
#endif
|
||||
//get the error critical level
|
||||
if ((slsMask > 0xFFFFFFFF) | critical)
|
||||
@ -643,7 +643,7 @@ void multiSlsDetector::freeSharedMemory(int multiId) {
|
||||
|
||||
void multiSlsDetector::freeSharedMemory() {
|
||||
// clear zmq vector
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
@ -652,7 +652,7 @@ void multiSlsDetector::freeSharedMemory() {
|
||||
clearAllErrorMask();
|
||||
|
||||
// clear sls detector vector shm
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
(*it)->freeSharedMemory();
|
||||
delete (*it);
|
||||
}
|
||||
@ -687,7 +687,7 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
//type
|
||||
sstream<< "\nType: ";
|
||||
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it)
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it)
|
||||
sstream<< (*it)->sgetDetectorsType() << "+";
|
||||
//PID
|
||||
sstream << "\nPID: " << thisMultiDetector->lastPID
|
||||
@ -695,7 +695,7 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
<< "\nUser: " << thisMultiDetector->lastUser
|
||||
<< "\nDate: " << thisMultiDetector->lastDate << endl;
|
||||
|
||||
string s = sstream.str();
|
||||
std::string s = sstream.str();
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -876,7 +876,7 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
||||
badFFList = NULL;
|
||||
|
||||
//multiSlsDetector
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
@ -888,7 +888,7 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
||||
detectors.push_back(sdet);
|
||||
} catch (...) {
|
||||
// clear detectors list
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
detectors.clear();
|
||||
@ -951,21 +951,21 @@ void multiSlsDetector::setHostname(const char* name) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getHostname(int pos) {
|
||||
std::string multiSlsDetector::getHostname(int pos) {
|
||||
return concatResultOrPos(&slsDetector::getHostname, pos);
|
||||
}
|
||||
|
||||
void multiSlsDetector::addMultipleDetectors(const char* name) {
|
||||
size_t p1 = 0;
|
||||
string temp = string(name);
|
||||
std::string temp = std::string(name);
|
||||
size_t p2 = temp.find('+', p1);
|
||||
//single
|
||||
if (p2 == string::npos) {
|
||||
if (p2 == std::string::npos) {
|
||||
addSlsDetector(temp);
|
||||
}
|
||||
// multi
|
||||
else {
|
||||
while(p2 != string::npos) {
|
||||
while(p2 != std::string::npos) {
|
||||
addSlsDetector(temp.substr(p1, p2-p1));
|
||||
temp = temp.substr(p2 + 1);
|
||||
p2 = temp.find('+');
|
||||
@ -982,7 +982,7 @@ void multiSlsDetector::addSlsDetector (std::string s) {
|
||||
#ifdef VERBOSE
|
||||
cout << "Adding detector " << s << endl;
|
||||
#endif
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
if ((*it)->getHostname((it-detectors.begin())) == s) {
|
||||
cout << "Detector " << s << "already part of the multiDetector!" << endl
|
||||
<< "Remove it before adding it back in a new position!" << endl;
|
||||
@ -1048,7 +1048,7 @@ void multiSlsDetector::createThreadPool() {
|
||||
threadpool = new ThreadPool(numthreads);
|
||||
switch (threadpool->initialize_threadpool()) {
|
||||
case 0:
|
||||
cerr << "Failed to initialize thread pool!" << endl;
|
||||
std::cerr << "Failed to initialize thread pool!" << endl;
|
||||
throw ThreadpoolException();
|
||||
case 1:
|
||||
#ifdef VERBOSE
|
||||
@ -1089,7 +1089,7 @@ void multiSlsDetector::getNumberOfDetectors(int& nx, int& ny) {
|
||||
|
||||
int multiSlsDetector::getNMods() {
|
||||
int nm = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
nm += (*it)->getNMods();
|
||||
}
|
||||
return nm;
|
||||
@ -1097,7 +1097,7 @@ int multiSlsDetector::getNMods() {
|
||||
|
||||
int multiSlsDetector::getNMod(dimension d) {
|
||||
int nm = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
nm += (*it)->getNMod(d);
|
||||
}
|
||||
return nm;
|
||||
@ -1105,7 +1105,7 @@ int multiSlsDetector::getNMod(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxMods() {
|
||||
int ret = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret += (*it)->getMaxMods();
|
||||
}
|
||||
return ret;
|
||||
@ -1113,7 +1113,7 @@ int multiSlsDetector::getMaxMods() {
|
||||
|
||||
int multiSlsDetector::getMaxMod(dimension d) {
|
||||
int ret = 0, ret1;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret1 = (*it)->getNMaxMod(d);
|
||||
#ifdef VERBOSE
|
||||
cout << "detector " << (it-detectors.begin()) << " maxmods " <<
|
||||
@ -1130,7 +1130,7 @@ int multiSlsDetector::getMaxMod(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxNumberOfModules(dimension d) {
|
||||
int ret = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret += (*it)->getMaxNumberOfModules(d);
|
||||
}
|
||||
return ret;
|
||||
@ -1181,7 +1181,7 @@ int multiSlsDetector::getChansPerMod(int imod) {
|
||||
|
||||
int multiSlsDetector::getTotalNumberOfChannels() {
|
||||
thisMultiDetector->numberOfChannels = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
thisMultiDetector->numberOfChannels += (*it)->getTotalNumberOfChannels();
|
||||
}
|
||||
return thisMultiDetector->numberOfChannels;
|
||||
@ -1197,7 +1197,7 @@ int multiSlsDetector::getTotalNumberOfChannelsInclGapPixels(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxNumberOfChannels() {
|
||||
thisMultiDetector->maxNumberOfChannels = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
thisMultiDetector->maxNumberOfChannels += (*it)->getMaxNumberOfChannels();
|
||||
}
|
||||
return thisMultiDetector->maxNumberOfChannels;
|
||||
@ -1401,10 +1401,10 @@ int multiSlsDetector::setOnline(int off) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::checkOnline() {
|
||||
string offlineDetectors = "";
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
string tmp = (*it)->checkOnline();
|
||||
std::string multiSlsDetector::checkOnline() {
|
||||
std::string offlineDetectors = "";
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
std::string tmp = (*it)->checkOnline();
|
||||
if (!tmp.empty())
|
||||
offlineDetectors += tmp + "+";
|
||||
}
|
||||
@ -1420,7 +1420,7 @@ int multiSlsDetector::lockServer(int p) {
|
||||
return callDetectorMember(&slsDetector::lockServer, p);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getLastClientIP() {
|
||||
std::string multiSlsDetector::getLastClientIP() {
|
||||
return callDetectorMember(&slsDetector::getLastClientIP);
|
||||
}
|
||||
|
||||
@ -1434,26 +1434,26 @@ int multiSlsDetector::exitServer() {
|
||||
return ival;
|
||||
}
|
||||
|
||||
int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
int multiSlsDetector::readConfigurationFile(std::string const fname) {
|
||||
|
||||
freeSharedMemory();
|
||||
setupMultiDetector();
|
||||
|
||||
|
||||
multiSlsDetectorClient* cmd;
|
||||
string ans;
|
||||
string str;
|
||||
ifstream infile;
|
||||
std::string ans;
|
||||
std::string str;
|
||||
std::ifstream infile;
|
||||
int iargval;
|
||||
int interrupt = 0;
|
||||
char* args[1000];
|
||||
|
||||
char myargs[1000][1000];
|
||||
|
||||
string sargname, sargval;
|
||||
std::string sargname, sargval;
|
||||
int iline = 0;
|
||||
std::cout << "config file name " << fname << std::endl;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
while (infile.good() and interrupt == 0) {
|
||||
@ -1463,7 +1463,7 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
++iline;
|
||||
|
||||
// remove comments that come after
|
||||
if (str.find('#') != string::npos)
|
||||
if (str.find('#') != std::string::npos)
|
||||
str.erase(str.find('#'));
|
||||
#ifdef VERBOSE
|
||||
std::cout << "string:" << str << std::endl;
|
||||
@ -1474,7 +1474,7 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
#endif
|
||||
continue;
|
||||
} else {
|
||||
istringstream ssstr(str);
|
||||
std::istringstream ssstr(str);
|
||||
iargval = 0;
|
||||
while (ssstr.good()) {
|
||||
ssstr >> sargname;
|
||||
@ -1524,9 +1524,9 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
int multiSlsDetector::writeConfigurationFile(std::string const fname) {
|
||||
|
||||
string names[] = {
|
||||
std::string names[] = {
|
||||
"detsizechan",
|
||||
"hostname",
|
||||
"master",
|
||||
@ -1551,10 +1551,10 @@ int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
}
|
||||
int ret = OK, ret1 = OK;
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
int iline = 0;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
slsDetectorCommand* cmd = new slsDetectorCommand(this);
|
||||
@ -1610,7 +1610,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
|
||||
|
||||
|
||||
string multiSlsDetector::getSettingsFile() {
|
||||
std::string multiSlsDetector::getSettingsFile() {
|
||||
return callDetectorMember(&slsDetector::getSettingsFile);
|
||||
}
|
||||
|
||||
@ -1774,14 +1774,14 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getSettingsDir() {
|
||||
std::string multiSlsDetector::getSettingsDir() {
|
||||
return callDetectorMember(&slsDetector::getSettingsDir);
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::setSettingsDir(string s) {
|
||||
std::string multiSlsDetector::setSettingsDir(std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
detectors[idet]->setSettingsDir(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -1791,7 +1791,7 @@ string multiSlsDetector::setSettingsDir(string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
detectors[id]->setSettingsDir(s.substr(p1, p2 - p1));
|
||||
if (detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << id));
|
||||
@ -1805,13 +1805,13 @@ string multiSlsDetector::setSettingsDir(string s) {
|
||||
return getSettingsDir();
|
||||
}
|
||||
|
||||
string multiSlsDetector::getCalDir() {
|
||||
std::string multiSlsDetector::getCalDir() {
|
||||
return callDetectorMember(&slsDetector::getCalDir);
|
||||
}
|
||||
|
||||
string multiSlsDetector::setCalDir(string s) {
|
||||
std::string multiSlsDetector::setCalDir(std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
detectors[idet]->setCalDir(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -1821,7 +1821,7 @@ string multiSlsDetector::setCalDir(string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
|
||||
if (detectors[id]) {
|
||||
detectors[id]->setCalDir(s.substr(p1, p2 - p1));
|
||||
@ -1839,7 +1839,7 @@ string multiSlsDetector::setCalDir(string s) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int multiSlsDetector::loadSettingsFile(std::string fname, int imod) {
|
||||
int ret = OK;
|
||||
|
||||
// single
|
||||
@ -1864,7 +1864,7 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int* iret[detectors.size()];
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
iret[idet] = new int(OK);
|
||||
Task* task = new Task(new func2_t<int, string, int>(&slsDetector::loadSettingsFile,
|
||||
Task* task = new Task(new func2_t<int, std::string, int>(&slsDetector::loadSettingsFile,
|
||||
detectors[idet], fname, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -1884,7 +1884,7 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::saveSettingsFile(string fname, int imod) {
|
||||
int multiSlsDetector::saveSettingsFile(std::string fname, int imod) {
|
||||
int id = -1, im = -1, ret;
|
||||
|
||||
if (decodeNMod(imod, id, im) >= 0) {
|
||||
@ -1905,7 +1905,7 @@ int multiSlsDetector::saveSettingsFile(string fname, int imod) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
int multiSlsDetector::loadCalibrationFile(std::string fname, int imod) {
|
||||
int ret = OK;
|
||||
|
||||
// single
|
||||
@ -1931,7 +1931,7 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
if (detectors[idet]) {
|
||||
iret[idet] = new int(OK);
|
||||
Task* task = new Task(new func2_t<int, string, int>(&slsDetector::loadCalibrationFile,
|
||||
Task* task = new Task(new func2_t<int, std::string, int>(&slsDetector::loadCalibrationFile,
|
||||
detectors[idet], fname, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -1954,7 +1954,7 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::saveCalibrationFile(string fname, int imod) {
|
||||
int multiSlsDetector::saveCalibrationFile(std::string fname, int imod) {
|
||||
int id = -1, im = -1, ret;
|
||||
if (decodeNMod(imod, id, im) >= 0) {
|
||||
if (id < 0 || id >= (int)detectors.size())
|
||||
@ -3030,21 +3030,21 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
std::string multiSlsDetector::setNetworkParameter(networkParameter p, std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
|
||||
if (!threadpool) {
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return getNetworkParameter(p);
|
||||
} else {
|
||||
string* sret[detectors.size()];
|
||||
std::string* sret[detectors.size()];
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT)
|
||||
s.append("multi\0");
|
||||
sret[idet] = new string("error");
|
||||
Task* task = new Task(new func2_t<string, networkParameter,
|
||||
string>(&slsDetector::setNetworkParameter,
|
||||
sret[idet] = new std::string("error");
|
||||
Task* task = new Task(new func2_t<std::string, networkParameter,
|
||||
std::string>(&slsDetector::setNetworkParameter,
|
||||
detectors[idet], p, s, sret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -3063,7 +3063,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
detectors[id]->setNetworkParameter(p, s.substr(p1, p2 - p1));
|
||||
if (detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << id));
|
||||
@ -3078,18 +3078,18 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
return getNetworkParameter(p);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
string s0 = "", s1 = "", s;
|
||||
string ans = "";
|
||||
std::string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
std::string s0 = "", s1 = "", s;
|
||||
std::string ans = "";
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
s = detectors[idet]->getNetworkParameter(p);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
|
||||
if (s0 == "")
|
||||
s0 = s + string("+");
|
||||
s0 = s + std::string("+");
|
||||
else
|
||||
s0 += s + string("+");
|
||||
s0 += s + std::string("+");
|
||||
|
||||
if (s1 == "")
|
||||
s1 = s;
|
||||
@ -3168,13 +3168,13 @@ int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imo
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadImageToDetector(imageType index, string const fname) {
|
||||
int multiSlsDetector::loadImageToDetector(imageType index, std::string const fname) {
|
||||
|
||||
int ret = -100, ret1;
|
||||
short int imageVals[thisMultiDetector->numberOfChannels];
|
||||
|
||||
ifstream infile;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
std::ifstream infile;
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl
|
||||
@ -3204,11 +3204,11 @@ int multiSlsDetector::loadImageToDetector(imageType index, string const fname) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeCounterBlockFile(string const fname, int startACQ) {
|
||||
int multiSlsDetector::writeCounterBlockFile(std::string const fname, int startACQ) {
|
||||
int ret = OK, ret1 = OK;
|
||||
short int arg[thisMultiDetector->numberOfChannels];
|
||||
ofstream outfile;
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
std::ofstream outfile;
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl
|
||||
@ -3872,7 +3872,7 @@ int multiSlsDetector::setStoragecellStart(int pos) {
|
||||
return parallelCallDetectorMember(&slsDetector::setStoragecellStart, pos);
|
||||
}
|
||||
|
||||
int multiSlsDetector::programFPGA(string fname) {
|
||||
int multiSlsDetector::programFPGA(std::string fname) {
|
||||
int ret = OK, ret1 = OK;
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -4173,14 +4173,14 @@ int multiSlsDetector::rateCorrect(double* datain, double* errin, double* dataout
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::setFlatFieldCorrection(string fname) {
|
||||
int multiSlsDetector::setFlatFieldCorrection(std::string fname) {
|
||||
double* data = new double[thisMultiDetector->numberOfChannels];
|
||||
double* ffcoefficients = new double[thisMultiDetector->numberOfChannels];
|
||||
double* fferrors = new double[thisMultiDetector->numberOfChannels];
|
||||
char ffffname[MAX_STR_LENGTH * 2];
|
||||
int nch;
|
||||
if (fname == "default") {
|
||||
fname = string(thisMultiDetector->flatFieldFile);
|
||||
fname = std::string(thisMultiDetector->flatFieldFile);
|
||||
}
|
||||
|
||||
thisMultiDetector->correctionMask &= ~(1 << FLAT_FIELD_CORRECTION);
|
||||
@ -4200,7 +4200,7 @@ int multiSlsDetector::setFlatFieldCorrection(string fname) {
|
||||
std::cout << "Setting flat field correction from file " << fname << std::endl;
|
||||
#endif
|
||||
sprintf(ffffname, "%s/%s", thisMultiDetector->flatFieldDir, fname.c_str());
|
||||
nch = readDataFile(string(ffffname), data);
|
||||
nch = readDataFile(std::string(ffffname), data);
|
||||
|
||||
if (nch > thisMultiDetector->numberOfChannels)
|
||||
nch = thisMultiDetector->numberOfChannels;
|
||||
@ -4298,7 +4298,7 @@ int multiSlsDetector::flatFieldCorrect(double* datain, double* errin, double* da
|
||||
return 0;
|
||||
}
|
||||
|
||||
int multiSlsDetector::setBadChannelCorrection(string fname) {
|
||||
int multiSlsDetector::setBadChannelCorrection(std::string fname) {
|
||||
int badlist[MAX_BADCHANS];
|
||||
int nbad = 0;
|
||||
int ret = 0;
|
||||
@ -4306,7 +4306,7 @@ int multiSlsDetector::setBadChannelCorrection(string fname) {
|
||||
cout << thisMultiDetector->badChanFile << endl;
|
||||
|
||||
if (fname == "default")
|
||||
fname = string(thisMultiDetector->badChanFile);
|
||||
fname = std::string(thisMultiDetector->badChanFile);
|
||||
|
||||
ret = setBadChannelCorrection(fname, nbad, badlist);
|
||||
//#ifdef VERBOSE
|
||||
@ -4428,11 +4428,11 @@ int multiSlsDetector::getBadChannelCorrection(int* bad) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::readAngularConversionFile(string fname) {
|
||||
int multiSlsDetector::readAngularConversionFile(std::string fname) {
|
||||
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
//int nm=0;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
@ -4451,11 +4451,11 @@ int multiSlsDetector::readAngularConversionFile(string fname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeAngularConversion(string fname) {
|
||||
int multiSlsDetector::writeAngularConversion(std::string fname) {
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
// int nm=0;
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
@ -4548,8 +4548,8 @@ int multiSlsDetector::setReceiverOnline(int off) {
|
||||
return thisMultiDetector->receiverOnlineFlag;
|
||||
}
|
||||
|
||||
string multiSlsDetector::checkReceiverOnline() {
|
||||
string retval1 = "", retval;
|
||||
std::string multiSlsDetector::checkReceiverOnline() {
|
||||
std::string retval1 = "", retval;
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
retval = detectors[idet]->checkReceiverOnline();
|
||||
if (!retval.empty()) {
|
||||
@ -4564,7 +4564,7 @@ int multiSlsDetector::lockReceiver(int lock) {
|
||||
return callDetectorMember(&slsDetector::lockReceiver, lock);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getReceiverLastClientIP() {
|
||||
std::string multiSlsDetector::getReceiverLastClientIP() {
|
||||
return callDetectorMember(&slsDetector::getReceiverLastClientIP);
|
||||
}
|
||||
|
||||
@ -4583,9 +4583,9 @@ std::string multiSlsDetector::getFilePath() {
|
||||
return setFilePath();
|
||||
}
|
||||
|
||||
string multiSlsDetector::setFilePath(string s) {
|
||||
std::string multiSlsDetector::setFilePath(std::string s) {
|
||||
|
||||
string ret = "errorerror", ret1;
|
||||
std::string ret = "errorerror", ret1;
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
ret1 = detectors[idet]->setFilePath(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -4603,9 +4603,9 @@ std::string multiSlsDetector::getFileName() {
|
||||
return setFileName();
|
||||
}
|
||||
|
||||
string multiSlsDetector::setFileName(string s) {
|
||||
std::string multiSlsDetector::setFileName(std::string s) {
|
||||
|
||||
string ret = "error";
|
||||
std::string ret = "error";
|
||||
int posmax = detectors.size();
|
||||
|
||||
if (!s.empty()) {
|
||||
@ -4616,12 +4616,12 @@ string multiSlsDetector::setFileName(string s) {
|
||||
|
||||
if (!threadpool) {
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return string("");
|
||||
return std::string("");
|
||||
} else {
|
||||
string* sret[detectors.size()];
|
||||
std::string* sret[detectors.size()];
|
||||
for (int idet = 0; idet < posmax; ++idet) {
|
||||
sret[idet] = new string("error");
|
||||
Task* task = new Task(new func1_t<string, string>(&slsDetector::setFileName,
|
||||
sret[idet] = new std::string("error");
|
||||
Task* task = new Task(new func1_t<std::string, std::string>(&slsDetector::setFileName,
|
||||
detectors[idet], s, sret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -4928,7 +4928,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
||||
if (destroy) {
|
||||
cprintf(MAGENTA, "Going to destroy data sockets\n");
|
||||
//close socket
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
(*it)->Close();
|
||||
delete(*it);
|
||||
}
|
||||
@ -5010,7 +5010,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
uint32_t size = 0, nPixelsX = 0, nPixelsY = 0, dynamicRange = 0;
|
||||
float bytesPerPixel = 0;
|
||||
// header info every header
|
||||
string currentFileName = "";
|
||||
std::string currentFileName = "";
|
||||
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1, currentFileIndex = -1;
|
||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, flippedDataX = -1;
|
||||
|
||||
@ -5375,7 +5375,7 @@ int multiSlsDetector::setReceiverSilentMode(int i) {
|
||||
return callDetectorMember(&slsDetector::setReceiverSilentMode, i);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setCTBPattern(string fname) {
|
||||
int multiSlsDetector::setCTBPattern(std::string fname) {
|
||||
uint64_t word;
|
||||
int addr = 0;
|
||||
FILE* fd = fopen(fname.c_str(), "r");
|
||||
|
@ -19,7 +19,7 @@ class multiSlsDetectorClient {
|
||||
|
||||
public:
|
||||
multiSlsDetectorClient(int argc, char *argv[], int action, multiSlsDetector *myDetector=NULL) { \
|
||||
string answer; \
|
||||
std::string answer; \
|
||||
multiSlsDetectorCommand *myCmd; \
|
||||
int id = -1, pos = -1, iv = 0; \
|
||||
bool verify = true, update = true; \
|
||||
@ -90,7 +90,7 @@ public:
|
||||
strcpy(cmd, argv[0]); \
|
||||
} \
|
||||
// special commands
|
||||
string scmd = cmd; \
|
||||
std::string scmd = cmd; \
|
||||
// free without calling multiSlsDetector constructor
|
||||
if (scmd == "free") { \
|
||||
if (pos != -1) \
|
||||
|
@ -28,8 +28,8 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
/* \returns answer string */
|
||||
/* *\/ */
|
||||
|
||||
string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||
string s; \
|
||||
std::string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||
std::string s; \
|
||||
if (id>=0) {
|
||||
slsDetector *d=myDet->getSlsDetector(id); \
|
||||
if (d) { \
|
||||
@ -39,7 +39,7 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
myDet->setErrorMask((myDet->getErrorMask())|(1<<id)); \
|
||||
delete cmd;
|
||||
} else
|
||||
s=string("detector does no exist"); \
|
||||
s=std::string("detector does no exist"); \
|
||||
} else \
|
||||
s=slsDetectorCommand::executeLine(narg,args,action); \
|
||||
return s;
|
||||
@ -48,13 +48,13 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
/**
|
||||
* calls executeLine with PUT_ACTION
|
||||
*/
|
||||
string putCommand(int narg, char *args[], int pos=-1){\
|
||||
std::string putCommand(int narg, char *args[], int pos=-1){\
|
||||
return executeLine(narg, args,slsDetectorDefs::PUT_ACTION,pos);\
|
||||
};
|
||||
/**
|
||||
* calls executeLine with GET_ACTION
|
||||
*/
|
||||
string getCommand(int narg, char *args[], int pos=-1){\
|
||||
std::string getCommand(int narg, char *args[], int pos=-1){\
|
||||
return executeLine(narg, args,slsDetectorDefs::GET_ACTION,pos);\
|
||||
};
|
||||
|
||||
|
@ -4149,22 +4149,6 @@ int slsDetector::configureMAC() {
|
||||
std::cout<< "Configuring MAC failed " << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
else if (thisDetector->myDetectorType==GOTTHARD){
|
||||
|
||||
// update roi in update receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
int fnum=F_RECEIVER_SHORT_FRAME;
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending adc val to receiver " << retval << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum,retval,retval);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -5316,6 +5300,9 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
setReceiverStreamingIP(getReceiverStreamingIP());
|
||||
setAdditionalJsonHeader(getAdditionalJsonHeader());
|
||||
enableDataStreamingFromReceiver(enableDataStreamingFromReceiver(-1));
|
||||
|
||||
if(thisDetector->myDetectorType == GOTTHARD)
|
||||
sendROI(-1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6060,9 +6047,6 @@ int slsDetector::setROI(int n,ROI roiLimits[]) {
|
||||
}
|
||||
|
||||
ret = sendROI(n,roiLimits);
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
|
||||
return ret;
|
||||
@ -6141,9 +6125,25 @@ int slsDetector::sendROI(int n,ROI roiLimits[]) {
|
||||
<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<")"<<endl;
|
||||
#endif
|
||||
|
||||
// update receiver
|
||||
if (thisDetector->myDetectorType == GOTTHARD)
|
||||
// old firmware requires configuremac after setting roi
|
||||
if (thisDetector->myDetectorType == GOTTHARD) {
|
||||
configureMAC();
|
||||
}
|
||||
|
||||
// update roi in receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
int fnum=F_RECEIVER_SET_ROI;
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending ROI to receiver " << thisDetector->nROI << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendROI(fnum, thisDetector->nROI, thisDetector->roiLimits);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns hostname
|
||||
*/
|
||||
string getHostname(int pos = -1);
|
||||
std::string getHostname(int pos = -1);
|
||||
|
||||
/**
|
||||
* Appends detectors to the end of the list in shared memory
|
||||
@ -582,7 +582,7 @@ public:
|
||||
* @param type string of detector type
|
||||
* @returns detector type in receiver
|
||||
*/
|
||||
int setDetectorType(string stype);
|
||||
int setDetectorType(std::string stype);
|
||||
|
||||
/**
|
||||
* Get Detector type from shared memory variable
|
||||
@ -596,14 +596,14 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns string version of detector type from shared memory variable
|
||||
*/
|
||||
string sgetDetectorsType(int pos=-1);
|
||||
std::string sgetDetectorsType(int pos=-1);
|
||||
|
||||
/**
|
||||
* Just to overload getDetectorType from users
|
||||
* Gets string version of detector type from shared memory variable
|
||||
* @returns gets string version of detector type from shared memory variable
|
||||
*/
|
||||
string getDetectorType();
|
||||
std::string getDetectorType();
|
||||
|
||||
/**
|
||||
* Returns number of modules from shared memory (Mythen)
|
||||
@ -768,7 +768,7 @@ public:
|
||||
* @returns empty string if it is online
|
||||
* else returns hostnameif it is offline
|
||||
*/
|
||||
string checkOnline();
|
||||
std::string checkOnline();
|
||||
|
||||
/**
|
||||
* Configure the TCP socket communciation and initializes the socket instances
|
||||
@ -778,7 +778,7 @@ public:
|
||||
* @returns OK or FAIL
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setTCPSocket(string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
int setTCPSocket(std::string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
|
||||
|
||||
/**
|
||||
@ -802,7 +802,7 @@ public:
|
||||
int getStopPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver TCP port \sa sharedSlsDetector
|
||||
* Returns the receiver TCP port \sa sharedSlsDetector
|
||||
* @returns the receiver TCP port
|
||||
*/
|
||||
int getReceiverPort();
|
||||
@ -818,7 +818,7 @@ public:
|
||||
* Get last client IP saved on detector server
|
||||
* @returns last client IP saved on detector server
|
||||
*/
|
||||
string getLastClientIP();
|
||||
std::string getLastClientIP();
|
||||
|
||||
/**
|
||||
* Exit detector server
|
||||
@ -833,7 +833,7 @@ public:
|
||||
* @param answer is the answer from the detector
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int execCommand(string cmd, string answer);
|
||||
int execCommand(std::string cmd, std::string answer);
|
||||
|
||||
/**
|
||||
* Updates some of the shared memory receiving the data from the detector
|
||||
@ -854,14 +854,14 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(string const fname);
|
||||
int readConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Load configuration from a stream
|
||||
* @param infile stream
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(ifstream &infile);
|
||||
int readConfigurationFile(std::ifstream &infile);
|
||||
|
||||
/**
|
||||
* Write current configuration to a file
|
||||
@ -869,7 +869,7 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(string const fname);
|
||||
int writeConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Write current configuration to a stream
|
||||
@ -877,13 +877,13 @@ public:
|
||||
* @param id detector id
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(ofstream &outfile, int id=-1);
|
||||
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
|
||||
|
||||
/**
|
||||
* Returns the trimfile or settings file name (Useless??)
|
||||
* @returns the trimfile or settings file name
|
||||
*/
|
||||
string getSettingsFile();
|
||||
std::string getSettingsFile();
|
||||
|
||||
/**
|
||||
* Writes a trim/settings file for module number imod,
|
||||
@ -896,7 +896,7 @@ public:
|
||||
* \sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||
*/
|
||||
using energyConversion::writeSettingsFile;
|
||||
int writeSettingsFile(string fname, int imod, int iodelay, int tau);
|
||||
int writeSettingsFile(std::string fname, int imod, int iodelay, int tau);
|
||||
|
||||
/**
|
||||
* Get detector settings
|
||||
@ -965,7 +965,7 @@ public:
|
||||
* @param s trimbits/settings directory
|
||||
* @returns the trimbit/settings directory
|
||||
*/
|
||||
std::string setSettingsDir(string s);
|
||||
std::string setSettingsDir(std::string s);
|
||||
|
||||
/**
|
||||
* Returns the calibration files directory \sa sharedSlsDetector (Mythen)
|
||||
@ -978,7 +978,7 @@ public:
|
||||
* @param s the calibration files directory
|
||||
* @returns the calibration files directory
|
||||
*/
|
||||
std::string setCalDir(string s);
|
||||
std::string setCalDir(std::string s);
|
||||
|
||||
/**
|
||||
* Loads the modules settings/trimbits reading from a specific file
|
||||
@ -988,7 +988,7 @@ public:
|
||||
* from which will be calculated the detector index and the module index (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadSettingsFile(string fname, int imod=-1);
|
||||
int loadSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules settings/trimbits to a specific file
|
||||
@ -997,7 +997,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveSettingsFile(string fname, int imod=-1);
|
||||
int saveSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Loads the modules calibration data reading from a specific file (Mythen)
|
||||
@ -1006,7 +1006,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadCalibrationFile(string fname, int imod=-1);
|
||||
int loadCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules calibration data to a specific file (Mythen)
|
||||
@ -1015,7 +1015,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveCalibrationFile(string fname, int imod=-1);
|
||||
int saveCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Sets/gets the detector in position i as master of the structure (Mythen)
|
||||
@ -1275,94 +1275,94 @@ public:
|
||||
* @param s network parameter value
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string setNetworkParameter(networkParameter index, string value);
|
||||
std::string setNetworkParameter(networkParameter index, std::string value);
|
||||
|
||||
/**
|
||||
* Get network parameter
|
||||
* @param p network parameter type
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string getNetworkParameter(networkParameter index);
|
||||
std::string getNetworkParameter(networkParameter index);
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address\sa sharedSlsDetector
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string getDetectorMAC();
|
||||
std::string getDetectorMAC();
|
||||
|
||||
/**
|
||||
* Returns the detector IP address\sa sharedSlsDetector
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string getDetectorIP();
|
||||
std::string getDetectorIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver IP address\sa sharedSlsDetector
|
||||
* @returns the receiver IP address
|
||||
*/
|
||||
string getReceiver();
|
||||
std::string getReceiver();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
string getReceiverUDPIP();
|
||||
std::string getReceiverUDPIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
string getReceiverUDPMAC();
|
||||
std::string getReceiverUDPMAC();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
string getReceiverUDPPort();
|
||||
std::string getReceiverUDPPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port 2 of same interface
|
||||
*/
|
||||
string getReceiverUDPPort2();
|
||||
std::string getReceiverUDPPort2();
|
||||
|
||||
/**
|
||||
* Returns the client zmq port \sa sharedSlsDetector
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string getClientStreamingPort();
|
||||
std::string getClientStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq port \sa sharedSlsDetector
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string getReceiverStreamingPort();
|
||||
std::string getReceiverStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the client zmq ip \sa sharedSlsDetector
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getClientStreamingIP();
|
||||
std::string getClientStreamingIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq ip \sa sharedSlsDetector
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getReceiverStreamingIP();
|
||||
std::string getReceiverStreamingIP();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
|
||||
* @param detectorMAC detector MAC address
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string setDetectorMAC(string detectorMAC);
|
||||
std::string setDetectorMAC(std::string detectorMAC);
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address and sets it \sa sharedSlsDetector
|
||||
* @param detectorIP detector IP address
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string setDetectorIP(string detectorIP);
|
||||
std::string setDetectorIP(std::string detectorIP);
|
||||
|
||||
/**
|
||||
* Validates and sets the receiver.
|
||||
@ -1371,21 +1371,21 @@ public:
|
||||
* @param receiver receiver hostname or IP address
|
||||
* @returns the receiver IP address from shared memory
|
||||
*/
|
||||
string setReceiver(string receiver);
|
||||
std::string setReceiver(std::string receiver);
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address and sets it \sa sharedSlsDetector
|
||||
* @param udpip receiver UDP IP address
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
string setReceiverUDPIP(string udpip);
|
||||
std::string setReceiverUDPIP(std::string udpip);
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address and sets it \sa sharedSlsDetector
|
||||
* @param udpmac receiver UDP MAC address
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
string setReceiverUDPMAC(string udpmac);
|
||||
std::string setReceiverUDPMAC(std::string udpmac);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port\sa sharedSlsDetector
|
||||
@ -1407,7 +1407,7 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string setClientStreamingPort(string port);
|
||||
std::string setClientStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq port\sa sharedSlsDetector
|
||||
@ -1415,21 +1415,21 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string setReceiverStreamingPort(string port);
|
||||
std::string setReceiverStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the client zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP client zmq ip
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setClientStreamingIP(string sourceIP);
|
||||
std::string setClientStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setReceiverStreamingIP(string sourceIP);
|
||||
std::string setReceiverStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Execute a digital test (Gotthard, Mythen)
|
||||
@ -1455,7 +1455,7 @@ public:
|
||||
* @param fname file name from which to load image
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int loadImageToDetector(imageType index,string const fname);
|
||||
int loadImageToDetector(imageType index,std::string const fname);
|
||||
|
||||
/**
|
||||
* Called from loadImageToDetector to send the image to detector
|
||||
@ -1471,7 +1471,7 @@ public:
|
||||
* @param startACQ is 1 to start acquisition after reading counter
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeCounterBlockFile(string const fname,int startACQ=0);
|
||||
int writeCounterBlockFile(std::string const fname,int startACQ=0);
|
||||
|
||||
/**
|
||||
* Gets counter memory block in detector (Gotthard)
|
||||
@ -1658,7 +1658,7 @@ public:
|
||||
* @param fname file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int programFPGA(string fname);
|
||||
int programFPGA(std::string fname);
|
||||
|
||||
/**
|
||||
* Resets FPGA (Jungfrau)
|
||||
@ -1845,7 +1845,7 @@ public:
|
||||
* @param fname name of the flat field file (or "" if disable)
|
||||
* @returns 0 if disable (or file could not be read), >0 otherwise
|
||||
*/
|
||||
int setFlatFieldCorrection(string fname="");
|
||||
int setFlatFieldCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set flat field corrections (Mythen)
|
||||
@ -1880,7 +1880,7 @@ public:
|
||||
* @param fname file with bad channel list ("" disable)
|
||||
* @returns 0 if bad channel disabled, >0 otherwise
|
||||
*/
|
||||
int setBadChannelCorrection(string fname="");
|
||||
int setBadChannelCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set bad channels correction (Mythen)
|
||||
@ -1905,7 +1905,7 @@ public:
|
||||
* @param fname file to be read
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversionFile(string fname="");
|
||||
int readAngularConversionFile(std::string fname="");
|
||||
|
||||
/**
|
||||
* Reads an angular conversion file (Mythen, Gotthard)
|
||||
@ -1913,7 +1913,7 @@ public:
|
||||
* @param ifs input stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversion(ifstream& ifs);
|
||||
int readAngularConversion(std::ifstream& ifs);
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1921,7 +1921,7 @@ public:
|
||||
* @param fname file to be written
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(string fname="");
|
||||
int writeAngularConversion(std::string fname="");
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1929,7 +1929,7 @@ public:
|
||||
* @param ofs output stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(ofstream &ofs);
|
||||
int writeAngularConversion(std::ofstream &ofs);
|
||||
|
||||
/**
|
||||
* Get angular conversion (Mythen, Gotthard)
|
||||
@ -1965,7 +1965,7 @@ public:
|
||||
* Checks if the receiver is really online
|
||||
* @returns empty string if online, else returns receiver hostname
|
||||
*/
|
||||
string checkReceiverOnline();
|
||||
std::string checkReceiverOnline();
|
||||
|
||||
/**
|
||||
* Configure the socket communication and initializes the socket instances
|
||||
@ -1974,7 +1974,7 @@ public:
|
||||
* @returns OK is connection succeded, FAIL otherwise
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setReceiverTCPSocket(string const name="", int const receiver_port=-1);
|
||||
int setReceiverTCPSocket(std::string const name="", int const receiver_port=-1);
|
||||
|
||||
/**
|
||||
* Locks/Unlocks the connection to the receiver
|
||||
@ -1987,7 +1987,7 @@ public:
|
||||
* Returns the IP of the last client connecting to the receiver
|
||||
* @returns the IP of the last client connecting to the receiver
|
||||
*/
|
||||
string getReceiverLastClientIP();
|
||||
std::string getReceiverLastClientIP();
|
||||
|
||||
/**
|
||||
* Exits the receiver TCP server
|
||||
@ -2028,27 +2028,27 @@ public:
|
||||
* Returns output file directory
|
||||
* @returns output file directory
|
||||
*/
|
||||
string getFilePath();
|
||||
std::string getFilePath();
|
||||
|
||||
/**
|
||||
* Sets up the file directory
|
||||
* @param s file directory
|
||||
* @returns file dir
|
||||
*/
|
||||
string setFilePath(string s="");
|
||||
std::string setFilePath(std::string s="");
|
||||
|
||||
/**
|
||||
* Returns file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string getFileName();
|
||||
std::string getFileName();
|
||||
|
||||
/**
|
||||
* Sets up the file name prefix
|
||||
* @param s file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string setFileName(string s="");
|
||||
std::string setFileName(std::string s="");
|
||||
|
||||
/**
|
||||
* Sets the max frames per file in receiver
|
||||
@ -2236,7 +2236,7 @@ public:
|
||||
* @param fname pattern file to open
|
||||
* @returns OK/FAIL
|
||||
*/
|
||||
int setCTBPattern(string fname);
|
||||
int setCTBPattern(std::string fname);
|
||||
|
||||
/**
|
||||
* Writes a pattern word to the CTB
|
||||
@ -2394,33 +2394,33 @@ private:
|
||||
* Returns the additional json header \sa sharedSlsDetector
|
||||
* @returns the additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getAdditionalJsonHeader();
|
||||
std::string getAdditionalJsonHeader();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver UDP socket buffer size
|
||||
*/
|
||||
string getReceiverUDPSocketBufferSize() ;
|
||||
std::string getReceiverUDPSocketBufferSize() ;
|
||||
|
||||
/**
|
||||
* Returns the receiver real UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver real UDP socket buffer size
|
||||
*/
|
||||
string getReceiverRealUDPSocketBufferSize();
|
||||
std::string getReceiverRealUDPSocketBufferSize();
|
||||
|
||||
/**
|
||||
* Sets the additional json header\sa sharedSlsDetector
|
||||
* @param jsonheader additional json header
|
||||
* @returns additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setAdditionalJsonHeader(string jsonheader);
|
||||
std::string setAdditionalJsonHeader(std::string jsonheader);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP socket buffer size
|
||||
* @param udpsockbufsize additional json header
|
||||
* @returns receiver udp socket buffer size
|
||||
*/
|
||||
string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
std::string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
|
||||
/**
|
||||
* Sets the transmission delay for left, right or entire frame
|
||||
@ -2429,7 +2429,7 @@ private:
|
||||
* @param delay delay
|
||||
* @returns transmission delay
|
||||
*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -197,3 +197,21 @@ int receiverInterface::executeFunction(int fnum,char mess[]){
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]) {
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(&n,sizeof(n));
|
||||
dataSocket->SendDataOnly(roiLimits,n * sizeof(slsReceiverDefs::ROI));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,6 +131,15 @@ public:
|
||||
*/
|
||||
int executeFunction(int fnum,char mess[]);
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param n number of ROIs to send
|
||||
* @param roiLimits ROI structure
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]);
|
||||
|
||||
//here one should implement the funcs listed in
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user