CommonLibVR
BSTCreateFactoryManager.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/B/BSTHashMap.h"
5 #include "RE/B/BSTSingleton.h"
6 
7 namespace RE
8 {
9  template <class>
10  struct IBSTCreator;
11 
12  template <class Key, class T, std::uint32_t SIZE, template <class> class Singleton>
13  class BSTFactoryManager : public Singleton<BSTFactoryManager<Key, T, SIZE, Singleton>>
14  {
15  public:
16  // members
18  };
19 
20  template <class Key, class T, std::uint32_t SIZE>
21  class BSTCreateFactoryManager : public BSTFactoryManager<Key, IBSTCreator<T>, SIZE, BSTSingletonImplicit>
22  {
23  public:
24  };
25 
26  class IUIMessageData;
27  template <class, class>
28  struct BSTDerivedCreator;
29 
30  class MessageDataFactoryManager : public BSTCreateFactoryManager<BSFixedString, IUIMessageData, 16>
31  {
32  public:
34 
35  template <class T = IUIMessageData>
37  {
38  auto it = factories.find(a_type);
39  return it != factories.end() ? static_cast<const BSTDerivedCreator<T, IUIMessageData>*>(it->second) : 0;
40  }
41  };
42  static_assert(sizeof(MessageDataFactoryManager) == 0x1A8);
43 }
Definition: BSTCreateFactoryManager.h:22
Definition: BSTCreateFactoryManager.h:14
BSTStaticHashMap< Key, const T *, SIZE > factories
Definition: BSTCreateFactoryManager.h:17
Definition: BSTHashMap.h:21
Definition: IUIMessageData.h:6
Definition: BSTCreateFactoryManager.h:31
const BSTDerivedCreator< T, IUIMessageData > * GetCreator(const BSFixedString &a_type) const
Definition: BSTCreateFactoryManager.h:36
static MessageDataFactoryManager * GetSingleton()
constexpr REL::ID Singleton(static_cast< std::uint64_t >(514494))
Definition: AbsorbEffect.h:6
Definition: BSTDerivedCreator.h:10