9 #ifndef GwNavRuntime_VisualDebugAttributes_H
10 #define GwNavRuntime_VisualDebugAttributes_H
20 class SentBlobTypeStats;
21 class VisualDebugServer;
23 enum VisualDebugStatType
25 VisualDebugStatType_UInt = Kaim::BlobField32::Type_KyUInt32,
26 VisualDebugStatType_Int = Kaim::BlobField32::Type_KyInt32,
27 VisualDebugStatType_Float = Kaim::BlobField32::Type_KyFloat32,
28 VisualDebugStatType_String
31 class VisualDebugAttributeHeader
35 VisualDebugAttributeHeader(const
char* name) : m_name(name) {}
41 class VisualDebugAttributeValues
45 VisualDebugAttributeValues(
KyUInt32 value32Count)
47 m_values32.Resize(value32Count);
48 for (UPInt i = 0; i < value32Count; ++i)
52 void AddInt32Value(
KyInt32 val) { m_values32.PushBack(*(
KyUInt32*)&val); }
53 void AddUInt32Value(
KyUInt32 val) { m_values32.PushBack(val); }
54 void AddValue32(
KyUInt32 val) { m_values32.PushBack(val); }
57 void SetStringValue(
const char* val) { m_stringValue = val; }
58 void SetInt32Value(
KyInt32 val,
KyUInt32 idx = 0) {
if (OutOfValuesBound(idx) ==
false) m_values32[idx] = *(
KyUInt32*)&val; }
59 void SetUInt32Value(
KyUInt32 val,
KyUInt32 idx = 0) {
if (OutOfValuesBound(idx) ==
false) m_values32[idx] = val; }
60 void SetValue32(
KyUInt32 val,
KyUInt32 idx = 0) {
if (OutOfValuesBound(idx) ==
false) m_values32[idx] = val; }
63 const String& GetStringValue()
const {
return m_stringValue; }
64 KyInt32 GetInt32Value(
KyUInt32 idx)
const {
if (OutOfValuesBound(idx))
return 0;
else return *(
KyInt32*)(&m_values32[idx]); }
65 KyUInt32 GetUInt32Value(
KyUInt32 idx)
const {
if (OutOfValuesBound(idx))
return 0;
else return m_values32[idx]; }
69 bool OutOfValuesBound(
KyUInt32 valueIndex)
const
71 KY_ASSERT(valueIndex < m_values32.GetSize());
72 if (valueIndex < m_values32.GetSize())
80 KyArray<KyUInt32> m_values32;
83 class VisualDebugAttribute
87 VisualDebugAttribute() : m_name(""), m_valueType(VisualDebugStatType_UInt) {}
89 VisualDebugAttribute(
const char* name) : m_name(name) {}
92 VisualDebugStatType m_valueType;
93 VisualDebugAttributeValues* m_values;
94 VisualDebugAttributeHeader* m_header;
103 class VisualDebugAttributeGroup
107 VisualDebugAttributeGroup() : m_name(""), m_descriptionSent(false) {}
108 VisualDebugAttributeGroup(
const char* name) : m_name(name), m_descriptionSent(false) {}
114 VisualDebugAttributeHeader* GetOrCreateHeader(
const char* headerName);
118 VisualDebugAttribute* CreateFloatStatAttribute (
const char* name,
KyUInt32 statValueEnum);
119 VisualDebugAttribute* CreateSentItemsAttribute(
const char* name,
KyUInt32 statValueEnum);
120 VisualDebugAttribute* CreateIntAttribute (
const char* name,
KyUInt32 statValueEnum,
KyUInt32 valueCount = 1, VisualDebugAttributeHeader* header =
KY_NULL);
121 VisualDebugAttribute* CreateUIntAttribute(
const char* name,
KyUInt32 statValueEnum,
KyUInt32 valueCount = 1, VisualDebugAttributeHeader* header =
KY_NULL);
122 VisualDebugAttribute* CreateStringAttribute(
const char* name,
KyUInt32 statValueEnum, VisualDebugAttributeHeader* header =
KY_NULL);
130 void UpdateSentItemsValues(
KyUInt32 valEnum,
const SentBlobTypeStats& stats);
138 void SetDescriptionSent(
bool descriptionSent) { m_descriptionSent = descriptionSent; }
147 VisualDebugAttribute* CreateStatItem(
const char* name, VisualDebugAttributeValues* statValue, VisualDebugStatType type
148 ,
KyUInt32 statValueEnum, VisualDebugAttributeHeader* header);
155 bool m_descriptionSent;
void SendGroupValues(VisualDebugServer *visualDebugServer)
Send the group values (items' values only)
void UpdateStringValue(KyUInt32 valEnum, const char *val)
Call this to update your stat group.
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
#define KY_NULL
Null value.
Definition: types.h:247
void SendGroupDescription(VisualDebugServer *visualDebugServer)
Send the group description (items' names, types, headers)
A group of Key / valuetype / arrayof values, where the keys and types are created once...
Definition: visualdebugattributes.h:109
VisualDebugAttribute * CreateFloatAttribute(const char *name, KyUInt32 statValueEnum, KyUInt32 valueCount=1, VisualDebugAttributeHeader *header=0)
Call these to build your stat group.
FloatStat maintains current, average, min, max statistics in a sliding window of frames.
Definition: floatstat.h:23
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
bool IsDescriptionSent()
The decription must be sent only once on creation or on reconnection.
Definition: visualdebugattributes.h:144
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43