diff options
Diffstat (limited to 'src/DetectorModule/DetectorModule.cpp')
-rw-r--r-- | src/DetectorModule/DetectorModule.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index c98a3e2..b222341 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -25,11 +25,12 @@ void timer_start(std::function<void(void)> func, unsigned int interval){ }).detach(); } -DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath) : +DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath, const int packetSize) : detectorID_{detectorID}, numberOfDetectorsPerModule_{16}, index_{1}, - client_{address, detectorID+4000} { + client_{address, detectorID+4000}, + packetSize_{packetSize} { printf("Creating %d\n", detectorID); @@ -37,12 +38,12 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, throw std::runtime_error("DetectorModule: Configuration file could not be loaded successfully. Please check!"); } - sendBuffer_.resize(numberOfDetectorsPerModule_*numberOfProjections_*sizeof(unsigned short) + sizeof(std::size_t)); + sendBuffer_.resize(packetSize); //read the input data from the file corresponding to the detectorModuleID readInput(); - unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; - std::copy(((char*)buffer_.data()), ((char*)buffer_.data())+sinoSize*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); + //unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; + //std::copy(((char*)buffer_.data()), ((char*)buffer_.data())+sinoSize*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); printf("Created %d\n", detectorID); } @@ -60,7 +61,7 @@ auto DetectorModule::send() -> void{ unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; *reinterpret_cast<int*>(sendBuffer_.data()) = index_; //std::copy(((char*)buffer_.data())+sinoSize*bufferSizeIndex*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); - client_.send(sendBuffer_.data(), sizeof(unsigned short)*sinoSize+sizeof(std::size_t)); + client_.send(sendBuffer_.data(), sendBuffer_.size()); ++index_; } |