00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CS_UTIL_DEBUG_H__
00020 #define __CS_UTIL_DEBUG_H__
00021
00022
00023
00024
00025 struct iBase;
00026 struct iObjectRegistry;
00027
00028
00029
00030
00031 #if defined(CS_DEBUG) && defined(CS_USE_GRAPHDEBUG)
00032 #define DG_ADD(obj,desc) \
00033 csDebuggingGraph::AddObject(0,(void*)(obj),false,__FILE__,__LINE__,desc)
00034 #define DG_ADDI(obj,desc) \
00035 csDebuggingGraph::AddObject(0,(void*)(obj),true,__FILE__,__LINE__,desc)
00036 #define DG_TYPE(obj,type) \
00037 csDebuggingGraph::AttachType(0,(void*)(obj),type)
00038 #define DG_DESCRIBE0(obj,desc) \
00039 csDebuggingGraph::AttachDescription(0,(void*)(obj),desc)
00040 #define DG_DESCRIBE1(obj,desc,a) \
00041 csDebuggingGraph::AttachDescription(0,(void*)(obj),desc,a)
00042 #define DG_DESCRIBE2(obj,desc,a,b) \
00043 csDebuggingGraph::AttachDescription(0,(void*)(obj),desc,a,b)
00044 #define DG_REM(obj) \
00045 csDebuggingGraph::RemoveObject(0,(void*)(obj),__FILE__,__LINE__)
00046 #define DG_ADDCHILD(parent,child) \
00047 csDebuggingGraph::AddChild(0,(void*)(parent),(void*)(child))
00048 #define DG_ADDPARENT(child,parent) \
00049 csDebuggingGraph::AddParent(0,(void*)(child),(void*)(parent))
00050 #define DG_REMCHILD(parent,child) \
00051 csDebuggingGraph::RemoveChild(0,(void*)(parent),(void*)(child))
00052 #define DG_REMPARENT(child,parent) \
00053 csDebuggingGraph::RemoveParent(0,(void*)(child),(void*)(parent))
00054 #define DG_LINK(parent,child) \
00055 csDebuggingGraph::AddChild(0,(void*)(parent),(void*)(child)); \
00056 csDebuggingGraph::AddParent(0,(void*)(child),(void*)(parent))
00057 #define DG_UNLINK(parent,child) \
00058 csDebuggingGraph::RemoveChild(0,(void*)(parent),(void*)(child)); \
00059 csDebuggingGraph::RemoveParent(0,(void*)(child),(void*)(parent))
00060 #else
00061 #define DG_ADD(obj,desc)
00062 #define DG_ADDI(obj,desc)
00063 #define DG_TYPE(obj,type)
00064 #define DG_DESCRIBE0(obj,desc)
00065 #define DG_DESCRIBE1(obj,desc,a)
00066 #define DG_DESCRIBE2(obj,desc,a,b)
00067 #define DG_REM(obj)
00068 #define DG_ADDCHILD(parent,child)
00069 #define DG_ADDPARENT(child,parent)
00070 #define DG_REMCHILD(parent,child)
00071 #define DG_REMPARENT(child,parent)
00072 #define DG_LINK(parent,child)
00073 #define DG_UNLINK(parent,child)
00074 #endif
00075
00082 class csDebuggingGraph
00083 {
00084 public:
00092 static void SetupGraph (iObjectRegistry* object_reg);
00093
00098 static void AddObject (iObjectRegistry* object_reg,
00099 void* object, bool scf, char* file, int linenr,
00100 char* description, ...);
00101
00105 static void AttachDescription (iObjectRegistry* object_reg,
00106 void* object, char* description, ...) CS_GNUC_PRINTF (3, 4);
00107
00111 static void AttachType (iObjectRegistry* object_reg,
00112 void* object, char* type);
00113
00117 static void RemoveObject (iObjectRegistry* object_reg,
00118 void* object, char* file, int linenr);
00119
00123 static void AddChild (iObjectRegistry* object_reg,
00124 void* parent, void* child);
00125
00129 static void AddParent (iObjectRegistry* object_reg,
00130 void* child, void* parent);
00131
00135 static void RemoveChild (iObjectRegistry* object_reg,
00136 void* parent, void* child);
00137
00141 static void RemoveParent (iObjectRegistry* object_reg,
00142 void* child, void* parent);
00143
00147 static void Clear (iObjectRegistry* object_reg);
00148
00152 static void Dump (iObjectRegistry* object_reg);
00153
00158 static void Dump (iObjectRegistry* object_reg, void* object,
00159 bool reset_mark = true);
00160 };
00161
00162 #endif //__CS_UTIL_DEBUG_H__
00163