App now uses separate add_session to insert data into it
improved the hub and spoke-ish model of App by making it more clear that its components have specific responsibilities, which App then glues together. moved timermanager to App to seperate the invoker from receiver so we can eventually add interactivity also fixed the using namespace std error from a while ago
This commit is contained in:
+4
-10
@@ -18,27 +18,21 @@
|
||||
using namespace std::chrono;
|
||||
using namespace std;
|
||||
|
||||
|
||||
vector<int> dataprovider(){
|
||||
return vector<int> {9,8,1,2,7,3,6,4,5};
|
||||
}
|
||||
|
||||
int main() {
|
||||
//create data
|
||||
vector<shared_ptr<SortInput>> inputs;
|
||||
auto myinput = make_shared<SortInput>("arr1", dataprovider());
|
||||
auto myinput2 = make_shared<SortInput>("arr2", dataprovider());
|
||||
|
||||
inputs.push_back(myinput);
|
||||
inputs.push_back(myinput2);
|
||||
|
||||
//connect data with sorter
|
||||
auto myssession = make_unique<SortSession>();
|
||||
myssession->add_session(myinput, "bsort");
|
||||
|
||||
auto myviewsession = make_unique<ViewSession>();
|
||||
|
||||
//create app with initialized dependencies
|
||||
App myapp(std::move(inputs), std::move(myssession), std::move(myviewsession));
|
||||
App myapp(std::move(myviewsession));
|
||||
//add and connect data
|
||||
myapp.setup_session(myinput, "bsort");
|
||||
//actually start the app
|
||||
myapp.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user