10#include <spdlog/spdlog.h>
17 spdlog::debug(
"OperationStateManager: Constructed.");
22 std::lock_guard lock(m_mutex);
23 spdlog::debug(
"OperationStateManager::addOrUpdateOperation: Adding/updating operation '{}'.", descriptor.
name);
26 auto it = std::find_if(m_active_operations.begin(), m_active_operations.end(),
27 [&descriptor](
const auto& op) { return op.type == descriptor.type; });
29 if (it != m_active_operations.end()) {
32 spdlog::debug(
"OperationStateManager::addOrUpdateOperation: Updated operation '{}'.", descriptor.
name);
35 m_active_operations.push_back(descriptor);
36 spdlog::debug(
"OperationStateManager::addOrUpdateOperation: Added new operation '{}'.", descriptor.
name);
42 std::lock_guard lock(m_mutex);
43 spdlog::debug(
"OperationStateManager::removeOperation: Removing operation type '{}'.",
static_cast<int>(type));
46 m_active_operations.erase(
47 std::remove_if(m_active_operations.begin(), m_active_operations.end(),
48 [type](
const auto& op) { return op.type == type; }),
49 m_active_operations.end()
52 spdlog::debug(
"OperationStateManager::removeOperation: Operation type '{}' removed (if it existed).",
static_cast<int>(type));
59 std::lock_guard lock(m_mutex);
60 spdlog::debug(
"OperationStateManager::clearAllOperations: Clearing all operations.");
62 m_active_operations.clear();
63 spdlog::debug(
"OperationStateManager::clearAllOperations: All operations cleared.");
68 std::lock_guard lock(m_mutex);
70 return m_active_operations;
void clearAllOperations()
Clears all active operations, resetting the state to the original image.
void addOrUpdateOperation(const Core::Operations::OperationDescriptor &descriptor)
Adds or updates an operation in the active state.
OperationStateManager()
Constructs an OperationStateManager.
std::vector< Core::Operations::OperationDescriptor > getActiveOperations() const
Gets the current list of active operation descriptors.
void removeOperation(Core::Operations::OperationType type)
Removes an operation of a specific type from the active state.
Manages the state of active image operations.
OperationType
Identifies the type of an image processing operation.
Descriptor of an operation with its parameters and unique identifier.
A universal container for operation settings with unique identifier.
std::string name
Human-readable name for display purposes. May include parameter values, e.g., "Brightness (100%)".