aboutsummaryrefslogtreecommitdiff
path: root/src/DI/auto_wirable.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/DI/auto_wirable.hpp')
-rw-r--r--src/DI/auto_wirable.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/DI/auto_wirable.hpp b/src/DI/auto_wirable.hpp
new file mode 100644
index 0000000..13d252e
--- /dev/null
+++ b/src/DI/auto_wirable.hpp
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "DI/container.hpp"
+
+#include <memory>
+
+// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
+class IGenericAutoWirable
+{
+public:
+ virtual ~IGenericAutoWirable() = default;
+};
+
+template <class Interface>
+class IAutoWirable : public IGenericAutoWirable
+{
+public:
+ static Interface resolve();
+};
+
+template <class Interface, class ObjectImpl, class... Dependencies>
+class AutoWirable : public IAutoWirable<Interface>
+{
+public:
+ static std::shared_ptr<Interface> resolve(const Container &container);
+};
+
+#include "auto_wirable.tpp"