|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Lightweight view over a set of source blocks. More...
#include <SourcesView.h>
Public Member Functions | |
| BlockSrc (const std::unordered_map< std::string, std::shared_ptr< Block > > &m, std::string ctx={}) | |
| Constructs a BlockSrc view from an existing map. | |
| bool | has_block (std::string_view name) const |
| Checks whether a block with a given name is present. | |
| 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. | |
| std::shared_ptr< Parameter > | get_param (std::string_view blk, int code) const |
| Helper: get parameter using an integer code. | |
| std::shared_ptr< Parameter > | get_param (std::string_view blk, std::pair< int, int > code) const |
| Helper: get parameter using a pair of integers. | |
| 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. | |
| scalar_t | get_val (std::string_view blk, std::initializer_list< std::size_t > code) const |
| Retrieves the value of a parameter given as an initializer_list. | |
| scalar_t | get_val (std::string_view blk, std::initializer_list< int > code) const |
| Retrieves the value of a parameter given as an initializer_list. | |
| scalar_t | get_val (std::string_view blk, const LhaID &code) const |
| Retrieves the value of a parameter identified by an LhaID. | |
| scalar_t | get_val (std::string_view blk, int code) const |
| Helper: get value from an integer code. | |
| scalar_t | get_val (std::string_view blk, std::pair< int, int > code) const |
| Helper: get value from a pair of integers. | |
| const std::unordered_map< std::string, std::shared_ptr< Block > > & | raw () const |
| Returns the underlying map reference. | |
Lightweight view over a set of source blocks.
This class is a non-owning wrapper around a std::unordered_map<std::string, std::shared_ptr<Block>>.
It provides:
get_val helpers from various ID formsIt is typically used inside dependent-block update lambdas:
Definition at line 71 of file SourcesView.h.
|
explicit |
Constructs a BlockSrc view from an existing map.
| m | Map of block-name to Block pointers (not owned). |
| ctx | Optional textual context added to error messages (e.g. name of the DependentBlock being updated). |
Definition at line 19 of file SourceView.cpp.
| const std::shared_ptr< Block > & BlockSrc::block | ( | std::string_view | name | ) | const |
Returns a reference to a block by name.
If the block is missing, throws std::invalid_argument with a message mentioning the context (if provided) and the list of available blocks.
| name | Name of the block (case-sensitive as stored in the map). |
| std::invalid_argument | if the block is not found. |
Definition at line 27 of file SourceView.cpp.
Retrieves a parameter from a given block by LhaID.
If the block or parameter is missing, throws std::invalid_argument with a detailed message including available IDs.
| blk | Name of the block. |
| code | LhaID of the parameter. |
| std::invalid_argument | if the block or parameter is not found. |
Definition at line 42 of file SourceView.cpp.
| std::shared_ptr< Parameter > BlockSrc::get_param | ( | std::string_view | blk, |
| int | code | ||
| ) | const |
Helper: get parameter using an integer code.
Constructs LhaID(code) and forwards to the main overload.
| blk | Name of the block. |
| code | Integer PDG-like code. |
Definition at line 47 of file SourceView.cpp.
| std::shared_ptr< Parameter > BlockSrc::get_param | ( | std::string_view | blk, |
| std::pair< int, int > | code | ||
| ) | const |
Helper: get parameter using a pair of integers.
Constructs an LhaID(code.first, code.second) and forwards.
| blk | Name of the block. |
| code | Pair of indices. |
Definition at line 50 of file SourceView.cpp.
Retrieves the value of a parameter identified by an LhaID.
| blk | Name of the block. |
| code | LhaID of the parameter. |
Definition at line 73 of file SourceView.cpp.
| scalar_t BlockSrc::get_val | ( | std::string_view | blk, |
| int | code | ||
| ) | const |
Helper: get value from an integer code.
| blk | Name of the block. |
| code | Integer PDG-like code. |
Definition at line 77 of file SourceView.cpp.
| scalar_t BlockSrc::get_val | ( | std::string_view | blk, |
| std::initializer_list< int > | code | ||
| ) | const |
Retrieves the value of a parameter given as an initializer_list.
Example:
| blk | Name of the block. |
| code | List of positive integer components used to build an LhaID. |
| std::invalid_argument | if the block or parameter is missing. |
Definition at line 66 of file SourceView.cpp.
| scalar_t BlockSrc::get_val | ( | std::string_view | blk, |
| std::initializer_list< long > | code | ||
| ) | const |
Retrieves the value of a parameter given as an initializer_list.
Example:
| blk | Name of the block. |
| code | List of integer components used to build an LhaID. |
| std::invalid_argument | if the block or parameter is missing. |
Definition at line 54 of file SourceView.cpp.
| scalar_t BlockSrc::get_val | ( | std::string_view | blk, |
| std::initializer_list< std::size_t > | code | ||
| ) | const |
Retrieves the value of a parameter given as an initializer_list.
Example:
| blk | Name of the block. |
| code | List of positive integer components used to build an LhaID. |
| std::invalid_argument | if the block or parameter is missing. |
Definition at line 58 of file SourceView.cpp.
| scalar_t BlockSrc::get_val | ( | std::string_view | blk, |
| std::pair< int, int > | code | ||
| ) | const |
Helper: get value from a pair of integers.
| blk | Name of the block. |
| code | Pair of indices. |
Definition at line 81 of file SourceView.cpp.
| bool BlockSrc::has_block | ( | std::string_view | name | ) | const |
Checks whether a block with a given name is present.
| name | Name of the block. |
Definition at line 23 of file SourceView.cpp.
| const std::unordered_map< std::string, std::shared_ptr< Block > > & BlockSrc::raw | ( | ) | const |
Returns the underlying map reference.
This is useful if the caller needs to iterate or inspect the raw collection of blocks.
Definition at line 85 of file SourceView.cpp.