Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
ResourceFactory.hpp
1/*
2Copyright (C) 2018,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGAMES_RESOURCEFACTORY_H
17#define AEONGAMES_RESOURCEFACTORY_H
18
19#include <algorithm>
20#include <functional>
22#include "aeongames/UniqueAnyPtr.hpp"
23
24namespace AeonGames
25{
26 class ResourceId;
31 DLL UniqueAnyPtr ConstructResource ( const ResourceId& aResourceId );
36 DLL const UniqueAnyPtr& GetDefaultResource ( uint32_t aType );
43 DLL bool RegisterResourceConstructor ( uint32_t aType, const std::function < UniqueAnyPtr ( uint32_t ) > & aConstructor, UniqueAnyPtr&& aDefaultResource = nullptr );
48 DLL bool UnregisterResourceConstructor ( uint32_t aType );
52 DLL void EnumerateResourceConstructors ( const std::function<bool ( uint32_t ) >& aEnumerator );
53}
54
55#endif
Platform-specific macros, includes, and DLL export/import definitions.
Identifies a resource by its type and path CRC32 hashes.
A type-erased owning smart pointer with unique ownership semantics.
<- This is here just for the literals
Definition AABB.hpp:31
DLL const UniqueAnyPtr & GetDefaultResource(uint32_t aType)
Get the default resource for a given type.
DLL UniqueAnyPtr ConstructResource(const ResourceId &aResourceId)
Construct a resource identified by a ResourceId.
DLL bool UnregisterResourceConstructor(uint32_t aType)
Unregister a resource constructor.
DLL void EnumerateResourceConstructors(const std::function< bool(uint32_t) > &aEnumerator)
Enumerate all registered resource constructors.
DLL bool RegisterResourceConstructor(uint32_t aType, const std::function< UniqueAnyPtr(uint32_t) > &aConstructor, UniqueAnyPtr &&aDefaultResource=nullptr)
Register a constructor for a resource type.