Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
SourcesView.h File Reference
#include <unordered_map>
#include <memory>
#include <sstream>
#include <string>
#include <string_view>
#include <stdexcept>
#include <vector>
#include <utility>
#include "Block.h"
#include "Parameters.h"
Include dependency graph for SourcesView.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  BlockSrc
 Lightweight view over a set of source blocks. More...
 
class  ParamSrc
 Lightweight view over a set of source parameters keyed by ParamId. More...
 

Functions

std::string join (const std::vector< std::string > &v)
 Joins a list of strings with ", ".
 
std::string to_string (const LhaID &id)
 Convenience stringification for LhaID.
 
std::string to_string (const ParamId &id)
 Convenience stringification for ParamId.
 
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.
 

Function Documentation

◆ as_block_src()

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.

Parameters
mMap of block name to Block pointer.
ctxOptional context string for error reporting.
Returns
A BlockSrc instance referencing m.

Definition at line 129 of file SourceView.cpp.

◆ as_param_src()

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.

Parameters
mMap of ParamId to Parameter pointer.
ctxOptional context string for error reporting.
Returns
A ParamSrc instance referencing m.

Definition at line 132 of file SourceView.cpp.

◆ join()

std::string join ( const std::vector< std::string > &  v)

Joins a list of strings with ", ".

Utility function mainly used to format error messages with "available keys" lists.

Parameters
vVector of strings to join.
Returns
A single string of the form "a, b, c".

Definition at line 3 of file SourceView.cpp.

◆ to_string() [1/2]

std::string to_string ( const LhaID id)

Convenience stringification for LhaID.

Delegates to LhaID::to_string().

Parameters
idLhaID to stringify.
Returns
String representation of the ID.

Definition at line 9 of file SourceView.cpp.

◆ to_string() [2/2]

std::string to_string ( const ParamId id)

Convenience stringification for ParamId.

Produces a human-readable identifier of the form: <ParameterType>::<block>:: using ParameterTypeMapper::str for the type.

Parameters
idParamId to stringify.
Returns
String representation of the ParamId.

Definition at line 13 of file SourceView.cpp.