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

IParamMappingSource implementation backed by a JSON-like file. More...

#include <JsonParamMappingAdapter.h>

Inheritance diagram for JsonParamMappingAdapter:
Collaboration diagram for JsonParamMappingAdapter:

Public Member Functions

 JsonParamMappingAdapter (std::shared_ptr< IParser > parser)
 Constructs the adapter with a given parser instance.
 
std::unordered_map< std::string, InterpretedParamloadFromFile (const std::string &filePath) const override
 Loads parameter mappings from a file.
 
- Public Member Functions inherited from IParamMappingSource
virtual ~IParamMappingSource ()=default
 

Detailed Description

IParamMappingSource implementation backed by a JSON-like file.

Expected JSON (or YAML) schema:

{
"paramName1": {
"block": "<blockName>",
"pdgCode": "<LHA ID string or integer-like>"
},
"paramName2": { ... }
}

For each top-level key, the adapter constructs an InterpretedParam by:

  • reading "block" as a string,
  • reading "pdgCode" and converting it to an LhaID.

Definition at line 38 of file JsonParamMappingAdapter.h.

Constructor & Destructor Documentation

◆ JsonParamMappingAdapter()

JsonParamMappingAdapter::JsonParamMappingAdapter ( std::shared_ptr< IParser parser)
inlineexplicit

Constructs the adapter with a given parser instance.

Parameters
parserConcrete parser (e.g. JSONParser) used to load the file into a Node tree.

Definition at line 46 of file JsonParamMappingAdapter.h.

Member Function Documentation

◆ loadFromFile()

std::unordered_map< std::string, InterpretedParam > JsonParamMappingAdapter::loadFromFile ( const std::string &  filePath) const
overridevirtual

Loads parameter mappings from a file.

Parameters
filePathPath to the JSON/YAML mapping file.
Returns
Map from parameter name to InterpretedParam.
Exceptions
std::runtime_errorif the parser is null, the root DBNode is null, or the file cannot be parsed.

Implements IParamMappingSource.

Definition at line 5 of file JsonParamMappingAdapter.cpp.


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