From 16e83c0afcec0cea8af82189d4e98cd232bdf154 Mon Sep 17 00:00:00 2001 From: Tobias Frust <tobiasfrust@gmail.com> Date: Wed, 29 Jun 2016 14:49:55 +0200 Subject: created project structure --- src/DetectorModule/DetectorModule.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/DetectorModule/DetectorModule.h (limited to 'src/DetectorModule/DetectorModule.h') diff --git a/src/DetectorModule/DetectorModule.h b/src/DetectorModule/DetectorModule.h new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From 5ecc4dde3731724f28d4629f8a563f30bb260617 Mon Sep 17 00:00:00 2001 From: Tobias Frust <tobiasfrust@gmail.com> Date: Wed, 29 Jun 2016 15:22:50 +0200 Subject: added udpClient, which will later send out the packages --- src/DetectorModule/DetectorModule.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/DetectorModule/DetectorModule.h') diff --git a/src/DetectorModule/DetectorModule.h b/src/DetectorModule/DetectorModule.h index e69de29..aa63d82 100644 --- a/src/DetectorModule/DetectorModule.h +++ b/src/DetectorModule/DetectorModule.h @@ -0,0 +1,24 @@ +/* + * Copyright 2016 Tobias Frust + * + * DetectorModule.h + * + * Created on: 29.06.2016 + * Author: Tobias Frust + */ + +#ifndef DETECTORMODULE_H_ +#define DETECTORMODULE_H_ + +#include <vector> + +template <typename T> +class DetectorModule { +public: + DetectorModule(); + +private: + std::vector<std::vector<T>> buffer_; +}; + +#endif -- cgit v1.2.3 From 5680aa99001cb50c707c4187cd8ada0c41a573dd Mon Sep 17 00:00:00 2001 From: Tobias Frust <tobiasfrust@gmail.com> Date: Thu, 30 Jun 2016 10:13:01 +0200 Subject: implemented virtual DetectorModule with simple send via udp --- src/DetectorModule/DetectorModule.h | 39 +++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'src/DetectorModule/DetectorModule.h') diff --git a/src/DetectorModule/DetectorModule.h b/src/DetectorModule/DetectorModule.h index aa63d82..de259fa 100644 --- a/src/DetectorModule/DetectorModule.h +++ b/src/DetectorModule/DetectorModule.h @@ -10,15 +10,50 @@ #ifndef DETECTORMODULE_H_ #define DETECTORMODULE_H_ +#include "../UDPClient/UDPClient.h" + #include <vector> +#include <iostream> +#include <chrono> +#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> class DetectorModule { public: - DetectorModule(); + DetectorModule(const int detectorID, const std::string& address, const std::string& configPath); + + auto sendPeriodically(unsigned int timeIntervall) -> void; private: - std::vector<std::vector<T>> buffer_; + std::vector<T> buffer_; + + int detectorID_; + UDPClient client_; + + int numberOfDetectors_; + int numberOfPlanes_; + int numberOfProjections_; + int numberOfDetectorsPerModule_; + std::size_t numberOfFrames_; + std::string path_, fileName_, fileEnding_; + + std::size_t index_; + + auto readConfig(const std::string& configFile) -> bool; + auto readInput() -> void; + }; #endif -- cgit v1.2.3 From dbf28e725f062744222559257abe64d8a39a9d50 Mon Sep 17 00:00:00 2001 From: Tobias Frust <tobiasfrust@gmail.com> Date: Thu, 30 Jun 2016 10:27:20 +0200 Subject: bug fixes --- src/DetectorModule/DetectorModule.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/DetectorModule/DetectorModule.h') 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_; -- cgit v1.2.3 From 0c33319451deec9b5461b57856423bc619817245 Mon Sep 17 00:00:00 2001 From: Tobias Frust <tobiasfrust@gmail.com> Date: Thu, 30 Jun 2016 15:22:07 +0200 Subject: added classes for detector; Sending out in n different streams with n different ports --- src/DetectorModule/DetectorModule.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/DetectorModule/DetectorModule.h') diff --git a/src/DetectorModule/DetectorModule.h b/src/DetectorModule/DetectorModule.h index a1c2754..1bc36bb 100644 --- a/src/DetectorModule/DetectorModule.h +++ b/src/DetectorModule/DetectorModule.h @@ -19,16 +19,6 @@ #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(); -//} - class DetectorModule { public: DetectorModule(const int detectorID, const std::string& address, const std::string& configPath); @@ -37,6 +27,7 @@ public: private: std::vector<unsigned short> buffer_; + std::vector<char> sendBuffer_; int detectorID_; UDPClient client_; @@ -45,13 +36,14 @@ private: int numberOfPlanes_; int numberOfProjections_; int numberOfDetectorsPerModule_; - unsigned long long numberOfFrames_; + unsigned int numberOfFrames_; std::string path_, fileName_, fileEnding_; std::size_t index_; auto readConfig(const std::string& configFile) -> bool; auto readInput() -> void; + auto send() -> void; }; -- cgit v1.2.3