Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
DefaultMappingAdapterFactory.h
Go to the documentation of this file.
1#ifndef DEFAULTMAPPINGADAPTERFACTORY_H
2#define DEFAULTMAPPINGADAPTERFACTORY_H
3
7#include "JsonParser.h"
8#include "MappingDatabase.h"
9
32public:
47 std::shared_ptr<IMappingDatabaseAdapter> create(
48 const std::string& instanceName,
49 const std::string& jsonFilePath,
50 std::shared_ptr<IParamMappingSource> loader
51 ) const override
52 {
53 if (!loader) {
54 loader = std::make_shared<JsonParamMappingAdapter>(std::make_shared<JSONParser>());
55 }
56
57 auto db = std::make_shared<MappingDatabase>(MappingDatabase(instanceName, jsonFilePath, loader));
58 if (!db) throw std::runtime_error("DefaultMappingAdapterFactory: database is unavailable");
59
60 return std::make_shared<DefaultMappingDatabaseAdapter>(instanceName, db);
61 }
62};
63
64#endif
Thin adapter exposing MappingDatabase through IMappingDatabaseAdapter.
Interface for factories creating mapping database adapters.
Adapter to load parameter mappings from a JSON/YAML-like DBNode tree.
Lightweight JSON parser/serializer for DBNode trees.
In-memory store of parameter mappings loaded from an external file.
Default implementation of IMappingAdapterFactory.
std::shared_ptr< IMappingDatabaseAdapter > create(const std::string &instanceName, const std::string &jsonFilePath, std::shared_ptr< IParamMappingSource > loader) const override
Creates a mapping database adapter from a JSON file.
Factory interface for building IMappingDatabaseAdapter instances.
Lightweight container for InterpretedParam mappings.