app now just coordinates the components initialized in main
reduced responsibilities of constructors started using more pointers. sessions through app rather than app itself. mostly split view away from app (still hard coded) haven't decoupled sorts from timers as their actuator yet
This commit is contained in:
+14
-4
@@ -1,4 +1,5 @@
|
||||
// for now juist CLI, print an arr, then print each it
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -11,6 +12,7 @@
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
#include "core/app.hpp"
|
||||
#include "sessions.hpp"
|
||||
#include "sorters.hpp"
|
||||
|
||||
using namespace std::chrono;
|
||||
@@ -22,13 +24,21 @@ vector<int> dataprovider(){
|
||||
}
|
||||
|
||||
int main() {
|
||||
vector<SortInput> inputs;
|
||||
SortInput myinput("arr1", dataprovider());
|
||||
SortInput myinput2("arr2", dataprovider());
|
||||
//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);
|
||||
|
||||
App myapp(inputs);
|
||||
//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));
|
||||
myapp.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user