CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csutil/debug.h

00001 /*
00002     Copyright (C) 2001 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_UTIL_DEBUG_H__
00020 #define __CS_UTIL_DEBUG_H__
00021 
00022 #include "csextern.h"
00023 
00024 // Enable the following define to have the DG_... macros.
00025 //#define CS_USE_GRAPHDEBUG
00026 
00027 struct iBase;
00028 struct iObjectRegistry;
00029 
00030 // The following versions of the defines are only available in
00031 // debug mode. In release mode they do nothing. They expect SetupGraph()
00032 // to be called with a valid object registry.
00033 #if defined(CS_DEBUG) && defined(CS_USE_GRAPHDEBUG)
00034 #define DG_ADD(obj,desc) \
00035   csDebuggingGraph::AddObject(0,(void*)(obj),false,__FILE__,__LINE__,desc)
00036 #define DG_ADDI(obj,desc) \
00037   csDebuggingGraph::AddObject(0,(void*)(obj),true,__FILE__,__LINE__,desc)
00038 #define DG_TYPE(obj,type) \
00039   csDebuggingGraph::AttachType(0,(void*)(obj),type)
00040 #define DG_DESCRIBE0(obj,desc) \
00041   csDebuggingGraph::AttachDescription(0,(void*)(obj),desc)
00042 #define DG_DESCRIBE1(obj,desc,a) \
00043   csDebuggingGraph::AttachDescription(0,(void*)(obj),desc,a)
00044 #define DG_DESCRIBE2(obj,desc,a,b) \
00045   csDebuggingGraph::AttachDescription(0,(void*)(obj),desc,a,b)
00046 #define DG_REM(obj) \
00047   csDebuggingGraph::RemoveObject(0,(void*)(obj),__FILE__,__LINE__)
00048 #define DG_ADDCHILD(parent,child) \
00049   csDebuggingGraph::AddChild(0,(void*)(parent),(void*)(child))
00050 #define DG_ADDPARENT(child,parent) \
00051   csDebuggingGraph::AddParent(0,(void*)(child),(void*)(parent))
00052 #define DG_REMCHILD(parent,child) \
00053   csDebuggingGraph::RemoveChild(0,(void*)(parent),(void*)(child))
00054 #define DG_REMPARENT(child,parent) \
00055   csDebuggingGraph::RemoveParent(0,(void*)(child),(void*)(parent))
00056 #define DG_LINK(parent,child) \
00057   csDebuggingGraph::AddChild(0,(void*)(parent),(void*)(child)); \
00058   csDebuggingGraph::AddParent(0,(void*)(child),(void*)(parent))
00059 #define DG_UNLINK(parent,child) \
00060   csDebuggingGraph::RemoveChild(0,(void*)(parent),(void*)(child)); \
00061   csDebuggingGraph::RemoveParent(0,(void*)(child),(void*)(parent))
00062 #else
00063 #define DG_ADD(obj,desc)
00064 #define DG_ADDI(obj,desc)
00065 #define DG_TYPE(obj,type)
00066 #define DG_DESCRIBE0(obj,desc)
00067 #define DG_DESCRIBE1(obj,desc,a)
00068 #define DG_DESCRIBE2(obj,desc,a,b)
00069 #define DG_REM(obj)
00070 #define DG_ADDCHILD(parent,child)
00071 #define DG_ADDPARENT(child,parent)
00072 #define DG_REMCHILD(parent,child)
00073 #define DG_REMPARENT(child,parent)
00074 #define DG_LINK(parent,child)
00075 #define DG_UNLINK(parent,child)
00076 #endif
00077 
00084 class CS_CSUTIL_EXPORT csDebuggingGraph
00085 {
00086 public:
00094   static void SetupGraph (iObjectRegistry* object_reg);
00095 
00100   static void AddObject (iObjectRegistry* object_reg,
00101         void* object, bool scf, char* file, int linenr,
00102         char* description, ...);
00103 
00107   static void AttachDescription (iObjectRegistry* object_reg,
00108         void* object, char* description, ...) CS_GNUC_PRINTF (3, 4);
00109 
00113   static void AttachType (iObjectRegistry* object_reg,
00114         void* object, char* type);
00115 
00119   static void RemoveObject (iObjectRegistry* object_reg,
00120         void* object, char* file, int linenr);
00121 
00125   static void AddChild (iObjectRegistry* object_reg,
00126         void* parent, void* child);
00127 
00131   static void AddParent (iObjectRegistry* object_reg,
00132         void* child, void* parent);
00133 
00137   static void RemoveChild (iObjectRegistry* object_reg,
00138         void* parent, void* child);
00139 
00143   static void RemoveParent (iObjectRegistry* object_reg,
00144         void* child, void* parent);
00145 
00149   static void Clear (iObjectRegistry* object_reg);
00150 
00154   static void Dump (iObjectRegistry* object_reg);
00155 
00160   static void Dump (iObjectRegistry* object_reg, void* object,
00161         bool reset_mark = true);
00162 };
00163 
00164 #endif //__CS_UTIL_DEBUG_H__
00165 

Generated for Crystal Space by doxygen 1.2.18