00001 #ifndef __KMTRACEMODEL__H__ 00002 #define __KMTRACEMODEL__H__ 00003 00004 // Qt includes 00005 #include <qobject.h> 00006 #include <qstring.h> 00007 #include <qobjectlist.h> 00008 00009 // KMtraceViewer includes 00010 #include "KMtraceLeak.hh" 00011 #include "KMtraceSuppression.hh" 00012 00025 class KMtraceModel : public QObject 00026 { 00027 Q_OBJECT 00028 00029 public: 00038 KMtraceModel( QString ktreefile ); 00039 00040 ~KMtraceModel( ); 00041 00048 int getNofTotalAllocatedBlocks( ); 00049 00056 int getNofTotalAllocatedBytes( ); 00057 00064 int getNofMaximumAllocatedBlocks( ); 00065 00072 int getNofMaximumAllocatedBytes( ); 00073 00080 int getNofTotalLeaksBlocks( ); 00081 00088 int getNofTotalLeaksBytes( ); 00089 00095 QObjectList *getLeaksList( ); 00096 00103 QObjectList *getSuppressionList( ); 00104 00105 void addSuppression( KMtraceSuppression *suppression ); 00106 void deleteSuppression( KMtraceSuppression *suppression ); 00107 00108 // make sure all leaks are in the correct state (respecting the 00109 // currently set suppression) 00110 void applySuppressions( ); 00111 00112 signals: 00117 void changed( ); 00118 00119 public slots: 00120 void slotSuppressionChanged( KMtraceLeak *leak ); 00121 00122 private: 00123 // the name of the treefile 00124 QString m_ktreefile; 00125 00126 // global statistics 00127 int m_nofTotalAllocatedBlocks; 00128 int m_nofTotalAllocatedBytes; 00129 int m_nofMaximumAllocatedBlocks; 00130 int m_nofMaximumAllocatedBytes; 00131 int m_nofTotalLeaksBlocks; 00132 int m_nofTotalLeaksBytes; 00133 00134 // an object list containing all leaks 00135 QObjectList m_leaksList; 00136 00137 // a list contains all suppressed leaks 00138 QObjectList m_excludes; 00139 00140 // read suppressed leaks from kmtrace.excludes file 00141 void readSuppressions( ); 00142 void readExcludeFile( const char *name ); 00143 00144 // write suppressed leaks 00145 void writeSuppressions( ); 00146 void writeExcludeFile( const char *name ); 00147 00148 // read model (this is exclude file and the current leak file) 00149 void readModel( ); 00150 00151 bool isInSuppressList( KMtraceLeak *leak ); 00152 }; 00153 00154 #endif