multidet to multi shm

This commit is contained in:
maliakal_d 2019-08-07 16:32:12 +02:00
parent eec7b22582
commit 21046bcae0
2 changed files with 20 additions and 10 deletions

View File

@ -15,7 +15,8 @@ class detectorData;
#include <thread>
#include <vector>
#define MULTI_SHMVERSION 0x190726
#define MULTI_SHMAPIVERSION 0x190807
#define MULTI_SHMVERSION 0x190807
#define SHORT_STRING_LENGTH 50
#define DATE_LENGTH 30
@ -46,6 +47,9 @@ struct sharedMultiSlsDetector {
/** number of sls detectors in shared memory */
int numberOfDetectors;
/** multi detector type */
slsDetectorDefs::detectorType multiDetectorType;
/** END OF FIXED PATTERN
* -----------------------------------------------*/
@ -2347,9 +2351,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
/** Multi detector Id */
const int multiId{0};
/** multi detector type */
detectorType multiDetType;
/** Shared Memory object */
sls::SharedMemory<sharedMultiSlsDetector> multi_shm{0, -1};

View File

@ -30,7 +30,7 @@
using namespace sls;
multiSlsDetector::multiSlsDetector(int multi_id, bool verify, bool update)
: multiId(multi_id), multiDetType(GENERIC), multi_shm(multi_id, -1) {
: multiId(multi_id), multi_shm(multi_id, -1) {
setupMultiDetector(verify, update);
}
@ -236,9 +236,16 @@ std::string multiSlsDetector::getUserDetails() {
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getHostname() : "Unknown") << "+";
}
sstream << "\nType: ";
// get type from multi shm
if (multi_shm()->shmversion >= MULTI_SHMAPIVERSION) {
sstream << slsDetectorDefs::detectorTypeToString(getDetectorTypeAsEnum());
}
// get type from slsdet shm
else {
for (auto &d : detectors) {
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getDetectorTypeAsString() : "Unknown") << "+";
}
}
sstream << "\nPID: " << multi_shm()->lastPID
<< "\nUser: " << multi_shm()->lastUser
@ -268,6 +275,7 @@ void multiSlsDetector::initSharedMemory(bool verify) {
void multiSlsDetector::initializeDetectorStructure() {
multi_shm()->shmversion = MULTI_SHMVERSION;
multi_shm()->numberOfDetectors = 0;
multi_shm()->multiDetectorType = GENERIC;
multi_shm()->numberOfDetector[X] = 0;
multi_shm()->numberOfDetector[Y] = 0;
multi_shm()->dataBytes = 0;
@ -465,7 +473,7 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
multi_shm()->numberOfChannels += detectors[pos]->getTotalNumberOfChannels();
detectors[pos]->setHostname(hostname);
multiDetType = getDetectorTypeAsEnum();
multi_shm()->multiDetectorType = getDetectorTypeAsEnum(-1);// -1 needed here
}
void multiSlsDetector::addSlsDetector(std::unique_ptr<slsDetector> det) {
@ -476,10 +484,11 @@ void multiSlsDetector::addSlsDetector(std::unique_ptr<slsDetector> det) {
detectors.back()->getDataBytesInclGapPixels();
multi_shm()->numberOfChannels +=
detectors.back()->getTotalNumberOfChannels();
multi_shm()->multiDetectorType = getDetectorTypeAsEnum(-1);// -1 needed here
}
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const {
return multiDetType;
return multi_shm()->multiDetectorType;
}
slsDetectorDefs::detectorType