gwnavruntime/visualdebug/messages/attributesblobs.h Source File

attributesblobs.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 
14 
15 namespace Kaim
16 {
17 
18 class VisualDebugAttribute;
19 class VisualDebugAttributeGroup;
20 class VisualDebugAttributeHeader;
21 class VisualDebugAttributeValues;
22 
23 class VisualDebugAttributeBlob
24 {
25 public:
26  VisualDebugAttributeBlob() {}
27 
28  BlobArray<char> m_name;
29  KyUInt32 m_valueType; // cast this to VisualDebugStatType
30  KyUInt32 m_valueCount;
31  KyInt32 m_headerIdx; // -1 if has no header, else index of the header in VisualDebugAttributeGroupBlob::m_headers
32 };
33 
34 inline void SwapEndianness(Endianness::Target e, VisualDebugAttributeBlob& self)
35 {
36  SwapEndianness(e, self.m_name);
37  SwapEndianness(e, self.m_valueType);
38  SwapEndianness(e, self.m_valueCount);
39  SwapEndianness(e, self.m_headerIdx);
40 }
41 
42 class VisualDebugAttributeBlobBuilder : public BaseBlobBuilder<VisualDebugAttributeBlob>
43 {
44 public:
45  VisualDebugAttributeBlobBuilder(VisualDebugAttribute* attribute) : m_attribute(attribute) {}
46  virtual void DoBuild();
47  VisualDebugAttribute* m_attribute;
48 };
49 
50 
51 class VisualDebugAttributeHeaderBlob
52 {
53 public:
54  VisualDebugAttributeHeaderBlob() {}
55  BlobArray<char> m_name;
56  KyInt32 m_index; // index of the header in VisualDebugAttributeGroupBlob::m_headers
57 };
58 
59 inline void SwapEndianness(Endianness::Target e, VisualDebugAttributeHeaderBlob& self)
60 {
61  SwapEndianness(e, self.m_name);
62  SwapEndianness(e, self.m_index);
63 }
64 
65 class VisualDebugAttributeHeaderBlobBuilder : public BaseBlobBuilder<VisualDebugAttributeHeaderBlob>
66 {
67 public:
68  VisualDebugAttributeHeaderBlobBuilder(VisualDebugAttributeHeader* header) : m_header(header) {}
69  virtual void DoBuild();
70  VisualDebugAttributeHeader* m_header;
71 };
72 
73 class AttributeGroupRemovalBlob
74 {
75  KY_ROOT_BLOB_CLASS(VisualDebugMessage, AttributeGroupRemovalBlob, 0)
76  KY_CLASS_WITHOUT_COPY(AttributeGroupRemovalBlob)
77 
78 public:
79  AttributeGroupRemovalBlob() {}
80 
81  BlobArray<char> m_groupName;
82  KyUInt32 m_worldElementId;
83 };
84 
85 inline void SwapEndianness(Endianness::Target e, AttributeGroupRemovalBlob& self)
86 {
87  SwapEndianness(e, self.m_groupName);
88  SwapEndianness(e, self.m_worldElementId);
89 }
90 
91 class AttributeGroupRemovalBlobBuilder : public BaseBlobBuilder<AttributeGroupRemovalBlob>
92 {
93 public:
94  AttributeGroupRemovalBlobBuilder(const char* groupName, KyUInt32 worldElementId = KyUInt32MAXVAL)
95  : m_groupName(groupName), m_worldElementId(worldElementId) {}
96 
97  virtual void DoBuild()
98  {
99  BLOB_STRING(m_blob->m_groupName, m_groupName.ToCStr());
100  BLOB_SET(m_blob->m_worldElementId, m_worldElementId);
101  }
102 private:
103  String m_groupName;
104  KyUInt32 m_worldElementId;
105 };
106 
107 
111 {
112  KY_ROOT_BLOB_CLASS(VisualDebugMessage, AttributeGroupBlob, 0)
114 
115 public:
116  AttributeGroupBlob() {}
117 
118  BlobArray<char> m_name;
121 };
122 
123 inline void SwapEndianness(Endianness::Target e, AttributeGroupBlob& self)
124 {
125  SwapEndianness(e, self.m_name);
126  SwapEndianness(e, self.m_attributes);
127  SwapEndianness(e, self.m_headers);
128 }
129 
130 class VisualDebugAttributeGroupBlobBuilder : public BaseBlobBuilder<AttributeGroupBlob>
131 {
132 public:
133  VisualDebugAttributeGroupBlobBuilder(VisualDebugAttributeGroup* attributeGroup) : m_attributeGroup(attributeGroup) {}
134  virtual void DoBuild();
135  VisualDebugAttributeGroup* m_attributeGroup;
136 };
137 
138 
139 class VisualDebugAttributeValuesBlob
140 {
141 public:
142  VisualDebugAttributeValuesBlob() {}
143 
144  BlobArray<char> m_string;
145  BlobArray<KyUInt32> m_values32; // could store a KyUInt32, KyInt32, KyFloat32 depending on attributes type (VisualDebugAttributeBlob::m_valueType)
146 };
147 
148 inline void SwapEndianness(Endianness::Target e, class VisualDebugAttributeValuesBlob& self)
149 {
150  SwapEndianness(e, self.m_string);
151  SwapEndianness(e, self.m_values32);
152 }
153 
154 class VisualDebugAttributeValuesBlobBuilder : public BaseBlobBuilder<VisualDebugAttributeValuesBlob>
155 {
156 public:
157  VisualDebugAttributeValuesBlobBuilder(VisualDebugAttributeValues* attributeValue) : m_attributeValue(attributeValue) {}
158  virtual void DoBuild();
159  VisualDebugAttributeValues* m_attributeValue;
160 };
161 
162 
166 {
167  KY_ROOT_BLOB_CLASS(VisualDebugMessage, AttributeGroupValuesBlob, 0)
169 
170 public:
172  BlobArray<char> m_name;
174 };
175 
176 inline void SwapEndianness(Endianness::Target e, AttributeGroupValuesBlob& self)
177 {
178  SwapEndianness(e, self.m_name);
179  SwapEndianness(e, self.m_attributesValues);
180 }
181 
182 class VisualDebugAttributeGroupValuesBlobBuilder : public BaseBlobBuilder<AttributeGroupValuesBlob>
183 {
184 public:
185  VisualDebugAttributeGroupValuesBlobBuilder(VisualDebugAttributeGroup* attributeGroup) : m_attributeGroup(attributeGroup) {}
186  virtual void DoBuild();
187  VisualDebugAttributeGroup* m_attributeGroup;
188 };
189 
190 }
191 
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:130
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Contains attributes names, types and headers, and DOES NOT contain attributes values (see VisualDebug...
Definition: attributesblobs.h:110
#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
AttributeGroupRemovalBlob * 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
std::int32_t KyInt32
int32_t
Definition: types.h:24
Contains attributes values and DOES NOT contain attributes names, types and headers (see VisualDebugA...
Definition: attributesblobs.h:165
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68