43 Auto PEAK_AFL_DEPRECATED_ENUM_ATTR,
69 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
77 return "HillClimbing";
79 return "GlobalSearch";
83 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
117PEAK_COMMON_NO_DISCARD
inline FocusSearchAlgorithm ToFocusSearchAlgorithm(
const std::string& name)
122 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
124 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
127 if (name ==
"GoldenRatio")
131 if (name ==
"HillClimbing")
135 if (name ==
"GlobalSearch")
139 if (name ==
"FullScan")
144 throw peak::afl::error::InternalErrorException(
"Invalid focus search algorithm!",
PEAK_AFL_STATUS_ERROR);
150 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
164 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
167 throw peak::afl::error::InternalErrorException(
"Invalid focus search algorithm!",
PEAK_AFL_STATUS_ERROR);
173 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
187 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
190 throw peak::afl::error::InternalErrorException(
"Invalid focus search algorithm!",
PEAK_AFL_STATUS_ERROR);
239 : m_controller{ std::move(controller) }
264 m_controller->SetAlgorithm(detail::ToCType(value));
286 return detail::ToFocusSearchAlgorithm(m_controller->GetAlgorithm());
307 PEAK_COMMON_NO_DISCARD std::vector<FocusSearchAlgorithm>
GetList()
const override
309 const auto cAlgorithms = m_controller->GetAlgorithmList();
311 std::vector<FocusSearchAlgorithm> algorithms;
312 algorithms.reserve(cAlgorithms.size());
314 std::transform(std::cbegin(cAlgorithms), std::cend(cAlgorithms), std::back_inserter(algorithms),
315 [](
const auto& value) {
return detail::ToFocusSearchAlgorithm(value); });
355 Set(detail::ToFocusSearchAlgorithm(archive.
GetString(
"SearchAlgorithm")));
366 std::shared_ptr<peak::afl::Controller> m_controller;
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:436
Interface for a hierarchical key-value archive system.
Definition peak_common_iarchive.hpp:54
virtual std::string GetString(const std::string &key) const =0
Retrieves a string value by key.
virtual void SetString(const std::string &key, const std::string &value)=0
Stores a UTF-8 string.
Interface for features that have a list of valid values.
Definition peak_afl_ifeature.hpp:165
SearchAlgorithm(std::shared_ptr< peak::afl::Controller > controller)
Constructs a SearchAlgorithm feature with the specified controller.
Definition peak_afl_search_algorithm.hpp:238
void Serialize(peak::common::serialization::IArchive &archive) const override
Serializes the current search algorithm to an archive.
Definition peak_afl_search_algorithm.hpp:333
FocusSearchAlgorithm Get() const override
Gets the current focus search algorithm.
Definition peak_afl_search_algorithm.hpp:284
std::vector< FocusSearchAlgorithm > GetList() const override
Gets the list of supported focus search algorithms.
Definition peak_afl_search_algorithm.hpp:307
void Deserialize(const peak::common::serialization::IArchive &archive) override
Deserializes the search algorithm from an archive.
Definition peak_afl_search_algorithm.hpp:353
void Set(const FocusSearchAlgorithm &value) override
Sets the focus search algorithm.
Definition peak_afl_search_algorithm.hpp:262
peak_afl_controller_algorithm
Focus search algorithms.
Definition peak_afl.h:692
@ PEAK_AFL_CONTROLLER_ALGORITHM_GOLDEN_RATIO_SEARCH
Golden ratio search algorithm.
Definition peak_afl.h:713
@ PEAK_AFL_CONTROLLER_ALGORITHM_HILL_CLIMBING_SEARCH
Hill climbing search algorithm.
Definition peak_afl.h:726
@ PEAK_AFL_CONTROLLER_ALGORITHM_FULL_SCAN
Full range scan algorithm.
Definition peak_afl.h:754
@ PEAK_AFL_CONTROLLER_ALGORITHM_AUTO
Automatic algorithm selection.
Definition peak_afl.h:700
@ PEAK_AFL_CONTROLLER_ALGORITHM_GLOBAL_SEARCH
Global search algorithm.
Definition peak_afl.h:740
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:416
@ PEAK_AFL_STATUS_ERROR
General error occurred.
Definition peak_afl.h:396
std::string ToString(ControllerType mode)
Converts ControllerType enumeration to string representation.
Definition peak_afl_icontroller.hpp:74
FocusSearchAlgorithm
Focus search algorithm enumeration.
Definition peak_afl_search_algorithm.hpp:35
@ Auto
Automatic algorithm selection - default algorithm.
Definition peak_afl_search_algorithm.hpp:43
@ GlobalSearch
Global search - comprehensive but slower search.
Definition peak_afl_search_algorithm.hpp:49
@ HillClimbing
Hill climbing search - good for local optimization.
Definition peak_afl_search_algorithm.hpp:47
@ GoldenRatio
Golden ratio search - efficient for unimodal focus curves.
Definition peak_afl_search_algorithm.hpp:45
@ FullScan
Full scan - scans entire focus range for maximum accuracy.
Definition peak_afl_search_algorithm.hpp:51
Interface definitions and implementations for individual module types used within a pipeline.
Definition peak_afl_generic_auto_brightness.hpp:35
Interfaces and implementations for defining and controlling data processing pipelines.
Definition peak_afl_generic_auto_brightness.hpp:33