7 const std::string &block_name,
8 const std::unordered_map<
ParameterType, std::vector<std::string>> &source_names,
15 const std::unordered_set<ParamId>& source_pids,
19 std::unordered_set<ParamId> typed_sources;
20 for (
auto& src_pid : source_pids) {
21 if (!src_pid.type.has_value()){
24 typed_sources.emplace(
ParamId{src_pid.
type.value(), src_pid.block, src_pid.code});
47 auto removal_rank = [](
const std::string& name) {
50 if (name.find(
"_B_SCALE_") != std::string::npos &&
51 name.find(
"__") == std::string::npos) {
54 if (name.find(
"__") != std::string::npos) {
57 if (name.find(
"_EW_SCALE") != std::string::npos) {
63 std::sort(blocks.begin(), blocks.end(), [&](
const std::string& a,
const std::string& b) {
64 const int ra = removal_rank(a);
65 const int rb = removal_rank(b);
66 if (ra != rb) return ra < rb;
70 for (
const auto& block_name : blocks) {
std::function< void(const BlockSrc &, std::shared_ptr< DependentBlock >)> DepUpdateFunc
Function type used to recompute a DependentBlock from its sources.
std::function< void(const ParamSrc &, std::shared_ptr< DependentParameter >)> DepParamUpdateFunc
Function signature used to recompute a DependentParameter.
Block composer specialized for the Wilson parameter scope.
Concrete implementation of IDependency using DependentBlockManager.
void remove_dependency(const BlockName &name, ParameterType src) override
Removes a dependent block using DependentBlockManager.
void add_param_dependency(const ParamId &pid, const std::unordered_set< ParamId > &source_pids, DepParamUpdateFunc recalculateFunc) override
Adds a dependent parameter using DependentBlockManager.
void update_dependency(const BlockName &name, ParameterType src) override
Manually triggers an update on a dependent block using DependentBlockManager.
void add_block_dependency(const BlockName &name, const std::unordered_map< ParameterType, std::vector< std::string > > &source_names, ParameterType dest, DepUpdateFunc recalculateFunc) override
Adds a dependent block using DependentBlockManager.
std::unordered_set< std::string > composed_blocks
Registry of blocks composed through this composer instance.
void compose_parameter(const ParamId &, const std::unordered_set< ParamId > &, const DepParamUpdateFunc &) override
Creates a dependent parameter in the Wilson scope.
void compose_block(const std::string &block_name, const std::unordered_map< ParameterType, std::vector< std::string > > &source_names, const DepUpdateFunc &update_func) override
Creates a dependent block in the Wilson scope.
void remove_all_composed_blocks() override
Removes all dependent blocks composed via this composer.
void remove_block(const std::string &) override
Removes a dependent block from the Wilson scope and from the registry.
void update(const std::string &block_name) override
Triggers an update on a dependent block in the Wilson scope.
Composite identifier for a single parameter.
std::optional< ParameterType > type
Optional high-level parameter category.
BlockName block
Name of the block where the parameter is stored.
LhaID code
Index or multi-index of the parameter inside the block.