From dbf28e725f062744222559257abe64d8a39a9d50 Mon Sep 17 00:00:00 2001 From: Tobias Frust Date: Thu, 30 Jun 2016 10:27:20 +0200 Subject: bug fixes --- src/DetectorModule/DetectorModule.cpp | 16 ++++++---------- src/DetectorModule/DetectorModule.h | 25 ++++++++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-) (limited to 'src/DetectorModule') diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index f0c1a06..d2c8298 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -13,8 +13,7 @@ #include #include -template -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) : detectorID_{detectorID}, numberOfDetectorsPerModule_{16}, index_{0}, @@ -28,13 +27,11 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& addre readInput(); } -template -auto DetectorModule::sendPeriodically(unsigned int timeIntervall) -> void { - client_.send(buffer_.data(), sizeof(T)*numberOfDetectorsPerModule_*numberOfProjections_); +auto DetectorModule::sendPeriodically(unsigned int timeIntervall) -> void { + client_.send((char*)buffer_.data(), sizeof(unsigned short)*numberOfDetectorsPerModule_*numberOfProjections_); } -template -auto DetectorModule::readInput() -> void { +auto DetectorModule::readInput() -> void { if(path_.back() != '/') path_.append("/"); //open file @@ -44,12 +41,11 @@ auto DetectorModule::readInput() -> void { input.seekg(0, std::ios::end); fileSize = input.tellg(); input.seekg(0, std::ios::beg); - buffer_.resize(fileSize / sizeof(T)); + buffer_.resize(fileSize / sizeof(unsigned short)); input.read((char*) &buffer_[0], fileSize); } -template -auto DetectorModule::readConfig(const std::string& configFile) -> bool { +auto DetectorModule::readConfig(const std::string& configFile) -> bool { ConfigReader configReader = ConfigReader(configFile.data()); int samplingRate, scanRate; if (configReader.lookupValue("numberOfFanDetectors", numberOfDetectors_) diff --git a/src/DetectorModule/DetectorModule.h b/src/DetectorModule/DetectorModule.h index de259fa..a1c2754 100644 --- a/src/DetectorModule/DetectorModule.h +++ b/src/DetectorModule/DetectorModule.h @@ -19,17 +19,16 @@ #include #include -void timer_start(std::function func, unsigned int interval){ - std::thread([func, interval]() { - while (true) - { - func(); - std::this_thread::sleep_for(std::chrono::milliseconds(interval)); - } - }).detach(); -} - -template +//void timer_start(std::function func, unsigned int interval){ +// std::thread([func, interval]() { +// while (true) +// { +// func(); +// std::this_thread::sleep_for(std::chrono::milliseconds(interval)); +// } +// }).detach(); +//} + class DetectorModule { public: DetectorModule(const int detectorID, const std::string& address, const std::string& configPath); @@ -37,7 +36,7 @@ public: auto sendPeriodically(unsigned int timeIntervall) -> void; private: - std::vector buffer_; + std::vector buffer_; int detectorID_; UDPClient client_; @@ -46,7 +45,7 @@ private: int numberOfPlanes_; int numberOfProjections_; int numberOfDetectorsPerModule_; - std::size_t numberOfFrames_; + unsigned long long numberOfFrames_; std::string path_, fileName_, fileEnding_; std::size_t index_; -- cgit v1.2.3