SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
resourceManager.h
Go to the documentation of this file.
1/* ***********************************************************************
2//
3// Copyright (C) 2025 -- The 4D-STAR Collaboration
4// File Author: Emily Boudreaux
5// Last Modified: March 20, 2025
6//
7// 4DSSE is free software; you can use it and/or modify
8// it under the terms and restrictions the GNU General Library Public
9// License version 3 (GPLv3) as published by the Free Software Foundation.
10//
11// 4DSSE is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Library General Public License for more details.
15//
16// You should have received a copy of the GNU Library General Public License
17// along with this software; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// *********************************************************************** */
21#pragma once
22
23#include <vector>
24#include <string>
25#include <stdexcept>
26#include <unordered_map>
27
29#include "config.h"
30#include "probe.h"
31#include "quill/LogMacros.h"
32
40namespace serif::resource {
42 private:
47
52
57
58 serif::config::Config& m_config = serif::config::Config::getInstance();
60 quill::Logger* m_logger = m_logManager.getLogger("log");
61
62 serif::config::Config m_resourceConfig;
63 std::string m_dataDir;
64 std::unordered_map<std::string, types::Resource> m_resources;
65
71 bool load(const std::string& name);
72
73 public:
79 static ResourceManager instance;
80 return instance;
81 }
82
93 std::vector<std::string> getAvailableResources() const;
94
107 const types::Resource& getResource(const std::string &name) const;
108
120 bool loadResource(std::string& name);
121
132 std::unordered_map<std::string, bool> loadAllResources();
133 };
134}
Class to manage logging operations.
Definition probe.h:79
static LogManager & getInstance()
Get the singleton instance of LogManager.
Definition probe.h:103
serif::config::Config & m_config
const types::Resource & getResource(const std::string &name) const
Gets a resource by name.
serif::config::Config m_resourceConfig
ResourceManager()
Private constructor to prevent instantiation.
std::unordered_map< std::string, types::Resource > m_resources
std::vector< std::string > getAvailableResources() const
Gets a list of available resources.
static ResourceManager & getInstance()
Gets the singleton instance of the ResourceManager.
serif::probe::LogManager & m_logManager
std::unordered_map< std::string, bool > loadAllResources()
Loads all resources.
bool load(const std::string &name)
Loads a resource by name.
bool loadResource(std::string &name)
Loads a resource by name.
ResourceManager & operator=(const ResourceManager &)=delete
Deleted assignment operator to prevent assignment.
ResourceManager(const ResourceManager &)=delete
Deleted copy constructor to prevent copying.
std::variant< std::unique_ptr< opat::OPAT >, std::unique_ptr< serif::mesh::MeshIO >, std::unique_ptr< serif::eos::EOSio > > Resource
A variant type that can hold different types of resources.
Defines types and functions for managing resources.