Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
dynamic_registry.h File Reference
#include <string>
#include <string_view>
#include <vector>
#include <unordered_map>
#include <optional>
#include <algorithm>
#include <cctype>
#include "dynamic_registry.tpp"
Include dependency graph for dynamic_registry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SymbolId< Tag >
 Returns an uppercase copy of the input string. More...
 
struct  std::hash< SymbolId< Tag > >
 
class  DynamicRegistry< Tag, ExternalKey, Hash >
 Case-insensitive registry of SymbolId entries with optional external keys. More...
 
struct  DynamicRegistry< Tag, ExternalKey, Hash >::Entry
 Entry stored in the registry. More...
 
class  DynamicRegistry< Tag, void, void >
 Case-insensitive registry of SymbolId entries without external keys. More...
 
struct  DynamicRegistry< Tag, void, void >::Entry
 Entry stored in the registry (no external key). More...
 

Namespaces

namespace  std
 Hash specialization for SymbolId<Tag>.
 

Functions

std::string normalize_key (std::string_view s)
 Normalizes a string key in a case-insensitive manner.
 
template<class Tag >
bool operator== (const SymbolId< Tag > &a, const SymbolId< Tag > &b) noexcept
 Case-insensitive equality comparison for SymbolId<Tag>.
 
template<class Tag >
bool operator< (const SymbolId< Tag > &a, const SymbolId< Tag > &b) noexcept
 Case-insensitive strict ordering for SymbolId<Tag>.
 

Function Documentation

◆ normalize_key()

std::string normalize_key ( std::string_view  s)
inline

Normalizes a string key in a case-insensitive manner.

The current implementation:

  • lowercases all characters using std::tolower,
  • preserves all characters (alphanumeric and others).

Optionally, the commented-out line can be enabled to ignore characters that are not alphanumeric (such as spaces or punctuation).

Parameters
sInput string view to normalize.
Returns
Lowercased std::string, suitable for use as a canonical key.

Definition at line 96 of file dynamic_registry.h.

◆ operator<()

template<class Tag >
bool operator< ( const SymbolId< Tag > &  a,
const SymbolId< Tag > &  b 
)
inlinenoexcept

Case-insensitive strict ordering for SymbolId<Tag>.

The ordering is defined by lexicographic comparison of the normalized names (see normalize_key()). This allows SymbolId<Tag> to be used as keys in ordered containers if needed.

Template Parameters
TagTag type of the SymbolId.
Parameters
aFirst identifier.
bSecond identifier.
Returns
true if the normalized name of a is lexicographically smaller than that of b.

Definition at line 137 of file dynamic_registry.h.

◆ operator==()

template<class Tag >
bool operator== ( const SymbolId< Tag > &  a,
const SymbolId< Tag > &  b 
)
inlinenoexcept

Case-insensitive equality comparison for SymbolId<Tag>.

Two SymbolId<Tag> values are considered equal if their normalized names (as returned by normalize_key()) are equal, independently of original case.

Template Parameters
TagTag type of the SymbolId.
Parameters
aFirst identifier.
bSecond identifier.
Returns
true if both identifiers are equal under normalization.

Definition at line 119 of file dynamic_registry.h.