lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF  6.5.4
LHAPDF::Info Class Reference

Metadata base class for PDFs, PDF sets, or global configuration. More...

#include <Info.h>

Inheritance diagram for LHAPDF::Info:
LHAPDF::Config LHAPDF::PDFInfo LHAPDF::PDFSet

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 >
get_entry_as (const std::string &key) const
 
template<typename 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
 
template<>
std::vector< std::string > get_entry_as (const std::string &key) const
 
template<>
std::vector< int > get_entry_as (const std::string &key) const
 
template<>
std::vector< double > get_entry_as (const std::string &key) const
 

Protected Attributes

std::map< std::string,
std::string > 
_metadict
 The string -> string native metadata storage container.
 

Detailed Description

Metadata base class for PDFs, PDF sets, or global configuration.

Get the singleton global configuration object

Todo:
Move this out of Info. To Factories.h or SystemConfig.h?

The global config is populated by reading from lhapdf.conf if it is found in the search paths.

Examples:
/tests/testinfo.cc.

Member Function Documentation

virtual const std::string& LHAPDF::Info::get_entry ( const std::string &  key) const
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.

Examples:
/tests/testinfo.cc.
template<typename T >
T LHAPDF::Info::get_entry_as ( const std::string &  key) const
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.

Examples:
/tests/testgrid.cc, and /tests/testinfo.cc.
virtual bool LHAPDF::Info::has_key ( const std::string &  key) const
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.

std::vector<std::string> LHAPDF::Info::keys ( ) const
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.


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