CMagic Class Reference

#include <CMagic.h>

Inheritance diagram for CMagic:

CAttributeList CDistanceCalculator CQuery CQueryContainer CQueryTreeNode CXMLElement CAcDistanceMatrix CQHierarchy CQInvertedFile CQMultiple CQParallel CAlgorithm

List of all members.

Public Member Functions

void check () const
void checkNPrint () const
 CMagic ()
 ~CMagic ()

Private Attributes

int mMagic


Detailed Description

This is a simple class for debugging. It checks if it has been properly initialised or if it has been destroyed twice. The method is simple: On construction of a CMagicObject, its member mMagic is set to int(42). On destruction mMember is set to int(36).

Definition at line 12 of file CMagic.h.


Constructor & Destructor Documentation

CMagic::CMagic (  ) 

sets the magic number to 42

sets the magic number

Definition at line 27 of file CMagic.cc.

References mMagic.

00027               {
00028   mMagic=42;
00029 };

CMagic::~CMagic (  ) 

sets the magic number to another value (36)

sets the magic to another value

Definition at line 31 of file CMagic.cc.

References mMagic.

00031                {
00032   mMagic=36;
00033 };


Member Function Documentation

void CMagic::check (  )  const

This function checks the magic number of this and asserts to zero, if something is wrong, if things are ok, this function keeps quiet.

This function checks the magic number of this and asserts to zero, if something is wrong

Reimplemented in CAttributeList, and CXMLElement.

Definition at line 8 of file CMagic.cc.

References mMagic.

Referenced by checkNPrint().

00008                        {
00009   if(mMagic==36){
00010     cout << "Was constructed, has been destroyed in the meanwhile "
00011    << endl;
00012     assert(!"Was constructed, but destroyed to early");
00013   }else{
00014     if(mMagic!=42){
00015       cout << "The magic number is: " 
00016      << mMagic 
00017      << endl;
00018       assert(!"No construction");
00019     }
00020   }
00021 };

void CMagic::checkNPrint (  )  const

as check(), but it also prints a small message to cout, saying that the check worked.

Definition at line 22 of file CMagic.cc.

References check().

Referenced by CAttributeList::add(), CQueryTreeNode::addChild(), CQueryTreeNode::configure(), libGIFTAcDistanceMatrix_makeAccessor(), CXEVCommunication::startVisit(), and CAttributeList::stringReadAttribute().

00022                              {
00023   check();
00024   cout << "CHECKING SUCCEEDED" << endl;
00025 };


Member Data Documentation

int CMagic::mMagic [private]

This should contain the magic number if everything is right

Definition at line 14 of file CMagic.h.

Referenced by check(), CMagic(), and ~CMagic().


The documentation for this class was generated from the following files:

Generated on Wed Jan 7 00:31:09 2009 for Gift by  doxygen 1.5.6