Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

debug.h File Reference

Debugging macros. More...

#include <iostream>
#include "exceptions.h"

Go to the source code of this file.

Defines

#define DBG(_x_)   {}
 Macro for reporting debugging messages.

#define PRINT_SOURCE_POSITION   std::cerr << "In file " << __FILE__ << ", line " << __LINE__ << ": "
 Macro for printing the name of current source file and line executed.

#define CHECK_POINTER(_x_)
 Macro testing for NULL pointers. More...

#define DELETE(_x_)
 Macro for safer delete. More...

#define DELETE_ARRAY(_x_)
 Macro for safer delete of arrays. More...

#define NEW(_p_, _type_)
 Macro for safer new. More...


Detailed Description

Debugging macros.

This file contains definitions of some debugging macros.

Definition in file debug.h.


Define Documentation

#define CHECK_POINTER _x_   
 

Value:

if ( !(_x_) )                                   \
  {                                             \
    PRINT_SOURCE_POSITION;                      \
    std::cerr << "Out of memory" << std::endl;  \
    throw ExaltNullPointerException();          \
  }
Macro testing for NULL pointers.

If a NULL pointer is found, current source file and the executed line are printed on stderr and ExaltNullPointerException is raised.

Parameters:
_x_  Pointer.

Definition at line 50 of file debug.h.

Referenced by XmlCodec::decode, XmlParser::initParser, XmlSimpleModel::manageEvent, XmlAdaptiveModel::manageEvent, XmlSimpleModel::receiveData, XmlAdaptiveModel::receiveData, KYGrammar::reductionRule1, KYGrammar::reductionRule2, KYGrammar::reductionRule3, and KYGrammar::ruleMatchesInput.

#define DELETE _x_   
 

Value:

{                               \
  CHECK_POINTER( (_x_) );       \
  delete (_x_);                 \
  (_x_) = 0;                    \
}
Macro for safer delete.

Macro checks if given pointer isn't NULL (with CHECK_POINTER()). This ensures that deletion of NULL pointers will not occur. After deleting the data, the pointer is set to NULL.

Parameters:
_x_  Pointer.
See also:
DELETE_ARRAY(), CHECK_POINTER()

Definition at line 68 of file debug.h.

Referenced by Stack< ElementModelerInfo >::clear, Queue< DataQueueItem >::clear, List< TestedRule >::clear, HashTable< XmlChar *, unsigned long, List, 3079 >::clear, KYGrammar::createRule, XmlCodec::decode, ExaltCodec::decode, UserOfTextCodec::deleteDefaultTextCodec, Queue< DataQueueItem >::dequeue, KYGrammar::eatData, XmlCodec::encode, ExaltCodec::encode, XmlCodec::encodePush, List< TestedRule >::getFirst, main, XmlSimpleModel::manageEvent, XmlAdaptiveModel::manageEvent, Stack< ElementModelerInfo >::pop, KYGrammar::purge, XmlSimpleModel::receiveData, XmlAdaptiveModel::receiveData, KYGrammar::reductionRule1, KYGrammar::reductionRule2, KYGrammar::reductionRule3, List< TestedRule >::remove, HashTableBucket< XmlChar *, unsigned, HashTableBucketContainer_ >::removeItem, ExaltCodec::~ExaltCodec, KYGrammar::~KYGrammar, XmlAdaptiveModel::~XmlAdaptiveModel, and XmlSimpleModel::~XmlSimpleModel.

#define DELETE_ARRAY _x_   
 

Value:

{                               \
  CHECK_POINTER( (_x_) );       \
  delete[] (_x_);               \
  (_x_) = 0;                    \
}
Macro for safer delete of arrays.

Macro checks if given pointer isn't NULL (with CHECK_POINTER()). This ensures that deletion of NULL pointers will not occur. After deleting the array, the pointer is set to NULL.

Parameters:
_x_  Pointer.
See also:
DELETE(), CHECK_POINTER()

Definition at line 85 of file debug.h.

Referenced by XmlParser::endElement, XmlParser::startElement, FunnelDevice::~FunnelDevice, HashTable< XmlChar *, unsigned long, List, 3079 >::~HashTable, and KYGrammar::~KYGrammar.

#define NEW _p_,
_type_   
 

Value:

{                               \
  (_p_) = new _type_;           \
  CHECK_POINTER( (_p_) );       \
}
Macro for safer new.

After allocating memory, the macro calls CHECK_POINTER().

Parameters:
_p_  A variable
_type_  Type of the variable (or better: the parameter of new)
See also:
CHECK_POINTER()

Definition at line 103 of file debug.h.

Referenced by List< TestedRule >::append, KYGrammar::append, KYGrammar::appendToRootRule, ElementModelEntropyCalculator::calculate, XmlParser::characterData, XmlParser::comment, UserOfTextCodec::createDefaultTextCodec, KYGrammar::createRootRule, KYGrammar::createRule, XmlCodec::decode, ExaltCodec::decode, XmlParser::defaultHandler, KYGrammar::eatData, XmlCodec::encode, ExaltCodec::encode, XmlParser::endCDATASection, XmlParser::endDoctypeDecl, XmlParser::endElement, Queue< DataQueueItem >::enqueue, XmlParser::entityDecl, ExaltCodec::ExaltCodec, HashTable< XmlChar *, unsigned long, List, 3079 >::HashTable, XmlCodec::initializePushCoder, ExaltCodec::initializePushCoder, KYGrammar::initKYGrammar, XmlParser::initParser, List< TestedRule >::insert, HashTable< XmlChar *, unsigned long, List, 3079 >::insert, main, XmlSimpleModel::manageEvent, XmlAdaptiveModel::manageEvent, XmlParser::notationDecl, FunnelDevice::prepare, List< TestedRule >::prepend, XmlParser::processingInstruction, KYGrammar::purge, Stack< ElementModelerInfo >::push, XmlSimpleModel::receiveData, XmlAdaptiveModel::receiveData, KYGrammar::reductionRule1, KYGrammar::reductionRule2, KYGrammar::reductionRule3, XmlParser::startCDATASection, XmlParser::startDoctypeDecl, XmlParser::startElement, XmlParser::unknownEncoding, XmlAdaptiveModel::XmlAdaptiveModel, XmlParser::xmlDecl, and XmlSimpleModel::XmlSimpleModel.


Generated on Wed Feb 5 10:43:03 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002