![]() |
Shamrock 2025.10.0
Astrophysical Code
|
Implementation of the name-keyed registry of implementation selectors. More...
#include "shamalgs/impl_registry.hpp"#include "shambase/exception.hpp"#include "shambase/memory.hpp"#include "shamcomm/logs.hpp"#include "shamcomm/worldInfo.hpp"#include <functional>#include <map>#include <stdexcept>#include <utility>Go to the source code of this file.
Namespaces | |
| namespace | shamalgs |
| namespace to contain everything implemented by shamalgs | |
Functions | |
| void | shamalgs::impl_registry::register_impl (std::string name, IImplVariant &impl) |
| Register an implementation selector under name. | |
| std::vector< std::string > | shamalgs::impl_registry::get_registered_algs () |
| Get the names of every registered algorithm, sorted. | |
| std::vector< std::string > | shamalgs::impl_registry::get_default_impl_list (std::string_view alg) |
| Get the list of available implementations of alg, as config json strings. | |
| std::string | shamalgs::impl_registry::get_current_impl (std::string_view alg) |
| Get the current implementation of alg as a config json string, "null" if unset. | |
| bool | shamalgs::impl_registry::is_impl_set (std::string_view alg) |
| Whether an implementation of alg has been selected yet. | |
| void | shamalgs::impl_registry::set_impl (std::string_view alg, std::string_view impl) |
| Select the implementation of alg from a config json string. | |
| void | shamalgs::impl_registry::autoselect_impl (std::string_view alg, const sham::DeviceScheduler_ptr &sched) |
| Select the default implementation of alg for the device behind sched. | |
Implementation of the name-keyed registry of implementation selectors.
Definition in file impl_registry.cpp.
| void shamalgs::impl_registry::autoselect_impl | ( | std::string_view | alg, |
| const sham::DeviceScheduler_ptr & | sched ) |
Select the default implementation of alg for the device behind sched.
| std::runtime_error | if sched is null |
Definition at line 99 of file impl_registry.cpp.
| std::string shamalgs::impl_registry::get_current_impl | ( | std::string_view | alg | ) |
Get the current implementation of alg as a config json string, "null" if unset.
Definition at line 86 of file impl_registry.cpp.
| std::vector< std::string > shamalgs::impl_registry::get_default_impl_list | ( | std::string_view | alg | ) |
Get the list of available implementations of alg, as config json strings.
Definition at line 82 of file impl_registry.cpp.
| std::vector< std::string > shamalgs::impl_registry::get_registered_algs | ( | ) |
Get the names of every registered algorithm, sorted.
Definition at line 73 of file impl_registry.cpp.
| bool shamalgs::impl_registry::is_impl_set | ( | std::string_view | alg | ) |
Whether an implementation of alg has been selected yet.
Definition at line 90 of file impl_registry.cpp.
| void shamalgs::impl_registry::register_impl | ( | std::string | name, |
| IImplVariant & | impl ) |
Register an implementation selector under name.
The registry stores the address of impl, which must therefore outlive every later use of the registry (in practice, a namespace-scope global). There is no unregister.
| std::invalid_argument | if name is already registered (nothing is stored then) |
Definition at line 64 of file impl_registry.cpp.
| void shamalgs::impl_registry::set_impl | ( | std::string_view | alg, |
| std::string_view | impl ) |
Select the implementation of alg from a config json string.
Definition at line 92 of file impl_registry.cpp.