gwnavruntime/visualdebug/messages/attributesblobs.h Source File

attributesblobs.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: MAMU - secondary contact: NOBODY
9 #ifndef Navigation_VisualDebugAttributesBlobs_H
10 #define Navigation_VisualDebugAttributesBlobs_H
11 
16 
17 namespace Kaim
18 {
19 
20 class VisualDebugAttribute;
21 class VisualDebugAttributeGroup;
22 class VisualDebugAttributeHeader;
23 class VisualDebugAttributeValues;
24 
25 class VisualDebugAttributeBlob
26 {
27 public:
28  VisualDebugAttributeBlob() {}
29 
30  BlobArray<char> m_name;
31  KyUInt32 m_valueType; // cast this to VisualDebugStatType
32  KyUInt32 m_valueCount;
33  KyInt32 m_headerIdx; // -1 if has no header, else index of the header in VisualDebugAttributeGroupBlob::m_headers
34 };
35 
36 inline void SwapEndianness(Endianness::Target e, VisualDebugAttributeBlob& self)
37 {
38  SwapEndianness(e, self.m_name);
39  SwapEndianness(e, self.m_valueType);
40  SwapEndianness(e, self.m_valueCount);
41  SwapEndianness(e, self.m_headerIdx);
42 }
43 
44 class VisualDebugAttributeBlobBuilder : public BaseBlobBuilder<VisualDebugAttributeBlob>
45 {
46 public:
47  VisualDebugAttributeBlobBuilder(VisualDebugAttribute* attribute) : m_attribute(attribute) {}
48  virtual void DoBuild();
49  VisualDebugAttribute* m_attribute;
50 };
51 
52 
53 class VisualDebugAttributeHeaderBlob
54 {
55 public:
56  VisualDebugAttributeHeaderBlob() {}
57  BlobArray<char> m_name;
58  KyInt32 m_index; // index of the header in VisualDebugAttributeGroupBlob::m_headers
59 };
60 
61 inline void SwapEndianness(Endianness::Target e, VisualDebugAttributeHeaderBlob& self)
62 {
63  SwapEndianness(e, self.m_name);
64  SwapEndianness(e, self.m_index);
65 }
66 
67 class VisualDebugAttributeHeaderBlobBuilder : public BaseBlobBuilder<VisualDebugAttributeHeaderBlob>
68 {
69 public:
70  VisualDebugAttributeHeaderBlobBuilder(VisualDebugAttributeHeader* header) : m_header(header) {}
71  virtual void DoBuild();
72  VisualDebugAttributeHeader* m_header;
73 };
74 
75 class AttributeGroupRemovalBlob
76 {
77  KY_ROOT_BLOB_CLASS(VisualDebugMessage, AttributeGroupRemovalBlob, 0)
78  KY_CLASS_WITHOUT_COPY(AttributeGroupRemovalBlob)
79 
80 public:
81  AttributeGroupRemovalBlob() {}
82 
83  BlobArray<char> m_groupName;
84  KyUInt32 m_worldElementId;
85 };
86 
87 inline void SwapEndianness(Endianness::Target e, AttributeGroupRemovalBlob& self)
88 {
89  SwapEndianness(e, self.m_groupName);
90  SwapEndianness(e, self.m_worldElementId);
91 }
92 
93 class AttributeGroupRemovalBlobBuilder : public BaseBlobBuilder<AttributeGroupRemovalBlob>
94 {
95 public:
96  AttributeGroupRemovalBlobBuilder(const char* groupName, KyUInt32 worldElementId = KyUInt32MAXVAL)
97  : m_groupName(groupName), m_worldElementId(worldElementId) {}
98 
99  virtual void DoBuild()
100  {
101  BLOB_STRING(m_blob->m_groupName, m_groupName.ToCStr());
102  BLOB_SET(m_blob->m_worldElementId, m_worldElementId);
103  }
104 private:
105  String m_groupName;
106  KyUInt32 m_worldElementId;
107 };
108 
109 
112 class AttributeGroupBlob
113 {
114  KY_ROOT_BLOB_CLASS(VisualDebugMessage, AttributeGroupBlob, 0)
115  KY_CLASS_WITHOUT_COPY(AttributeGroupBlob)
116 
117 public:
118  AttributeGroupBlob() {}
120  BlobArray<char> m_name;
123 };
124 
125 inline void SwapEndianness(Endianness::Target e, AttributeGroupBlob& self)
126 {
127  SwapEndianness(e, self.m_name);
128  SwapEndianness(e, self.m_attributes);
129  SwapEndianness(e, self.m_headers);
130 }
131 
132 class VisualDebugAttributeGroupBlobBuilder : public BaseBlobBuilder<AttributeGroupBlob>
133 {
134 public:
135  VisualDebugAttributeGroupBlobBuilder(VisualDebugAttributeGroup* attributeGroup) : m_attributeGroup(attributeGroup) {}
136  virtual void DoBuild();
137  VisualDebugAttributeGroup* m_attributeGroup;
138 };
139 
140 
141 class VisualDebugAttributeValuesBlob
142 {
143 public:
144  VisualDebugAttributeValuesBlob() {}
145 
146  BlobArray<char> m_string;
147  BlobArray<KyUInt32> m_values32; // could store a KyUInt32, KyInt32, KyFloat32 depending on attributes type (VisualDebugAttributeBlob::m_valueType)
148 };
149 
150 inline void SwapEndianness(Endianness::Target e, class VisualDebugAttributeValuesBlob& self)
151 {
152  SwapEndianness(e, self.m_string);
153  SwapEndianness(e, self.m_values32);
154 }
155 
156 class VisualDebugAttributeValuesBlobBuilder : public BaseBlobBuilder<VisualDebugAttributeValuesBlob>
157 {
158 public:
159  VisualDebugAttributeValuesBlobBuilder(VisualDebugAttributeValues* attributeValue) : m_attributeValue(attributeValue) {}
160  virtual void DoBuild();
161  VisualDebugAttributeValues* m_attributeValue;
162 };
163 
164 
167 class AttributeGroupValuesBlob
168 {
169  KY_ROOT_BLOB_CLASS(VisualDebugMessage, AttributeGroupValuesBlob, 0)
170  KY_CLASS_WITHOUT_COPY(AttributeGroupValuesBlob)
171 
172 public:
173  AttributeGroupValuesBlob() {}
174  BlobArray<char> m_name;
175  BlobArray<VisualDebugAttributeValuesBlob> m_attributesValues;
176 };
177 
178 inline void SwapEndianness(Endianness::Target e, AttributeGroupValuesBlob& self)
179 {
180  SwapEndianness(e, self.m_name);
181  SwapEndianness(e, self.m_attributesValues);
182 }
183 
184 class VisualDebugAttributeGroupValuesBlobBuilder : public BaseBlobBuilder<AttributeGroupValuesBlob>
185 {
186 public:
187  VisualDebugAttributeGroupValuesBlobBuilder(VisualDebugAttributeGroup* attributeGroup) : m_attributeGroup(attributeGroup) {}
188  virtual void DoBuild();
189  VisualDebugAttributeGroup* m_attributeGroup;
190 };
191 
192 }
193 
194 #endif
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:136
Contains attributes names, types and headers, and DOES NOT contain attributes values (see VisualDebug...
Definition: attributesblobs.h:119
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
A group of Key / valuetype / arrayof values, where the keys and types are created once...
Definition: visualdebugattributes.h:109
AttributeGroupRemovalBlob * 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
BaseBlobBuilder is an abstract base class that builds a blob within a contiguous block of memory...
Definition: baseblobbuilder.h:30
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Contains attributes values and DOES NOT contain attributes names, types and headers (see VisualDebugA...
Definition: attributesblobs.h:178
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226