diff --git a/components/core/include/fggl/audio/audio.hpp b/components/core/include/fggl/audio/audio.hpp index 7ac7b39963a4f46d31793ea5c5d20133320e8560..9b5bc7fb3df91cceaa5dca39e73b896a6e80dd08 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 825983dda95bafdf5e0f0f10bb4b436294b04a96..1f9409712118d2cdb3c26ba3970c2aba6d738ef1 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 3d8442685ddf490ca74b37f0c80d7b62a28f5696..00622f0d2563f03365f797fa49dfb32a76f3c66c 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 bf77609f0b82c4e8a5853d2544f6c296aad89a71..b4454d84ac37f2a302cecd360fb57fc97b73b85b 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 3a570f0f73f1ac7f744d5127a26e584408966f42..938ffeb86c9850261c86aa1496c13f37d73b9734 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 a3353758b22512b982661824f10fd77f4be90b8f..e88faea94a89a079361a928c3be8c641d5286e3a 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 66174e0dff20f32f7213629fdb509688521f1517..8e427a337f7441ec9b36a35b2d957184afe16c68 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 089372c51b793fcd6f6f23c9ae98cec6b6883b19..f104e1758754079d0946ea2f57dd80085490ef65 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 9901cc6e1e9ced16d42eac936f121982a623509c..56394990dcc50b3b20eced7f9c8a15959ec4ae95 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 472bef8781b165df0be44e77b390a1468d6f03c6..bac2dfd16b90e3c3fe8b2582b26f8bd865f77878 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 5fbc316ee3fce3445378f9e1677cd289c933cae4..9fd83dda2b4e0541ea2dcdfdada7a906d66e8b62 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 707569e698d6efa2b11bcf1e45a97789e31792c6..4ccf1e2e099ae5b2f8786745b23f8f8a18b5cbc0 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 76f8fed867ab5bd6a6af288bd36e6a29cfc6c903..c27eeeb79802b56e82d139ff62a968d42ceb3fbd 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 37c20bc093c95b09b1dece0165756636473b90ef..6b96eacf1a19f8b4538891811d979d33e43f3113 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 0ec7cbafcd61a6f4620b86b4435a820baab710e1..3dc3060a2d762f3699febd3f091fd5e479dc7310 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 ad4d3a0d8e1cb80a1934a3f64fdcbc59e3acd2f8..49ece30729ad25e7d78a34bb0a316eea619fdf7f 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 d9cad0ee550de501a7f0ebed8b8a8745214018ce..c3520481ca35fafd72271579298dc063a207e505 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 705defe5cb87c290512015801e548388b5feb627..106b396de9e38ace8dea5a9149dbf42f9ebacd8f 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 0a80dda642fe356a9b9bd6f20c68b3bc45b8ebbe..2f8fe1e29a74bcf21ada218a22ba6b4e78bc07a2 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 0f602adc2ecd04775567d388a99ea2fc5a0f6422..0000000000000000000000000000000000000000 --- 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 541a55bf7f0ec3dbb76722049410a7731b50c477..16f435a241f1e836c8123742e5c0e1f1c73d654b 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 3567349abc1a7ad4439dbca9ff782acad2e1c097..db335a198cf95c57da243f1b069677a2d460b932 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 e99d8ed0044af78d1d2a29408a1f217580b503b8..21241c900a4fbc698675b81d442fc915da1db3b6 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"