summaryrefslogtreecommitdiffstats
path: root/src/DetectorModule/DetectorModule.h
blob: a1c2754b5ed199df3fdd47153baf5e0ff0ef5f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright 2016 Tobias Frust
 *
 * DetectorModule.h
 *
 *  Created on: 29.06.2016
 *      Author: Tobias Frust
 */

#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();
//}

class DetectorModule {
public:
   DetectorModule(const int detectorID, const std::string& address, const std::string& configPath);

   auto sendPeriodically(unsigned int timeIntervall) -> void;

private:
   std::vector<unsigned short> buffer_;

   int detectorID_;
   UDPClient client_;

   int numberOfDetectors_;
   int numberOfPlanes_;
   int numberOfProjections_;
   int numberOfDetectorsPerModule_;
   unsigned long long numberOfFrames_;
   std::string path_, fileName_, fileEnding_;

   std::size_t index_;

   auto readConfig(const std::string& configFile) -> bool;
   auto readInput() -> void;

};

#endif