CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
operation_factory.cpp
Go to the documentation of this file.
1
11#include <spdlog/spdlog.h>
12
14
15 std::expected<std::unique_ptr<IOperation>, ErrorHandling::CoreError> OperationFactory::create(
16 const OperationDescriptor& descriptor
17) const {
18
19 spdlog::info("OperationFactory::create: Available creators size: {}", m_creators.size());
20
21 auto it = m_creators.find(descriptor.type);
22
23 if (it == m_creators.end()) {
24 spdlog::error("OperationFactory::create: No creator registered for operation type");
25 return nullptr;
26 }
27
28 spdlog::info("OperationFactory::create: Creating operation '{}'", descriptor.name);
29 auto op = it->second();
30 spdlog::info("OperationFactory::create: Operation created successfully");
31 return op;
32}
33
34} // namespace CaptureMoment::Core::Operations
std::expected< std::unique_ptr< IOperation >, ErrorHandling::CoreError > create(const OperationDescriptor &descriptor) const
Create an operation instance from descriptor.
Interface for image processing operations.
CoreError
Enumeration of all error codes for CaptureMoment Core.
Definition core_error.h:36
Descriptor of an operation with its parameters and unique identifier.
Factory for creating operations (Dependency Injection)
A universal container for operation settings with unique identifier.
OperationType type
The operation type (e.g., Brightness, Contrast, Saturation). Used by the factory to create the approp...
std::string name
Human-readable name for display purposes. May include parameter values, e.g., "Brightness (100%)".
CaptureMoment — footer