blob: 0ea05c9d5a505705e5804b3c5f9d7326f7e9ccbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// #include <vector>
// #include <functional>
// #include <iostream>
// #include <map>
// #include "Registry.h"
// #include "Course.h"
// #include "port/Game.h"
// template <class T> Registry<T>::Registry() {
// }
// template <class T> void Registry<T>::Add(std::string id, std::function<T*()> fn) {
// // need to handle duplicate registration
// ContentVault[id] = fn;
// }
// template <class T>
// void Registry<T>::AddArgs(std::string id) {
// ArgsVault[id] = [](Args&&... args) -> T* {
// return new T(std::forward<Args>(args)...);
// };
// }
// template <class T>
// T* Registry<T>::Get(std::string id) {
// auto it = ContentVault.find(id);
// if (it != ContentVault.end()) {
// return it->second();
// }
// return nullptr;
// }
// // Available Registries
// Registry<Course> Courses;
// Registry<Cup> Cups;
// Registry<AActor> Actors;
// void AddCourse(std::string id, Course* course) {
// Courses.Add(id, [course]() { return course; });
// course->Id = id;
// }
// void AddCup(std::string id, Cup* cup) {
// Cups.Add(id, [cup]() { return cup; });
// //cup->Id = id;
// }
// void AddActor(std::string id, AActor* actor) {
// Actors.Add(id, [actor]() { return actor; });
// }
// void AddStockContent() {
// AddActor("mk:banana", new AMarioSign({0, 0, 0}));
// }
// template class Registry<Course>;
// template class Registry<Cup>;
// template class Registry<AActor>;
|