cleanup, timermanager in App is a dependency that takes timers again.

App now adds already constructed Timers
Timer is now an Invoker that takes a weak_ptr to a steppable with a
request()rather than a bool callback.
should eventually be changed to composition
This commit is contained in:
2026-08-23 23:25:04 +02:00
parent 54faab2a28
commit 273ff07a00
10 changed files with 74 additions and 68 deletions
+9 -3
View File
@@ -14,6 +14,7 @@
#include "core/app.hpp"
#include "sessions.hpp"
#include "sorters.hpp"
#include "timer.hpp"
using namespace std::chrono;
using namespace std;
@@ -28,11 +29,16 @@ int main() {
auto myinput2 = make_shared<SortInput>("arr2", dataprovider());
auto myviewsession = make_unique<ViewSession>();
auto mytimermanager = make_unique<TimerManager>();
//create app with initialized dependencies
App myapp(std::move(myviewsession));
App myapp(std::move(myviewsession),std::move(mytimermanager));
//add and connect data
myapp.setup_session(myinput, "bsort");
Timer timer(0, chrono::milliseconds(250));
myapp.timermanager->timers.push_back(timer);
myapp.add_sort(myinput, "bsort", myapp.timermanager->timers.back());
//actually start the app
myapp.run();
}