From fcdb0b6e3e8d6754afac942f8aececad32b57409 Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Wed, 12 Jul 2023 23:15:16 +0100
Subject: [PATCH] remove old module header

---
 components/core/include/fggl/audio/audio.hpp  | 15 +++-
 .../core/include/fggl/services/registry.hpp   |  1 -
 fggl/gfx/ogl4/module.cpp                      |  2 +-
 fggl/modules/manager.cpp                      |  2 +-
 include/fggl/assets/manager.hpp               |  2 +-
 include/fggl/assets/module.hpp                |  1 -
 include/fggl/assets/packed/direct.hpp         |  2 +-
 include/fggl/assets/packed/module.hpp         |  2 -
 include/fggl/data/assimp/module.hpp           |  1 -
 include/fggl/display/window.hpp               |  2 +-
 include/fggl/entity/loader/loader.hpp         |  2 +-
 include/fggl/entity/module.hpp                |  1 -
 include/fggl/gfx/interfaces.hpp               |  2 +-
 include/fggl/gfx/ogl4/module.hpp              |  2 +-
 include/fggl/gui/fonts.hpp                    |  2 +-
 include/fggl/gui/model/parser.hpp             |  1 -
 include/fggl/input/input.hpp                  |  2 +-
 include/fggl/input/module.hpp                 |  1 -
 include/fggl/modules/manager.hpp              |  5 +-
 include/fggl/modules/module.hpp               | 69 -------------------
 include/fggl/phys/service.hpp                 |  2 +-
 include/fggl/script/engine.hpp                |  2 +-
 .../lua/include/fggl/script/lua/module.hpp    |  1 -
 23 files changed, 28 insertions(+), 94 deletions(-)
 delete mode 100644 include/fggl/modules/module.hpp

diff --git a/components/core/include/fggl/audio/audio.hpp b/components/core/include/fggl/audio/audio.hpp
index 7ac7b39..9b5bc7f 100644
--- a/components/core/include/fggl/audio/audio.hpp
+++ b/components/core/include/fggl/audio/audio.hpp
@@ -12,13 +12,26 @@
  * If not, see <https://www.gnu.org/licenses/>.
  */
 
+/*
+ * This file is part of FGGL.
+ *
+ * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with FGGL.
+ * If not, see <https://www.gnu.org/licenses/>.
+ */
+
 #ifndef FGGL_AUDIO_AUDIO_HPP
 #define FGGL_AUDIO_AUDIO_HPP
 
 #include <string>
 
 #include "fggl/data/storage.hpp"
-#include "fggl/modules/module.hpp"
 	#include "fggl/services/module.hpp"
 #include "fggl/assets/module.hpp"
 #include "fggl/assets/packed/module.hpp"
