removed comments

This commit is contained in:
portnoytmy 2025-06-03 01:49:23 +02:00
parent e2f3584f47
commit d194d9e18d
6 changed files with 24 additions and 167 deletions

View file

@ -4,16 +4,11 @@
#include <limits>
#include <thread>
// Standardkonfiguration
constexpr size_t DEFAULT_NUM_SENSORS = 3;
constexpr size_t DEFAULT_NUM_ANALYSERS = 2;
constexpr int DEFAULT_RUN_TIME = 30; // Sekunden
constexpr int DEFAULT_RUN_TIME = 30;
constexpr size_t DEFAULT_BUFFER_SIZE = 8;
/**
* Führt die Simulation mit gegebenen Parametern aus
* @tparam N Puffergröße
*/
template<size_t N>
void run_simulation(size_t num_sensors, size_t num_analysers, int run_time) {
SensorNetwork<N> network;
@ -30,21 +25,13 @@ void run_simulation(size_t num_sensors, size_t num_analysers, int run_time) {
std::cout << "\n=== Simulation beendet ===\n";
}
/**
* Liest Benutzereingabe mit Standardwert
* @param prompt Eingabeaufforderung
* @param default_value Standardwert bei leerer Eingabe
* @return Eingegebener oder Standardwert
*/
size_t get_input(const std::string& prompt, size_t default_value) {
std::cout << prompt << " [" << default_value << "]: ";
std::string input;
std::getline(std::cin, input);
// Verwende Standardwert bei leerer Eingabe
if(input.empty()) return default_value;
// Konvertiere Eingabe
try {
return std::stoul(input);
} catch(...) {
@ -58,7 +45,6 @@ int main() {
std::cout << "=== Sensornetzwerk-Simulation ===\n"
<< "(Leere Eingabe verwendet Standardwerte)\n";
// Interaktive Konfiguration
size_t num_sensors = get_input("Anzahl Sensoren", DEFAULT_NUM_SENSORS);
size_t num_analysers = get_input("Anzahl Analysemodule", DEFAULT_NUM_ANALYSERS);
int run_time = static_cast<int>(
@ -66,7 +52,6 @@ int main() {
);
size_t buffer_size = get_input("Puffergröße", DEFAULT_BUFFER_SIZE);
// Starte Simulation basierend auf Puffergröße
switch(buffer_size) {
case 8:
run_simulation<8>(num_sensors, num_analysers, run_time);
@ -87,4 +72,4 @@ int main() {
std::cout << "Simulation erfolgreich abgeschlossen.\n";
return 0;
}
}