#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... |
This file contains definitions of some debugging macros.
Definition in file debug.h.
|
Value: if ( !(_x_) ) \ { \ PRINT_SOURCE_POSITION; \ std::cerr << "Out of memory" << std::endl; \ throw ExaltNullPointerException(); \ }
If a NULL pointer is found, current source file and the executed line are printed on stderr and ExaltNullPointerException is raised.
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. |
|
|
Value: { \ CHECK_POINTER( (_x_) ); \ delete[] (_x_); \ (_x_) = 0; \ }
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.
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. |
|
Value: { \ (_p_) = new _type_; \ CHECK_POINTER( (_p_) ); \ }
After allocating memory, the macro calls 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. |