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:
+9
-3
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user