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

JErrorController Class Reference

#include <JErrorController.hpp>

List of all members.

Public Methods

 JErrorController ()
virtual ~JErrorController ()
void call (JErrorLevel level, int no, const char *errmsg, int line, const char *file)
void add (JErrorNo no, void(*fn)(JErrorLevel level, JErrorNo no, const char *errmsg, int line, const char *file), short id=0)
void remove (JErrorNo no)
short getID (JErrorNo no)

Private Attributes

JErrorHandlerdefaultHandler
JErrorHandler ** array


Constructor & Destructor Documentation

JErrorController::JErrorController  
 

Definition at line 19 of file JErrorController.cpp.

00020   {
00021     array = new JErrorHandler*[ __J2K__MAX_ERROR ];
00022 
00023   //////////////////////////////////////////////////////////////////////
00024   // Assign to each error the same Error Handler                      //
00025   // i.e. Print message and quit.                                     //
00026   //                                                                  //
00027   // A more evolued version is needed since some error are not fatal  //
00028   // and should only be advertise or logged into a error.log file,    //
00029   // and the program should be resume instead.                        //
00030   //////////////////////////////////////////////////////////////////////
00031     register int i = 0;
00032     defaultHandler = new JErrorHandler();
00033 
00034     for( ; i < __J2K__MAX_ERROR; i++ ) {
00035       array[ i ] = defaultHandler;
00036     }
00037   }

JErrorController::~JErrorController   [virtual]
 

Definition at line 39 of file JErrorController.cpp.

00040   {
00041     // Optimization compiler will surely use a register.
00042     register int i = 0;
00043     for( ; i < __J2K__MAX_ERROR; i++ ) {
00044         if ( array[i] != defaultHandler ) {
00045           delete array[ i ];  // Delete each node of the array
00046         }                     // Each JErrorHandler will delete
00047     }                         // the linked-list using cascade deletion.
00048     delete   defaultHandler;
00049     delete[] array;
00050   }


Member Function Documentation

void JErrorController::add JErrorNo    no,
void(*    fn)(JErrorLevel level, JErrorNo no, const char *errmsg, int line, const char *file),
short    id = 0
 

Definition at line 88 of file JErrorController.cpp.

00091   {
00092     // Optimization compiler will surely use a register.
00093     register int n = (int)no;
00094     JErrorHandler* newHandler = new JErrorHandler( fn, array[ n ], id );
00095     array[ n ] = newHandler;
00096   }

void JErrorController::call JErrorLevel    level,
int    no,
const char *    errmsg,
int    line,
const char *    file
 

Definition at line 56 of file JErrorController.cpp.

00059   {
00060     register int n = (int)no;
00061 
00062     if ( n < 0 ) { n += __J2K__QB_OFFSET; }
00063     if ( EAGAIN       == 35     &&  n == 35    ) { n =  11; }
00064     if ( ENAMETOOLONG == 63     &&  n == 63    ) { n =  78; }
00065 
00066 #ifndef _WIN32
00067     if ( EWOULDBLOCK  == 35     &&  n == 35    ) { n =  11; }
00068     if ( EALREADY     == 37     &&  n == 37    ) { n = 149; }
00069     if ( EALREADY     == EBUSY  &&  n == EBUSY ) { n =  16; }
00070     if ( ELOOP        == 62     &&  n == 62    ) { n =  90; }
00071     if ( ESTALE       == 70     &&  n == 70    ) { n = 151; }
00072     if ( EREMOTE      == 71     &&  n == 71    ) { n =  66; }
00073     if ( EOPNOTSUPP   == 103    &&  n == 103   ) { n = 122; }
00074     if ( ESTALE       == 122    &&  n == 122   ) { n = 151; }
00075 #endif
00076 
00077     array[ n ]->elem( level, (JErrorNo)n, errmsg, line, file );
00078   }

short JErrorController::getID JErrorNo    no
 

Definition at line 119 of file JErrorController.cpp.

00120   {
00121     register int n = (int)no;
00122     JErrorHandler* temp = array[n];
00123 
00124     if ( temp == NULL ) return -1;
00125 
00126     return temp->id;
00127   }

void JErrorController::remove JErrorNo    no
 

Definition at line 104 of file JErrorController.cpp.

00105   {
00106     // Optimization compiler will surely use a register.
00107     register int n = (int)no;
00108     JErrorHandler* temp = array[n]->next;
00109 
00110       // Else temp gets deleted too.
00111       array[n]->next = NULL;
00112   
00113       if ( array[n] != defaultHandler ) {
00114         delete array[n];
00115       }
00116     array[n] = temp;
00117   }


Member Data Documentation

JErrorHandler** JErrorController::array [private]
 

Definition at line 114 of file JErrorController.hpp.

JErrorHandler* JErrorController::defaultHandler [private]
 

Definition at line 113 of file JErrorController.hpp.


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:48:47 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001