11#include <spdlog/spdlog.h>
19 spdlog::trace(
"[WorkingImageFactory::create]: Using global backend config: {}",
static_cast<int>(backend));
29 auto it { s_registry.find(backend) };
31 if (it == s_registry.end()) {
32 spdlog::error(
"[WorkingImageFactory::create]: No creator registered for backend type {}. Unable to create working image.",
33 static_cast<int>(backend));
38 auto creator { it->second };
40 }
catch (
const std::exception& e) {
41 spdlog::critical(
"[WorkingImageFactory::create]: Exception thrown by creator for backend {}: {}",
42 static_cast<int>(backend), e.what());
52 if (s_registry.contains(type)) {
53 spdlog::warn(
"[WorkingImageFactory::registerCreator]: Overriding existing creator for backend type {}.",
static_cast<int>(type));
55 s_registry[type] = std::move(creator);
Application-wide configuration singleton.
Common::MemoryType getProcessingBackend() const noexcept
Gets the configured processing backend.
static AppConfig & instance()
Gets the singleton instance of AppConfig.
static void registerCreator(Common::MemoryType type, CreatorFunction creator)
Registers a creator function for a specific backend type.
std::function< std::unique_ptr< IWorkingImageHardware >()> CreatorFunction
Definition of a creator function.
static std::unique_ptr< IWorkingImageHardware > create()
Creates a working image using the application's global configuration.
MemoryType
Enum representing the memory type where image data is stored.
Factory for creating IWorkingImageHardware instances using a Registry Pattern.