Loading...
Searching...
No Matches
ResourceManager.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// Created by Dave Smith on 10/3/25.
6//
7
8#ifndef MALENA_RESOURCEMANAGER_H
9#define MALENA_RESOURCEMANAGER_H
10
12#include <algorithm>
13#include <unordered_map>
16#include <string>
17#include <stdexcept>
18
19namespace ml
20{
39 template<typename Manifest,
40 typename Resource,
41 bool (*loadFunction)(Resource&, const std::string&) = &fileLoader>
43 {
44 public:
55 template<typename Asset>
56 static const Resource& get(const Asset& asset);
57
68 template<typename Asset>
69 static void unload(Asset asset);
70
71 private:
79 template<typename Asset>
80 static std::unordered_map<Asset, Resource, EnumClassHash>& cache();
81 };
82
83} // namespace ml
84
85#include "../../../src/Resources/ResourceManager.tpp"
86#endif // MALENA_RESOURCEMANAGER_H
Base class for all Malena manifests.
Definition Manifest.h:51
Generic manifest-driven resource cache.
static void unload(Asset asset)
Remove a resource from the cache.
static const Resource & get(const Asset &asset)
Retrieve the cached resource for an asset enum value.
#define MALENA_API
Definition Component.h:22
bool fileLoader(Resource &r, const std::string &path)