| 1 | /*************************************************************************** |
| 2 | object.h - description |
| 3 | ------------------- |
| 4 | begin : Thu Apr 20 2000 |
| 5 | copyright : (C) 2000 by Waldemar Baraldi |
| 6 | email : [email protected] |
| 7 | ***************************************************************************/ |
| 8 | |
| 9 | #ifndef OBJECT_H |
| 10 | #define OBJECT_H |
| 11 | |
| 12 | #include <math.h> |
| 13 | #include <stdlib.h> |
| 14 | #include <stdio.h> |
| 15 | #include <typeinfo> |
| 16 | |
| 17 | #define PI 3.1415 |
| 18 | #define DSIZE 1024*1024 |
| 19 | |
| 20 | class Object{ |
| 21 | public: |
| 22 | Object(){ |
| 23 | /* if (index<DSIZE) |
| 24 | all[index++]=this;*/ |
| 25 | } |
| 26 | |
| 27 | virtual ~Object(){ |
| 28 | /* bool ready=false; |
| 29 | for (int i=0;i<DSIZE && !ready;i++){ |
| 30 | if (all[i]==this){ |
| 31 | all[i]=NULL; |
| 32 | ready=true; |
| 33 | } |
| 34 | } */ |
| 35 | } |
| 36 | |
| 37 | virtual void reportLeaks(){ |
| 38 | int end=DSIZE; |
| 39 | if (index<DSIZE) |
| 40 | end=index; |
| 41 | else |
| 42 | printf("Not complete\n"); |
| 43 | |
| 44 | for (int i=0;i<end;i++){ |
| 45 | if (all[i]!=NULL) |
| 46 | printf("%s\n", typeid(*(all[i])).name()); |
| 47 | } |
| 48 | } |
| 49 | protected: |
| 50 | static int index; |
| 51 | static Object * all[]; |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | #endif |
| 56 |