gwnavruntime/blob/blobfileheader.h Source File

blobfileheader.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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 // primary contact: GUAL - secondary contact: NOBODY
9 #ifndef Navigation_BlobFileHeader_H
10 #define Navigation_BlobFileHeader_H
11 
12 
15 
16 
17 namespace Kaim
18 {
19 
20 class BaseBlobHandler;
21 
22 class BlobFileHeader
23 {
24  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
25 public:
26  static const char* MagicString() { return "BlobFile"; }
27 
28  BlobFileHeader();
29 
30  /* Sets the whole structure to zeros */
31  void Clear();
32 
33  /* Copy memoryBuffer to this and fix the endianness if needed.
34  Typically called when loading a Blob from a buffer or a file. */
35  KyResult InitFromBuffer(void* memoryBuffer, bool& isEndiannessSwap);
36 
37  /* Typically called when saving a Blob to a buffer or a file */
38  void Init(KyUInt32 blobTypeId, KyUInt32 blobTypeVersion, KyUInt32 deepBlobSize, KyUInt32 shallowBlobSize);
39 
40  void Init(const BaseBlobHandler& blobHandler);
41 
42  /* GetEndianness() works even if the endianness of the structure is swapped */
43  Endianness::Type GetEndianness() const;
44 
45  /* Swap endianness in place.
46  After SwapEndianness() is called, all subsequent calls to BlobFileHeader are invalid !
47  Swaps also m_endianness from little to big or big to little */
48  void SwapEndianness();
49 
50 public:
51  char m_magicString[12]; // BlobFile0000
52  KyUInt32 m_endianness;
53  KyUInt32 m_blobTypeId;
54  KyUInt32 m_blobTypeVersion;
55  KyUInt32 m_deepBlobSize;
56  KyUInt32 m_shallowBlobSize;
57 };
58 
59 
60 }
61 
62 
63 #endif
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
Type
Enumerates possible endianness types.
Definition: endianness.h:28
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36