gwnavruntime/visualdebug/messages/aggregateblobcategory.h Source File

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