diff options
Diffstat (limited to 'src/DetectorModule')
-rw-r--r-- | src/DetectorModule/DetectorModule.cpp | 16 | ||||
-rw-r--r-- | src/DetectorModule/DetectorModule.h | 25 |
2 files changed, 18 insertions, 23 deletions
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 <exception> #include <fstream> -template<typename T> -DetectorModule<T>::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<T>::DetectorModule(const int detectorID, const std::string& addre readInput(); } -template <typename T> -auto DetectorModule<T>::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 <typename T> -auto DetectorModule<T>::readInput() -> void { +auto DetectorModule::readInput() -> void { if(path_.back() != '/') path_.append("/"); //open file @@ -44,12 +41,11 @@ auto DetectorModule<T>::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<typename T> -auto DetectorModule<T>::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 <thread> #include <functional> -void timer_start(std::function<void(void)> func, unsigned int interval){ - std::thread([func, interval]() { - while (true) - { - func(); - std::this_thread::sleep_for(std::chrono::milliseconds(interval)); - } - }).detach(); -} - -template <typename T> +//void timer_start(std::function<void(void)> 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<T> buffer_; + std::vector<unsigned short> 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_; |