diff options
author | Tobias Frust <tobiasfrust@gmail.com> | 2016-07-11 15:15:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-11 15:15:32 +0200 |
commit | 8af3d595e2856f81a46a91d67e96f53cb3b25d0f (patch) | |
tree | bd2cb6e80b0db90713f9d24de09577125d6f3d85 /src/Detector | |
parent | 13783f932576a285b08cf518a6b0d679aac3c897 (diff) | |
parent | 409e2fd20af5620066796e43410a92521376b2c1 (diff) | |
download | ods-8af3d595e2856f81a46a91d67e96f53cb3b25d0f.tar.gz ods-8af3d595e2856f81a46a91d67e96f53cb3b25d0f.tar.bz2 ods-8af3d595e2856f81a46a91d67e96f53cb3b25d0f.tar.xz ods-8af3d595e2856f81a46a91d67e96f53cb3b25d0f.zip |
Merge pull request #1 from tobiasfrust/master
Implemented DetectorSimulator with basic functionalities
Diffstat (limited to 'src/Detector')
-rw-r--r-- | src/Detector/Detector.cpp | 26 | ||||
-rw-r--r-- | src/Detector/Detector.h | 35 |
2 files changed, 61 insertions, 0 deletions
diff --git a/src/Detector/Detector.cpp b/src/Detector/Detector.cpp new file mode 100644 index 0000000..5dde6d1 --- /dev/null +++ b/src/Detector/Detector.cpp @@ -0,0 +1,26 @@ +/* + * Copyright 2016 Tobias Frust + * + * Detector.cpp + * + * Created on: 30.06.2016 + * Author: Tobias Frust + */ + + +#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 = 0; 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 new file mode 100644 index 0000000..1969dbd --- /dev/null +++ b/src/Detector/Detector.h @@ -0,0 +1,35 @@ +/* + * Copyright 2016 Tobias Frust + * + * Detector.h + * + * Created on: 30.06.2016 + * Author: Tobias Frust + */ + +#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_ */ |