#include <object.hpp>

Public Member Functions | |
| Object (void) | |
| Object (const Object &aObject) | |
| virtual | ~Object (void) |
| Common virtual destructor. | |
Protected Attributes | |
| int | myId |
Static Private Attributes | |
| static int | objectCount = 0 |
| static int | objectId = 0 |
| static int | objectPeak = 0 |
Definition at line 30 of file object.hpp.
| Object::Object | ( | void | ) |
Standard constructor. The allocated object is counted. If the PRINTALLOC is defined, a comment will be printed out. If NDEBUG is not defined, the objects identity myId will be defined.
Definition at line 28 of file object.cpp.
References myId, objectCount, objectId, and objectPeak.
00029 { 00030 assert( objectCount >= 0 ); 00031 if ( !objectCount ) 00032 cerr << "There are objects existing by now.\n"; 00033 myId = objectId; 00034 #ifdef PRINTALLOC 00035 cerr.form( "object %8d is allocated\n", myId ); 00036 #endif 00037 objectCount++; 00038 objectId++; 00039 if ( objectPeak < objectCount ) 00040 objectPeak = objectCount; 00041 }
| Object::Object | ( | const Object & | aObject | ) |
Copy constructor. The allocated objects are counted. If the macro PRINTALLOC is defined, a comment will be printed out.
Definition at line 46 of file object.cpp.
References myId, objectCount, objectId, and objectPeak.
00048 { 00049 assert( objectCount > 0 );// one object must exist already! 00050 myId = objectId; 00051 #ifdef PRINTALLOC 00052 cerr.form( "object %8d is allocated (copy from %8d)\n", myId, aObject.myId ); 00053 #endif 00054 objectCount++; 00055 objectId++; 00056 if ( objectPeak < objectCount ) 00057 objectPeak = objectCount; 00058 }
| Object::~Object | ( | void | ) | [virtual] |
Common virtual destructor.
Definition at line 60 of file object.cpp.
References myId, objectCount, objectId, and objectPeak.
00061 { 00062 #ifdef PRINTALLOC 00063 cerr.form( "object %8d is disposed\n", myId ); 00064 #endif 00065 assert( myId >= 0 ); 00066 myId = -1; 00067 objectCount--; 00068 if ( !objectCount ) { 00069 cerr << "There are no objects existing by now." << endl 00070 << "Number of object-allocations:" << objectId << endl 00071 << "Peak number of allocations:" << objectPeak << endl; 00072 }; 00073 assert( objectCount >= 0 ); 00074 }
int Object::myId [protected] |
int Object::objectCount = 0 [static, private] |
int Object::objectId = 0 [static, private] |
int Object::objectPeak = 0 [static, private] |