LHAPDF
6.5.4
|
Metadata base class for PDFs, PDF sets, or global configuration. More...
#include <Info.h>
Public Member Functions | |
Info () | |
Default constructor. | |
Info (const std::string &path) | |
Constructor. | |
virtual | ~Info () |
Virtual destructor to allow inheritance. | |
Loading info from YAML files | |
void | load (const std::string &filepath) |
General metadata accessors | |
std::vector< std::string > | keys_local () const |
Get the keys defined on this specific object. | |
std::vector< std::string > | keys () const |
bool | has_key_local (const std::string &key) const |
Is a value defined for the given key on this specific object? | |
virtual bool | has_key (const std::string &key) const |
const std::string & | get_entry_local (const std::string &key) const |
Retrieve a metadata string by key name, as defined on this specific object. | |
virtual const std::string & | get_entry (const std::string &key) const |
virtual const std::string & | get_entry (const std::string &key, const std::string &fallback) const |
Retrieve a metadata string by key name, with a default fallback. | |
template<typename T > | |
T | get_entry_as (const std::string &key) const |
template<typename T > | |
T | get_entry_as (const std::string &key, const T &fallback) const |
Retrieve a metadata entry by key name, with an inline type cast and default fallback. | |
template<typename T > | |
void | set_entry (const std::string &key, const T &val) |
Set a keyed value entry. | |
Info metadata function template specialisations | |
template<> | |
bool | get_entry_as (const std::string &key) const |
Protected Attributes | |
std::map< std::string, std::string > | _metadict |
The string -> string native metadata storage container. | |
Metadata base class for PDFs, PDF sets, or global configuration.
Get the singleton global configuration object
The global config is populated by reading from lhapdf.conf if it is found in the search paths.
|
inlinevirtual |
Retrieve a metadata string by key name
The given key may be defined non-locally, in which case the cascading member -> set -> config info lookup is needed. These are implemented using has_key_local() and get_entry_local().
The default implementation is equivalent to get_entry_local(). This is appropriate for Config, but should be overridden for more specific info types.
Reimplemented in LHAPDF::PDFSet, and LHAPDF::PDFInfo.
|
inline |
Retrieve a metadata entry by key name, with an inline type cast
Specialisations are defined below for unpacking of comma-separated lists of strings, ints, and doubles.
|
inlinevirtual |
Can this object return a value for the given key?
The given key may be defined non-locally, in which case the cascading member -> set -> config info lookup is needed. These are implemented using has_key_local() and metadata_local().
The default implementation is equivalent to has_key_local(). This is appropriate for Config, but should be overridden for more specific info types.
Reimplemented in LHAPDF::PDFSet, and LHAPDF::PDFInfo.
|
inline |
Get the keys defined on this object or cascaded into it
The default implementation is equivalent to keys_local(). This is appropriate for Config, but should be overridden for more specific info types.
void LHAPDF::Info::load | ( | const std::string & | filepath | ) |
Populate this info object from the specified YAML file path.
This function may be called several times to read metadata from several YAML source files. Values for existing keys will be overwritten.