gwnavruntime/visualdebug/messages/aggregateblobcategory.h Source File

aggregateblobcategory.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: BRGR - secondary contact: NOBODY
9 #ifndef Navigation_RawDataBlob_H
10 #define Navigation_RawDataBlob_H
11 
12 
19 
20 namespace Kaim
21 {
22 
23 
24 enum AggregateBlobCategory
25 {
26  // DO NOT remove, comment or change order in this enum
27  Blob_Navigation_Aggregate_SdkVersionBlob = 0,
28  Blob_Navigation_Aggregate_NavDataRawBlob = 1,
29  Blob_Navigation_Aggregate_ClientInputRawBlob = 2,
30  Blob_Navigation_Aggregate_ColDataRawBlob = 3,
31 
32  Blob_Navigation_Aggregate_Count
33 };
34 class AggregateBlobCategoryBuilder : public IBlobCategoryBuilder
35 {
36 public:
37  AggregateBlobCategoryBuilder() : IBlobCategoryBuilder(Blob_Navigation, Blob_Navigation_Aggregate, Blob_Navigation_Aggregate_Count) {}
38  virtual void Build(BlobCategory* category) const;
39 };
40 
41 // SdkVersionBlob contains the full version string describing the version of Gameware Navigation.
42 // It is used to identify the version a BlobAggregate was constructed from, or,
43 // sent by the VisualDebugServer or written in a .VisualDebug file
44 // allowing the NavigationLab to compare it to its own version.
45 class SdkVersionBlob
46 {
47  KY_ROOT_BLOB_CLASS(Aggregate, SdkVersionBlob, 0)
48 public:
49  bool GetSdkVersion(Version& version) const
50  { return Version::GetFromFullVersionString(version, m_data.GetValues()); }
51 
52 public:
53  BlobArray<char> m_data;
54 };
55 inline void SwapEndianness(Kaim::Endianness::Target e, SdkVersionBlob& self)
56 {
57  SwapEndianness(e, self.m_data);
58 }
59 
60 // Construct a SdkVersionBlob using Kaim::Version::GetFullVersion()
61 class SdkVersionBlobBuilder : public BaseBlobBuilder<SdkVersionBlob>
62 {
63 public:
64  SdkVersionBlobBuilder() {}
65 
66 private:
67  virtual void DoBuild()
68  {
69  const char* version = Version::GetFullVersion();
70  BLOB_STRING(m_blob->m_data, version);
71  }
72 };
73 
74 // This blob is a buffer containing a NavData which is a BlobAggregate and so it supports SwapEndianness by itself.
75 // Typically used to send .NavData file via VisualDebug
76 class NavDataRawBlob
77 {
78 public:
79  KY_ROOT_BLOB_CLASS(Aggregate, NavDataRawBlob, 0)
80 public:
81  BlobArray<char> m_data;
82 };
83 inline void SwapEndianness(Kaim::Endianness::Target e, NavDataRawBlob& self)
84 {
85  SwapEndianness(e, self.m_data);
86 }
87 
88 // This blob is a buffer containing a ClientInput which is a BlobAggregate and so it supports SwapEndianness by itself.
89 // Typically used to sent .ClientInput file via VisualDebug
90 class ClientInputRawBlob
91 {
92 public:
93  KY_ROOT_BLOB_CLASS(Aggregate, ClientInputRawBlob, 0)
94 public:
95  BlobArray<char> m_data;
96 };
97 inline void SwapEndianness(Kaim::Endianness::Target e, ClientInputRawBlob& self)
98 {
99  SwapEndianness(e, self.m_data);
100 }
101 
102 // This blob is a buffer containing a NavData which is a BlobAggregate and so it supports SwapEndianness by itself.
103 // Typically used to send .NavData file via VisualDebug
104 class ColDataRawBlob
105 {
106 public:
107  KY_ROOT_BLOB_CLASS(Aggregate, ColDataRawBlob, 0)
108 public:
109  BlobArray<char> m_data;
110 };
111 inline void SwapEndianness(Kaim::Endianness::Target e, ColDataRawBlob& self)
112 {
113  SwapEndianness(e, self.m_data);
114 }
115 
116 // RawDataBlobBuilder is a generic BlobBuilder used to construct blobs that are simply buffers;
117 // It is expected to contains data that supports SwapEndiannes by itself,
118 // such as BlobAggregate, for instance NavData or ClientInput.
119 template<class T>
120 class RawDataBlobBuilder : public BaseBlobBuilder<T>
121 {
122 public:
123  RawDataBlobBuilder(const char* data, KyUInt32 dataSize) : m_data(data), m_dataSize(dataSize) {}
124 
125 private:
126  virtual void DoBuild()
127  {
128  BLOB_ARRAY_COPY(this->m_blob->m_data, this->m_data, this->m_dataSize);
129  }
130 
131  const char* m_data;
132  KyUInt32 m_dataSize;
133 };
134 
135 
136 }
137 
138 #endif
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
SdkVersionBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:117
Definition: gamekitcrowddispersion.h:20
#define BLOB_STRING(str, src)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:179
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define BLOB_ARRAY_COPY(blobArray, src, count)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:161