diff --git a/components/core/include/fggl/services/registry.hpp b/components/core/include/fggl/services/registry.hpp
index 825983d..1f94097 100644
--- a/components/core/include/fggl/services/registry.hpp
+++ b/components/core/include/fggl/services/registry.hpp
@@ -26,7 +26,6 @@
 
 namespace fggl::services {
 
-
 	template<typename T, typename U>
 	concept Subclass = std::is_base_of<U, T>::value;
 
diff --git a/fggl/gfx/ogl4/module.cpp b/fggl/gfx/ogl4/module.cpp
index 3d84426..00622f0 100644
--- a/fggl/gfx/ogl4/module.cpp
+++ b/fggl/gfx/ogl4/module.cpp
@@ -143,7 +143,7 @@ namespace fggl::gfx {
 	void attach_material(const entity::ComponentSpec &spec,
 						 entity::EntityManager &manager,
 						 const entity::EntityID &id,
-						 modules::Services* /*services*/ ) {
+						 services::Generator* /*services*/ ) {
 		auto &mat = manager.add<gfx::PhongMaterial>(id);
 		mat.ambient = spec.get<math::vec3>("ambient", gfx::DEFAULT_AMBIENT);
 		mat.diffuse = spec.get<math::vec3>("diffuse", gfx::DEFAULT_DIFFUSE);
diff --git a/fggl/modules/manager.cpp b/fggl/modules/manager.cpp
index bf77609..b4454d8 100644
--- a/fggl/modules/manager.cpp
+++ b/fggl/modules/manager.cpp
@@ -59,7 +59,7 @@ namespace fggl::modules {
 			return false;
 		}
 
-		std::queue<ModuleIdentifier> stack;
+		std::queue<services::ModuleID> stack;
 		m_dependencies.getOrderRev(stack);
 
 		services::ModuleBinder binder(&m_services);
diff --git a/include/fggl/assets/manager.hpp b/include/fggl/assets/manager.hpp
index 3a570f0..938ffeb 100644
--- a/include/fggl/assets/manager.hpp
+++ b/include/fggl/assets/manager.hpp
@@ -28,7 +28,7 @@
 #include "fggl/debug/logging.hpp"
 #include "fggl/assets/types.hpp"
 #include "fggl/util/safety.hpp"
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 
 namespace fggl::assets {
 
diff --git a/include/fggl/assets/module.hpp b/include/fggl/assets/module.hpp
index a335375..e88faea 100644
--- a/include/fggl/assets/module.hpp
+++ b/include/fggl/assets/module.hpp
@@ -19,7 +19,6 @@
 #ifndef FGGL_ASSETS_MODULE_HPP
 #define FGGL_ASSETS_MODULE_HPP
 
-#include "fggl/modules/module.hpp"
 #include "fggl/services/module.hpp"
 
 #include "fggl/assets/packed/module.hpp"
diff --git a/include/fggl/assets/packed/direct.hpp b/include/fggl/assets/packed/direct.hpp
index 66174e0..8e427a3 100644
--- a/include/fggl/assets/packed/direct.hpp
+++ b/include/fggl/assets/packed/direct.hpp
@@ -25,7 +25,7 @@
 #include "fggl/assets/types.hpp"
 #include "fggl/util/safety.hpp"
 #include "fggl/util/guid.hpp"
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 
 /**
  * Raw Checkin.
diff --git a/include/fggl/assets/packed/module.hpp b/include/fggl/assets/packed/module.hpp
index 089372c..f104e17 100644
--- a/include/fggl/assets/packed/module.hpp
+++ b/include/fggl/assets/packed/module.hpp
@@ -19,11 +19,9 @@
 #ifndef FGGL_ASSETS_PACKED_MODULE_HPP
 #define FGGL_ASSETS_PACKED_MODULE_HPP
 
-#include "fggl/modules/module.hpp"
 #include "fggl/services/module.hpp"
 
 #include "fggl/assets/loader.hpp"
-
 #include "fggl/assets/packed/adapter.hpp"
 #include "fggl/assets/packed/direct.hpp"
 
diff --git a/include/fggl/data/assimp/module.hpp b/include/fggl/data/assimp/module.hpp
index 9901cc6..5639499 100644
--- a/include/fggl/data/assimp/module.hpp
+++ b/include/fggl/data/assimp/module.hpp
@@ -19,7 +19,6 @@
 #ifndef FGGL_DATA_ASSIMP_MODULE_HPP
 #define FGGL_DATA_ASSIMP_MODULE_HPP
 
-	#include "fggl/modules/module.hpp"
 	#include "fggl/services/module.hpp"
 
 	#include "fggl/assets/loader.hpp"
diff --git a/include/fggl/display/window.hpp b/include/fggl/display/window.hpp
index 472bef8..bac2dfd 100644
--- a/include/fggl/display/window.hpp
+++ b/include/fggl/display/window.hpp
@@ -19,7 +19,7 @@
 #ifndef FGGL_DISPLAY_WINDOW_HPP
 #define FGGL_DISPLAY_WINDOW_HPP
 
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 #include "fggl/math/types.hpp"
 
 #include "fggl/gfx/interfaces.hpp"
diff --git a/include/fggl/entity/loader/loader.hpp b/include/fggl/entity/loader/loader.hpp
index 5fbc316..9fd83dd 100644
--- a/include/fggl/entity/loader/loader.hpp
+++ b/include/fggl/entity/loader/loader.hpp
@@ -24,7 +24,7 @@
 #include <utility>
 
 #include "fggl/util/guid.hpp"
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 #include "fggl/entity/entity.hpp"
 #include "fggl/entity/loader/spec.hpp"
 #include "fggl/assets/loader.hpp"
diff --git a/include/fggl/entity/module.hpp b/include/fggl/entity/module.hpp
index 707569e..4ccf1e2 100644
--- a/include/fggl/entity/module.hpp
+++ b/include/fggl/entity/module.hpp
@@ -19,7 +19,6 @@
 #ifndef FGGL_ENTITY_MODULE_HPP
 #define FGGL_ENTITY_MODULE_HPP
 
-#include "fggl/modules/module.hpp"
 #include "fggl/services/module.hpp"
 
 #include "fggl/assets/module.hpp"
diff --git a/include/fggl/gfx/interfaces.hpp b/include/fggl/gfx/interfaces.hpp
index 76f8fed..c27eeeb 100644
--- a/include/fggl/gfx/interfaces.hpp
+++ b/include/fggl/gfx/interfaces.hpp
@@ -21,7 +21,7 @@
 
 #include "fggl/gfx/paint.hpp"
 #include "fggl/entity/entity.hpp"
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 
 //! Classes responsible for rendering content
 namespace fggl::gfx {
diff --git a/include/fggl/gfx/ogl4/module.hpp b/include/fggl/gfx/ogl4/module.hpp
index 37c20bc..6b96eac 100644
--- a/include/fggl/gfx/ogl4/module.hpp
+++ b/include/fggl/gfx/ogl4/module.hpp
@@ -21,7 +21,7 @@
 
 #include <array>
 
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 
 #include "fggl/assets/manager.hpp"
 #include "fggl/assets/packed/module.hpp"
diff --git a/include/fggl/gui/fonts.hpp b/include/fggl/gui/fonts.hpp
index 0ec7cba..3dc3060 100644
--- a/include/fggl/gui/fonts.hpp
+++ b/include/fggl/gui/fonts.hpp
@@ -25,7 +25,7 @@
 
 #include "fggl/math/types.hpp"
 #include "fggl/data/storage.hpp"
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 #include "fggl/filesystem/Finder.hpp"
 
 #include <ft2build.h>
diff --git a/include/fggl/gui/model/parser.hpp b/include/fggl/gui/model/parser.hpp
index ad4d3a0..49ece30 100644
--- a/include/fggl/gui/model/parser.hpp
+++ b/include/fggl/gui/model/parser.hpp
@@ -21,7 +21,6 @@
 
 #include <fggl/gui/model/structure.hpp>
 #include <fggl/gui/fonts.hpp>
-#include <fggl/modules/module.hpp>
 
 namespace fggl::gui::model {
 
diff --git a/include/fggl/input/input.hpp b/include/fggl/input/input.hpp
index d9cad0e..c352048 100644
--- a/include/fggl/input/input.hpp
+++ b/include/fggl/input/input.hpp
@@ -20,7 +20,7 @@
 #include <fggl/input/mouse.hpp>
 #include <fggl/input/gamepad.hpp>
 
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 
 namespace fggl::input {
 
diff --git a/include/fggl/input/module.hpp b/include/fggl/input/module.hpp
index 705defe..106b396 100644
--- a/include/fggl/input/module.hpp
+++ b/include/fggl/input/module.hpp
@@ -20,7 +20,6 @@
 #define FGGL_INPUT_MODULE_HPP
 
 #include <array>
-#include "fggl/modules/module.hpp"
 #include "fggl/services/module.hpp"
 #include "fggl/input/input.hpp"
 
diff --git a/include/fggl/modules/manager.hpp b/include/fggl/modules/manager.hpp
index 0a80dda..2f8fe1e 100644
--- a/include/fggl/modules/manager.hpp
+++ b/include/fggl/modules/manager.hpp
@@ -19,7 +19,6 @@
 #ifndef FGGL_MODULES_MANAGER_HPP
 #define FGGL_MODULES_MANAGER_HPP
 
-#include "fggl/modules/module.hpp"
 #include "fggl/debug/logging.hpp"
 #include "fggl/util/graph.hpp"
 
@@ -60,7 +59,7 @@ namespace fggl::modules {
 				depend(modulePtr);
 			}
 
-			inline void depend(const std::shared_ptr<services::Module>& modulePtr) {
+			inline void depend(std::shared_ptr<services::Module>&& modulePtr) {
 				assert(!m_locked);
 				m_modules[modulePtr->getName()] = modulePtr;
 				for ( auto& provided : modulePtr->getProvides() ) {
@@ -91,7 +90,7 @@ namespace fggl::modules {
 			services::Generator m_services;
 			std::map<services::ModuleID, std::shared_ptr<services::Module> > m_modules;
 
-			ds::DirectedGraph<ModuleIdentifier> m_dependencies;
+			ds::DirectedGraph<services::ModuleID> m_dependencies;
 			std::map<services::ModuleID, services::ModuleID> m_serviceProviders;
 
 			bool buildGraph();
diff --git a/include/fggl/modules/module.hpp b/include/fggl/modules/module.hpp
deleted file mode 100644
index 0f602ad..0000000
--- a/include/fggl/modules/module.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * This file is part of FGGL.
- *
- * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
- *
- * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with FGGL.
- * If not, see <https://www.gnu.org/licenses/>.
- */
-
-//
-// Created by webpigeon on 27/06/22.
-//
-
-#ifndef FGGL_MODULES_MODULE_HPP
-#define FGGL_MODULES_MODULE_HPP
-
-#include <string>
-#include <vector>
-#include <functional>
-#include <map>
-#include <memory>
-
-#include "fggl/util/safety.hpp"
-#include "service.hpp"
-#include "fggl/services/module.hpp"
-
-namespace fggl::modules {
-
-	template<typename T>
-	concept ModuleType = requires(T type) {
-		{ T::services };
-		{ T::provides };
-		{ T::depends };
-	};
-
-	using ModuleIdentifier = services::ModuleID;
-	using ServiceName = services::ServiceName;
-
-	using ServiceFactory = std::function<bool(ServiceName , Services &)>;
-	struct Config {
-		ModuleIdentifier name;
-		std::vector<ServiceName> provides;
-		std::vector<ServiceName> depends;
-		ServiceFactory factory = nullptr;
-	};
-
-	class Module {
-		public:
-			virtual ~Module() = default;
-
-			// copying modules is bad
-			Module(const Module&) = delete;
-			Module& operator=(const Module&) = delete;
-
-			// moving modules is bad
-			Module(Module&&) = delete;
-			Module& operator=(Module&&) = delete;
-
-			virtual auto create(ServiceName, Services&) -> bool = 0;
-	};
-
-} // namespace fggl::modules
-
-#endif //FGGL_MODULES_MODULE_HPP
diff --git a/include/fggl/phys/service.hpp b/include/fggl/phys/service.hpp
index 541a55b..16f435a 100644
--- a/include/fggl/phys/service.hpp
+++ b/include/fggl/phys/service.hpp
@@ -19,7 +19,7 @@
 #ifndef FGGL_PHYS_SERVICE_HPP
 #define FGGL_PHYS_SERVICE_HPP
 
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 #include "fggl/entity/module.hpp"
 #include "fggl/phys/types.hpp"
 
diff --git a/include/fggl/script/engine.hpp b/include/fggl/script/engine.hpp
index 3567349..db335a1 100644
--- a/include/fggl/script/engine.hpp
+++ b/include/fggl/script/engine.hpp
@@ -19,7 +19,7 @@
 #ifndef FGGL_SCRIPT_ENGINE_H
 #define FGGL_SCRIPT_ENGINE_H
 
-#include "fggl/modules/module.hpp"
+#include "fggl/services/module.hpp"
 
 namespace fggl::script {
 
diff --git a/integrations/lua/include/fggl/script/lua/module.hpp b/integrations/lua/include/fggl/script/lua/module.hpp
index e99d8ed..21241c9 100644
--- a/integrations/lua/include/fggl/script/lua/module.hpp
+++ b/integrations/lua/include/fggl/script/lua/module.hpp
@@ -21,7 +21,6 @@
 
 	#define FGGL_HAS_LUA
 
-	#include "fggl/modules/module.hpp"
 	#include "fggl/services/module.hpp"
 
 	#include "fggl/entity/module.hpp"
-- 
GitLab