23#ifndef DATAFILEMANAGER_H
24#define DATAFILEMANAGER_H
29#include <unordered_map>
60 template<DerivedDataFileBase T>
61 T&
get(
const std::string& key)
65 throw std::invalid_argument(
"Key must not be empty.");
67 if (!m_files.contains(key))
69 m_files[key] = std::make_unique<T>(key, m_appName);
71 return *
static_cast<T*
>(m_files[key].get());
75 std::string m_appName;
76 std::unordered_map<std::string, std::unique_ptr<DataFileBase>> m_files;
A manager of data files for an application.
Definition datafilemanager.h:41
void operator=(DataFileManager &&)=delete
DataFileManager(DataFileManager &&)=delete
DataFileManager(const DataFileManager &)=delete
T & get(const std::string &key)
Gets a data object.
Definition datafilemanager.h:61
DataFileManager(const std::string &appName)
Constructs a DataFileManager.
void operator=(const DataFileManager &)=delete
Definition datafilemanager.h:35