Regular Task Execution:
Added to spec Added to config Base implementation of 2 test modules
This commit is contained in:
46
src/regularTaskExecution.cpp
Normal file
46
src/regularTaskExecution.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef REGULAR_TASK_EXECUTION_CPP
|
||||
#define REGULAR_TASK_EXECUTION_CPP
|
||||
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "utilities.cpp"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/*
|
||||
* RegularTaskExecution manager
|
||||
*/
|
||||
namespace RegularTaskExecution {
|
||||
/*
|
||||
* print test
|
||||
* todo::remove
|
||||
*/
|
||||
void reeePrint() {
|
||||
std::cout << "reeee" << std::endl;
|
||||
}
|
||||
|
||||
/*
|
||||
* print test
|
||||
* todo::remove
|
||||
*/
|
||||
void counterPrint(size_t& counter) {
|
||||
std::cout << counter << std::endl;
|
||||
counter++;
|
||||
}
|
||||
|
||||
void regularExecution(const Utilities::config& configuration) {
|
||||
std::chrono::seconds seconds(configuration.regularTaskExecutionIntervalSeconds);
|
||||
size_t counter = 0;
|
||||
while (configuration.regularTaskExecution) {
|
||||
if (configuration.regularTaskExecutionModules.at(Utilities::MODULE_NAME_REEE_PRINT))
|
||||
reeePrint(); // print test todo::remove
|
||||
if (configuration.regularTaskExecutionModules.at(Utilities::MODULE_NAME_REEE_PRINT))
|
||||
counterPrint(counter); // print test todo::remove
|
||||
|
||||
std::this_thread::sleep_for(seconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user