gwnavruntime/blob/baseblobhandler.h Source File

baseblobhandler.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 
8 #pragma once
9 
10 
12 
13 
14 namespace Kaim
15 {
16 
17 
18 class BaseBlobHandler : public IBlobTypeDescriptor
19 {
20  KY_CLASS_WITHOUT_COPY(BaseBlobHandler)
21 
22 public:
23  BaseBlobHandler();
24  virtual ~BaseBlobHandler();
25 
26  void Clear();
27  void ClearAndRelease();
28 
29  void InitAsWeakReference(void* blob, KyUInt32 deepBlobSize, KyUInt32 shallowBlobSize = 0);
30  void* InitAsStrongReference(KyUInt32 deepBlobSize, KyUInt32 shallowBlobSize, MemoryHeap* heap, KyInt32 memStat);
31 
32  const void* VoidBlob() const { return m_blob; }
33  void* VoidBlob() { return m_blob; }
34  void* GetMutableBlob() const { return m_blob; }
35 
36  // Retrieves the deep size (including BlobRefs) of the blob maintained by this handler.
37  KyUInt32 BlobSize() const { return m_deepBlobSize; }
38 
39  // Retrieves the deep size (including BlobRefs) of the blob maintained by this handler.
40  KyUInt32 GetDeepBlobSize() const { return m_deepBlobSize; }
41  KyUInt32 GetShallowBlobSize() const { return m_shallowBlobSize; }
42 
43  void SwapEndianess(Endianness::Target e) { DoSwapEndianness(e, m_blob); }
44 
45 public:
46  void* m_blob; //< The blob handled by this object.
47  KyUInt32 m_deepBlobSize; //< The size of #m_blob in memory including BlobRefs.
48  KyUInt32 m_shallowBlobSize; //< The size of #m_blob in memory excluding BlobRefs.
49 
50  void* m_buffer;
51  KyUInt32 m_bufferSize;
52 };
53 
54 
55 }
56 
57 
58 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::int32_t KyInt32
int32_t
Definition: types.h:24