From 9c020fb67da06d18d0d083bd9586b3e75c484e70 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 3 May 2012 16:29:29 +0000 Subject: [PATCH] modified getDetectorType function name in slsDetector to be able to make a getDetectorType(pos) function for multiSlsDetector git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@176 951219d9-93cf-4727-9268-0efd64621fa3 --- .../multiSlsDetector/multiSlsDetector.cpp | 18 +++++++++++++++++- .../multiSlsDetector/multiSlsDetector.h | 1 + .../slsDetector/slsDetector.cpp | 2 +- slsDetectorSoftware/slsDetector/slsDetector.h | 2 +- .../slsDetector/slsDetectorCommand.cpp | 6 ++++-- .../slsDetector/slsDetectorUtils.h | 7 +++++++ 6 files changed, 31 insertions(+), 5 deletions(-) diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 549239b9b..d09d589b3 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -400,6 +400,23 @@ string multiSlsDetector::getHostname(int pos) { } + +string multiSlsDetector::getDetectorsType(int pos) { + + string s=string(""); +#ifdef VERBOSE + cout << "returning type " << pos << endl; +#endif + if (pos>=0) { + if (detectors[pos]) + return detectors[pos]->getDetectorsType(); + } else + return detectors[0]->getDetectorsType(); + return s; + +} + + int multiSlsDetector::getDetectorId(int pos) { #ifdef VERBOSE @@ -3500,4 +3517,3 @@ int multiSlsDetector::readDataFile(string fname, int *data) { return iline; } - diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index 44da43619..e46abd432 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -264,6 +264,7 @@ class multiSlsDetector : public slsDetectorUtils { string getHostname(int pos=-1); + string getDetectorsType(int pos=-1); /** adds a detector by id in position pos diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 8ad7d8b95..e0ebaf851 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -1265,7 +1265,7 @@ int slsDetector::setDetectorType(string const stype){ return setDetectorType(getDetectorType(stype)); }; -string slsDetector::getDetectorType(){ +string slsDetector::getDetectorsType(int pos){ return getDetectorType(thisDetector->myDetectorType); } diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index f328abf82..8bb7c9ce6 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -604,7 +604,7 @@ typedef struct sharedSlsDetector { normally the detector knows what type of detector it is \param type is the string where the detector type will be written ("Mythen", "Pilatus", "XFS", "Gotthard", Agipd") */ - string getDetectorType(); + string getDetectorsType(int pos=-1); // Detector configuration functions diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index ca37127c6..fef350272 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -325,6 +325,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) { descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize; i++; + /* flags */ descrToFuncMap[i].m_pFuncName="flags"; @@ -361,6 +362,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) { descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN; i++; + /* digital test and debugging */ descrToFuncMap[i].m_pFuncName="digitest"; // /* find command! */ @@ -2192,7 +2194,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) { // portType index; if (action==PUT_ACTION) { - if (cmd=="maxmod") + if (cmd=="maxmod") return string("cannot put!"); if (sscanf(args[1],"%d",&val)) @@ -2373,7 +2375,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) { if (cmd=="thisversion"){ sprintf(answer,"%llx",myDet->getId(THIS_SOFTWARE_VERSION)); return string(answer); - } + } myDet->setOnline(ONLINE_FLAG); diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h index 64a94db89..9984edce9 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -111,6 +111,13 @@ class slsDetectorUtils : public slsDetectorActions, public slsDetectorBase { virtual string setHostname(char* name, int pos=-1)=0; + /** returns the detector type + \param pos position in the multi detector structure (is -1 returns type of detector with id -1) + \returns type + */ + virtual string getDetectorsType(int pos=-1)=0; + + /** Gets the detector id (shared memory id) of an slsDetector \param i position in the multiSlsDetector structure