Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Factory.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <Jolt/Core/RTTI.h>
9
11
14{
15public:
17
19 void * CreateObject(const char *inName);
20
22 const RTTI * Find(const char *inName);
23
25 const RTTI * Find(uint32 inHash);
26
28 bool Register(const RTTI *inRTTI);
29
31 bool Register(const RTTI **inRTTIs, uint inNumber);
32
34 void Clear();
35
37 Array<const RTTI *> GetAllClasses() const;
38
41
42private:
43 using ClassNameMap = UnorderedMap<string_view, const RTTI *>;
44
45 using ClassHashMap = UnorderedMap<uint32, const RTTI *>;
46
48 ClassNameMap mClassNameMap;
49
50 // Map of class hash to type info
51 ClassHashMap mClassHashMap;
52};
53
#define JPH_EXPORT
Definition: Core.h:227
unsigned int uint
Definition: Core.h:439
#define JPH_NAMESPACE_END
Definition: Core.h:367
std::uint32_t uint32
Definition: Core.h:442
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:29
std::vector< T, STLAllocator< T > > Array
Definition: STLAllocator.h:81
std::unordered_map< Key, T, Hash, KeyEqual, STLAllocator< pair< const Key, T > > > UnorderedMap
Definition: UnorderedMap.h:13
This class is responsible for creating instances of classes based on their name or hash and is mainly...
Definition: Factory.h:14
static Factory * sInstance
Singleton factory instance.
Definition: Factory.h:40
Definition: RTTI.h:122