diff options
author | Frust, Tobias (FWCC) - 111645 <t.frust@hzdr.de> | 2017-11-03 08:46:48 +0100 |
---|---|---|
committer | Frust, Tobias (FWCC) - 111645 <t.frust@hzdr.de> | 2017-11-03 08:46:48 +0100 |
commit | fa7a8dac30087d63e0c99b46ed6b0370d86304a8 (patch) | |
tree | 793dba3b90b233a89394240bdb12073364bcef33 | |
parent | 1f6a370a7e177265eeffc971dbe4934ebf62d02b (diff) | |
download | ods-fa7a8dac30087d63e0c99b46ed6b0370d86304a8.tar.gz ods-fa7a8dac30087d63e0c99b46ed6b0370d86304a8.tar.bz2 ods-fa7a8dac30087d63e0c99b46ed6b0370d86304a8.tar.xz ods-fa7a8dac30087d63e0c99b46ed6b0370d86304a8.zip |
bug fixes
-rw-r--r-- | src/Detector/Detector.cpp | 4 | ||||
-rw-r--r-- | src/Detector/Detector.h | 2 | ||||
-rw-r--r-- | src/DetectorModule/DetectorModule.cpp | 9 | ||||
-rw-r--r-- | src/DetectorModule/DetectorModule.h | 4 | ||||
-rw-r--r-- | src/main_client.cpp | 9 | ||||
-rw-r--r-- | src/main_server.cpp | 8 |
6 files changed, 19 insertions, 17 deletions
diff --git a/src/Detector/Detector.cpp b/src/Detector/Detector.cpp index 03abffe..5dde6d1 100644 --- a/src/Detector/Detector.cpp +++ b/src/Detector/Detector.cpp @@ -10,12 +10,12 @@ #include "Detector.h" -Detector::Detector(const std::string& address, const std::string& configPath, const unsigned int timeIntervall, const int packetSize) : +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, packetSize); + modules_.emplace_back(i, address, configPath); } } diff --git a/src/Detector/Detector.h b/src/Detector/Detector.h index 16f946a..1969dbd 100644 --- a/src/Detector/Detector.h +++ b/src/Detector/Detector.h @@ -17,7 +17,7 @@ class Detector { public: - Detector(const std::string& address, const std::string& configPath, const unsigned int timeIntervall, const int packetSize); + Detector(const std::string& address, const std::string& configPath, const unsigned int timeIntervall); auto run() -> void; private: diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index 8193a03..169c5a5 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -25,12 +25,11 @@ void timer_start(std::function<void(void)> func, unsigned int interval){ }).detach(); } -DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath, const int packetSize) : +DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath) : detectorID_{detectorID}, numberOfDetectorsPerModule_{16}, index_{0u}, - client_{address, detectorID+4000}, - packetSize_{packetSize} { + client_{address, detectorID+4000}{ printf("Creating %d\n", detectorID); @@ -38,7 +37,7 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, throw std::runtime_error("DetectorModule: Configuration file could not be loaded successfully. Please check!"); } - sendBuffer_.resize(numberOfProjectionsPerPacket_*numberOfDetectorsPerModule_+sizeof(std::size_t)+sizeof(unsigned short)); + sendBuffer_.resize(numberOfProjectionsPerPacket_*numberOfDetectorsPerModule_*sizeof(unsigned short)+sizeof(std::size_t)); //read the input data from the file corresponding to the detectorModuleID readInput(); @@ -109,7 +108,7 @@ auto DetectorModule::readConfig(const std::string& configFile) -> bool { && configReader.lookupValue("scanRate", scanRate) && configReader.lookupValue("numberOfDataFrames", numberOfFrames_) && configReader.lookupValue("numberOfProjectionsPerPacket", numberOfProjectionsPerPacket_) - && configReader.lookupValue("numberOfDetectorsPerModule", numberOfProjectionsPerPacket_)) { + && configReader.lookupValue("numberOfDetectorsPerModule", numberOfDetectorsPerModule_)) { numberOfProjections_ = samplingRate * 1000000 / scanRate; return EXIT_SUCCESS; } diff --git a/src/DetectorModule/DetectorModule.h b/src/DetectorModule/DetectorModule.h index 3ca5f23..afe4d04 100644 --- a/src/DetectorModule/DetectorModule.h +++ b/src/DetectorModule/DetectorModule.h @@ -21,7 +21,7 @@ class DetectorModule { public: - DetectorModule(const int detectorID, const std::string& address, const std::string& configPath, const int packetSize); + DetectorModule(const int detectorID, const std::string& address, const std::string& configPath); auto sendPeriodically(unsigned int timeIntervall) -> void; @@ -32,8 +32,6 @@ private: int detectorID_; UDPClient client_; - int packetSize_; - int numberOfDetectors_; int numberOfPlanes_; int numberOfProjections_; diff --git a/src/main_client.cpp b/src/main_client.cpp index e97e911..38c065d 100644 --- a/src/main_client.cpp +++ b/src/main_client.cpp @@ -20,13 +20,13 @@ void initLog() { int main (int argc, char *argv[]){ if(argc < 3){ - BOOST_LOG_TRIVIAL(error) << "Program usage: ./onlineDetectorSimulatorClient <images_per_second> <packet_size_in_byte>!"; + BOOST_LOG_TRIVIAL(error) << "Program usage: ./onlineDetectorSimulatorClient <images_per_second> <address>!"; return 0; } int imagesPerSec = std::stoi(argv[1]); - int packetSize = std::stoi(argv[2]); + std::string address = argv[2]; double timegap = 1./(double)imagesPerSec; unsigned int intervall = timegap*1000*1000; @@ -36,9 +36,8 @@ int main (int argc, char *argv[]){ std::cout << "Sending UDP packages: " << std::endl; auto configPath = std::string { "config.cfg" }; - std::string address = "10.0.0.10"; - - Detector detector{address, configPath, intervall, packetSize}; + + Detector detector{address, configPath, intervall}; //DetectorModule detModule0 = DetectorModule(1, address, configPath); diff --git a/src/main_server.cpp b/src/main_server.cpp index 90b3835..cd84cb9 100644 --- a/src/main_server.cpp +++ b/src/main_server.cpp @@ -30,7 +30,13 @@ int main (int argc, char *argv[]){ initLog(); - std::string address = "localhost"; + if(argc < 2){ + BOOST_LOG_TRIVIAL(error) << "Program usage: ./onlineDetectorSimulatorServer <address>!"; + return 0; + } + + std::string address = argv[1]; + // int port = 4002; // // UDPServer server = UDPServer(address, port); |