Main Page   Class Hierarchy   Compound List   Header Files   Compound Members  

ddgError Class Reference

A class to handle error codes and exiting on error. More...

#include <ddgerror.h>

List of all members.

Public Members

enum  codes { Success, Failure, Memory, InitializationError, FileAccess, FileRead, FileWrite, FileContent, CommandArgUnknownOption, CommandArgMissingParameter, Render, Unknown, Warning }
Define some useful error codes.

 ddgError (void)

 ~ddgError (void)

Static Public Members

void exitHandler ( void )
A function which will be called by the assert macros before exiting.

bool set (ddgErrorCode code, const char *msg, const char* filename, int line, const char *codeMsg = NULL)
Set error, if msg is NULL, use the stream buffer.

bool isError (void)
Check if an error is set.

int report (void)
Dummy method.

void memory ( const char * file, unsigned int line, long size, long count, const char *type)
Track memory usage.

bool reportMemory ( ddgStr *filename = NULL, char *s = NULL )
Report memory usage to logfile or standard out. More...

unsigned long reportTotalInUse (void)
Report the current memory in used.

unsigned long reportMaxInUse (void)
Report the maximum recorded memory in used upto this point.

void errorHandler ( void (*s)(ddgError *e))
Set the errorHandler function.

Detailed Description

A class to handle error codes and exiting on error.

In general methods should return false (ddgSuccess) if no error occured and true (ddgFailure) if there was an error. When an error occurs, the function should call Error::set and leave the message of what happened. At some point in the call stack the decision can be made to act on this error by calling Error::report or Error::exitHandler.

Member Function Documentation

bool ddgError::reportMemory (ddgStr * filename = NULL, char * s = NULL) [static]

Report memory usage to logfile or standard out.

If s is specified this string is appended to the log file. Returns true if file could not be opened.

The documentation for this class was generated from the following files:
Generated at Sun Sep 17 19:27:53 2000 for Digital Dawn Graphics Toolkit by doxygen 0.49-991205 written by Dimitri van Heesch, © 1997-1999