Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
ParamSrc Class Reference

Lightweight view over a set of source parameters keyed by ParamId. More...

#include <SourcesView.h>

Public Member Functions

 ParamSrc (const std::unordered_map< ParamId, std::shared_ptr< Parameter > > &m, std::string ctx={})
 Constructs a ParamSrc view from an existing map.
 
 ParamSrc ()=default
 Default constructor: creates an empty, unbound view.
 
bool has (const ParamId &id) const
 Checks whether a parameter with the given ID exists.
 
const std::shared_ptr< Parameter > & require (const ParamId &id) const
 Returns a parameter reference or throws if missing.
 
std::shared_ptr< Parameterget_param (const ParamId &id) const
 Convenience wrapper for require().
 
scalar_t get_val (const ParamId &id) const
 Retrieves the current value of a parameter.
 
scalar_t get_val (ParameterType t, std::string_view block, std::initializer_list< long > code) const
 Helper: get value from typed (ParameterType, block, code-list).
 
scalar_t get_val (ParameterType t, std::string_view block, const LhaID &code) const
 Helper: get value from typed (ParameterType, block, LhaID).
 
scalar_t get_val (ParameterType t, std::string_view block, int code) const
 Helper: get value from typed (ParameterType, block, int).
 
scalar_t get_val (ParameterType t, std::string_view block, std::pair< int, int > code) const
 Helper: get value from typed (ParameterType, block, pair<int,int>).
 
const std::unordered_map< ParamId, std::shared_ptr< Parameter > > & raw () const
 Access to the underlying parameter map.
 

Detailed Description

Lightweight view over a set of source parameters keyed by ParamId.

This class wraps a map std::unordered_map<ParamId, std::shared_ptr<Parameter>> without owning it, and provides:

  • presence checks,
  • safe retrieval with detailed error messages,
  • convenient get_val helpers accepting (type, block, code...).

It is particularly useful for dependency graphs where derived parameters are functions of other parameters identified by full ParamId.

Definition at line 249 of file SourcesView.h.

Constructor & Destructor Documentation

◆ ParamSrc() [1/2]

ParamSrc::ParamSrc ( const std::unordered_map< ParamId, std::shared_ptr< Parameter > > &  m,
std::string  ctx = {} 
)
explicit

Constructs a ParamSrc view from an existing map.

Parameters
mMap of ParamId to Parameter pointers (not owned).
ctxOptional context string used in error messages.

Definition at line 89 of file SourceView.cpp.

◆ ParamSrc() [2/2]

ParamSrc::ParamSrc ( )
default

Default constructor: creates an empty, unbound view.

Member Function Documentation

◆ get_param()

std::shared_ptr< Parameter > ParamSrc::get_param ( const ParamId id) const

Convenience wrapper for require().

Parameters
idParamId to retrieve.
Returns
Shared pointer to the Parameter.
Exceptions
std::invalid_argumentif the parameter is not found.

Definition at line 110 of file SourceView.cpp.

◆ get_val() [1/5]

scalar_t ParamSrc::get_val ( const ParamId id) const

Retrieves the current value of a parameter.

Parameters
idParamId to retrieve.
Returns
The parameter value (scalar_t).

Definition at line 111 of file SourceView.cpp.

◆ get_val() [2/5]

scalar_t ParamSrc::get_val ( ParameterType  t,
std::string_view  block,
const LhaID code 
) const

Helper: get value from typed (ParameterType, block, LhaID).

Definition at line 117 of file SourceView.cpp.

◆ get_val() [3/5]

scalar_t ParamSrc::get_val ( ParameterType  t,
std::string_view  block,
int  code 
) const

Helper: get value from typed (ParameterType, block, int).

Definition at line 120 of file SourceView.cpp.

◆ get_val() [4/5]

scalar_t ParamSrc::get_val ( ParameterType  t,
std::string_view  block,
std::initializer_list< long >  code 
) const

Helper: get value from typed (ParameterType, block, code-list).

Constructs a ParamId and forwards to the main get_val().

Parameters
tParameterType (owner / category).
blockBlock name.
codeList of integer components used to build LhaID.
Returns
The parameter value.

Definition at line 113 of file SourceView.cpp.

◆ get_val() [5/5]

scalar_t ParamSrc::get_val ( ParameterType  t,
std::string_view  block,
std::pair< int, int >  code 
) const

Helper: get value from typed (ParameterType, block, pair<int,int>).

Definition at line 123 of file SourceView.cpp.

◆ has()

bool ParamSrc::has ( const ParamId id) const

Checks whether a parameter with the given ID exists.

Parameters
idParamId to test.
Returns
True if the map contains this ID.

Definition at line 93 of file SourceView.cpp.

◆ raw()

const std::unordered_map< ParamId, std::shared_ptr< Parameter > > & ParamSrc::raw ( ) const

Access to the underlying parameter map.

Returns
Const reference to the internal map.

Definition at line 127 of file SourceView.cpp.

◆ require()

const std::shared_ptr< Parameter > & ParamSrc::require ( const ParamId id) const

Returns a parameter reference or throws if missing.

On failure, throws std::invalid_argument with a message that includes the context (if any) and the list of available ParamIds.

Parameters
idParamId to retrieve.
Returns
Const reference to the shared_ptr<Parameter>.
Exceptions
std::invalid_argumentif the parameter is not found.

Definition at line 95 of file SourceView.cpp.


The documentation for this class was generated from the following files: