CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
SpeciesInput Class Reference

#include <species_input.h>

Public Member Functions

template<class T >
std::optional< T > get (const std::string &field) const
 
template<class T >
get_or (const std::string &field, T fallback) const
 
template<class T >
require (const std::string &field) const
 

Detailed Description

Per-instance read wrapper over FileContent for dot-syntax species input. Prefixes every key with "<instance_name>." before delegating to the underlying FileContent. Successful reads mark the fully-qualified key as read so unread_parameters() remains accurate.

Member Function Documentation

◆ get()

template<class T >
std::optional< T > SpeciesInput::get ( const std::string &  field) const
inline

Typed accessor: the value if "<instance>.<field>" is present (marking it read), or std::nullopt if absent. Delegates to FileContent::get<T>.

◆ get_or()

template<class T >
T SpeciesInput::get_or ( const std::string &  field,
fallback 
) const
inline

Read-with-default: get<T>(field) if present, else fallback.

◆ require()

template<class T >
T SpeciesInput::require ( const std::string &  field) const
inline

Required accessor: throws std::invalid_argument if the field is absent.


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