gwnavruntime/blob/blobregistry.h Source File

blobregistry.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 #pragma once
8 
12 
13 namespace Kaim
14 {
15 
16 class IBlobCategoryBuilder;
17 class BlobCategory;
18 class IBlobTypeDescriptor;
19 
20 struct OnBlobUnknown { enum Enum { DoNothing = 0, DoError = 1, DoAssert = 2, DoErrorAndAssert }; };
21 
22 class BlobNameSpace
23 {
24  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_BaseSystem)
25 
26 public:
27  BlobNameSpace(KyUInt32 nameSpaceEnum, KyUInt32 categoryCount);
28  ~BlobNameSpace();
29 
30  void AddCategory(IBlobCategoryBuilder* categoryBuilder);
31 
32  BlobCategory* GetCategory(KyUInt32 categoryEnum) { return m_categories[categoryEnum]; }
33 
34  IBlobTypeDescriptor* GetDescriptor(KyUInt32 blobTypeId, OnBlobUnknown::Enum onUnknown = OnBlobUnknown::DoErrorAndAssert);
35 
36 public:
37  KyUInt32 m_nameSpaceEnum;
38  KyArray<BlobCategory*, MemStat_BaseSystem> m_categories;
39 };
40 
41 class BlobRegistry
42 {
43  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_BaseSystem)
44 
45 public:
46  static void Init();
47  static void Destroy();
48 
49  static void AddCategory(IBlobCategoryBuilder* categoryBuilder);
50  static IBlobTypeDescriptor* GetDescriptor(KyUInt32 blobTypeId, OnBlobUnknown::Enum onUnknown = OnBlobUnknown::DoAssert);
51 
52 public:
53  static BlobNameSpace* GetNameSpace(KyUInt32 nameSpaceEnum);
54  static BlobNameSpace* GetOrCreateNameSpace(KyUInt32 nameSpaceEnum, KyUInt32 categoryCount);
55 
56 private:
57  static BlobRegistry* s_instance;
58  ~BlobRegistry();
59 
60 private:
61  KyArray<BlobNameSpace*, MemStat_BaseSystem> m_nameSpaces;
62 };
63 
64 
65 }
66 
67 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17