plugify 1.2.8
Loading...
Searching...
No Matches
manager.hpp
1#pragma once
2
3#include "plugify/extension.hpp"
4#include "plugify/global.h"
5#include "plugify/types.hpp"
6
7namespace plugify {
8 struct Config;
9 class Extension;
10 class ServiceLocator;
11
12 class PLUGIFY_API Manager {
13 public:
14 explicit Manager(const ServiceLocator& services, const Config& config);
15 ~Manager();
16 Manager(const Manager& other) = delete;
17 Manager(Manager&& other) noexcept = delete;
18 Manager& operator=(const Manager& other) = delete;
19 Manager& operator=(Manager&& other) noexcept = delete;
20
21 // Lifecycle
22 Result<void> Initialize() const;
23 [[nodiscard]] bool IsInitialized() const;
24 void Update(std::chrono::milliseconds deltaTime) const;
25 void Terminate() const;
26
27 // Extension operations
28 // Result<ExtensionRef> LoadExtension(const std::filesystem::path& path);
29 // Result<void> UnloadExtension(std::string_view name);
30 // Result<void> ReloadExtension(std::string_view name);
31 // Result<void> EnableExtension(std::string_view name);
32 // Result<void> DisableExtension(std::string_view name);
33
34 // Query operations
35 [[nodiscard]] bool
36 IsExtensionLoaded(std::string_view name, std::optional<Constraint> constraint = {}) const noexcept;
37 [[nodiscard]] const Extension* FindExtension(std::string_view name) const noexcept;
38 [[nodiscard]] const Extension* FindExtension(UniqueId id) const noexcept;
39 [[nodiscard]] std::vector<const Extension*> GetExtensions() const;
40 [[nodiscard]] std::vector<const Extension*> GetExtensionsByState(ExtensionState state) const;
41 [[nodiscard]] std::vector<const Extension*> GetExtensionsByType(ExtensionType type) const;
42
43 // Dump operations
44 [[nodiscard]] std::string GenerateLoadOrder() const;
45 [[nodiscard]] std::string GenerateDependencyGraph() const;
46 [[nodiscard]] std::string GenerateDependencyGraphDOT() const;
47
48 [[nodiscard]] bool operator==(const Manager& other) const noexcept;
49 [[nodiscard]] auto operator<=>(const Manager& other) const noexcept;
50
51 private:
52 struct Impl;
53 PLUGIFY_NO_DLL_EXPORT_WARNING(std::unique_ptr<Impl> _impl;)
54 };
55}
DI Container / Service Locator with PIMPL.