Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
DBNodeProviderFactory.cpp
Go to the documentation of this file.
2
3std::shared_ptr<IDBNodeProvider> DBNodeProviderFactory::createDBNodeProvider(fs::path src_path) {
4 auto input_extension = src_path.extension().string();
5 auto dict_extensions = DBManager::EXTENSIONS.at(ParserFactory::Type::JSON);
6 dict_extensions.insert(DBManager::EXTENSIONS.at(ParserFactory::Type::YAML).begin(), DBManager::EXTENSIONS.at(ParserFactory::Type::YAML).end());
7 auto lha_extensions = DBManager::EXTENSIONS.at(ParserFactory::Type::LHA);
8
9 if (dict_extensions.contains(input_extension)) {
10 return std::make_shared<DictDBNodeProvider>(src_path);
11 } else if (lha_extensions.contains(input_extension)) {
12 return std::make_shared<LhaDBNodeProvider>(src_path);
13 }
14
15 LOG_ERROR("FileError", "Cannot read file with extension", input_extension);
16}
Factory for creating IDBNodeProvider instances from a file path.
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
Definition Logger.h:41
static std::shared_ptr< IDBNodeProvider > createDBNodeProvider(fs::path src_path)
Creates an IDBNodeProvider for a given file path.