4#include <unordered_map>
26std::string
join(
const std::vector<std::string>& v);
80 explicit BlockSrc(
const std::unordered_map<std::string, std::shared_ptr<Block>>& m,
81 std::string ctx = {});
89 bool has_block(std::string_view name)
const;
102 const std::shared_ptr<Block>&
block(std::string_view name)
const;
116 std::shared_ptr<Parameter>
get_param(std::string_view blk,
const LhaID& code)
const;
127 std::shared_ptr<Parameter>
get_param(std::string_view blk,
int code)
const;
138 std::shared_ptr<Parameter>
get_param(std::string_view blk, std::pair<int,int> code)
const;
155 scalar_t get_val(std::string_view blk, std::initializer_list<long> code)
const;
173 std::initializer_list<std::size_t> code)
const;
190 scalar_t get_val(std::string_view blk, std::initializer_list<int> code)
const;
227 const std::unordered_map<std::string, std::shared_ptr<Block>>&
raw()
const;
230 const std::unordered_map<std::string, std::shared_ptr<Block>>* m_;
257 explicit ParamSrc(
const std::unordered_map<
ParamId, std::shared_ptr<Parameter>>& m,
258 std::string ctx = {});
282 const std::shared_ptr<Parameter>&
require(
const ParamId&
id)
const;
334 const std::unordered_map<ParamId, std::shared_ptr<Parameter>>&
raw()
const;
337 const std::unordered_map<ParamId, std::shared_ptr<Parameter>>* m_;
348BlockSrc as_block_src(
const std::unordered_map<std::string, std::shared_ptr<Block>>& m, std::string ctx = {});
Defines classes used to store parameters and to build derived/dependent parameter blocks.
Model-dependent parameter repository and initialization strategies.
std::string to_string(const LhaID &id)
Convenience stringification for LhaID.
std::string join(const std::vector< std::string > &v)
Joins a list of strings with ", ".
BlockSrc as_block_src(const std::unordered_map< std::string, std::shared_ptr< Block > > &m, std::string ctx={})
Helper function to build a BlockSrc view from a block map.
ParamSrc as_param_src(const std::unordered_map< ParamId, std::shared_ptr< Parameter > > &m, std::string ctx={})
Helper function to build a ParamSrc view from a parameter map.
Lightweight view over a set of source blocks.
const std::unordered_map< std::string, std::shared_ptr< Block > > & raw() const
Returns the underlying map reference.
scalar_t get_val(std::string_view blk, std::initializer_list< long > code) const
Retrieves the value of a parameter given as an initializer_list.
const std::shared_ptr< Block > & block(std::string_view name) const
Returns a reference to a block by name.
std::shared_ptr< Parameter > get_param(std::string_view blk, const LhaID &code) const
Retrieves a parameter from a given block by LhaID.
bool has_block(std::string_view name) const
Checks whether a block with a given name is present.
Lightweight view over a set of source parameters keyed by ParamId.
const std::shared_ptr< Parameter > & require(const ParamId &id) const
Returns a parameter reference or throws if missing.
ParamSrc()=default
Default constructor: creates an empty, unbound view.
std::shared_ptr< Parameter > get_param(const ParamId &id) const
Convenience wrapper for require().
const std::unordered_map< ParamId, std::shared_ptr< Parameter > > & raw() const
Access to the underlying parameter map.
scalar_t get_val(const ParamId &id) const
Retrieves the current value of a parameter.
bool has(const ParamId &id) const
Checks whether a parameter with the given ID exists.
Represents an identifier of a LHA element, possibly containing several sub-ids.
Composite identifier for a single parameter.