summaryrefslogtreecommitdiffstats
path: root/src/Detector
diff options
context:
space:
mode:
authorTobias Frust <tobiasfrust@gmail.com>2016-06-30 15:22:07 +0200
committerTobias Frust <tobiasfrust@gmail.com>2016-06-30 15:22:07 +0200
commit0c33319451deec9b5461b57856423bc619817245 (patch)
tree2d5be787fb4d4e052e72aaf01ccf095874c46f2e /src/Detector
parentdbf28e725f062744222559257abe64d8a39a9d50 (diff)
downloadods-0c33319451deec9b5461b57856423bc619817245.tar.gz
ods-0c33319451deec9b5461b57856423bc619817245.tar.bz2
ods-0c33319451deec9b5461b57856423bc619817245.tar.xz
ods-0c33319451deec9b5461b57856423bc619817245.zip
added classes for detector; Sending out in n different streams with n different ports
Diffstat (limited to 'src/Detector')
-rw-r--r--src/Detector/Detector.cpp14
-rw-r--r--src/Detector/Detector.h20
2 files changed, 34 insertions, 0 deletions
diff --git a/src/Detector/Detector.cpp b/src/Detector/Detector.cpp
index bc6c0da..658f485 100644
--- a/src/Detector/Detector.cpp
+++ b/src/Detector/Detector.cpp
@@ -8,5 +8,19 @@
*/
+#include "Detector.h"
+Detector::Detector(const std::string& address, const std::string& configPath, const unsigned int timeIntervall) :
+ timeIntervall_{timeIntervall},
+ numberOfDetectorModules_{27} {
+ modules_.reserve(numberOfDetectorModules_);
+ for(auto i = 1; i <= numberOfDetectorModules_; i++){
+ modules_.emplace_back(i, address, configPath);
+ }
+}
+
+auto Detector::run() -> void {
+ for(auto i = 0; i < numberOfDetectorModules_; i++)
+ modules_[i].sendPeriodically(timeIntervall_);
+}
diff --git a/src/Detector/Detector.h b/src/Detector/Detector.h
index 17acb8d..1969dbd 100644
--- a/src/Detector/Detector.h
+++ b/src/Detector/Detector.h
@@ -10,6 +10,26 @@
#ifndef DETECTOR_H_
#define DETECTOR_H_
+#include "../DetectorModule/DetectorModule.h"
+#include <vector>
+#include <thread>
+
+class Detector {
+public:
+ Detector(const std::string& address, const std::string& configPath, const unsigned int timeIntervall);
+
+ auto run() -> void;
+private:
+ std::vector<DetectorModule> modules_;
+
+ std::vector<std::thread> moduleThreads_;
+
+ unsigned int timeIntervall_;
+ int numberOfDetectorModules_;
+
+ auto readConfig(const std::string& configFile) -> bool;
+
+};
#endif /* DETECTOR_H_ */