Class Hierarchy   Class Index   Method Index  

IGCerrorClass.h

00001 #ifndef __IGC_ERROR_CLASS_H__
00002 #define __IGC_ERROR_CLASS_H__
00003 //---------------------------------------------------------------------------
00004 // Copyright (C) 1997-2009 iNTERFACEWARE Inc. All Rights Reserved
00005 //
00006 // Module: IGCerrorClass
00007 //
00008 // Description:
00009 //
00010 // IGC error exception.
00011 //
00012 // Revision: $Revision: 1.2 $
00013 // Source: $Source: /home/cvs/cvsroot/IGC/IGCerrorClass.h,v $
00014 // Author: Code Generator
00015 // Last Edit Date: $Date: 2009-04-09 19:47:40 $
00016 //---------------------------------------------------------------------------
00017 #include <IGC/IGCminimumInclude.h>
00018 
00019 #ifndef __IGC_EXCEPTION_HANDLE_H__
00020 #define __IGC_EXCEPTION_HANDLE_H__
00021 typedef void* IGCexceptionStubHandle;
00022 typedef void* IGCexceptionHandle;
00023 #endif
00024 
00025 class IGCerror
00026 {
00027 public:
00029    IGCerror(const char* Description, IGCint LineNumber, const char* FileName);
00030    IGCerror(IGCexceptionHandle Handle, IGCint LineNumber, const char* FileName);
00031    IGCerror(const IGCerror& Orig);
00032    
00034    virtual ~IGCerror();
00035    
00037    IGCerror& operator=(const IGCerror& Orig);
00038    
00039    const char* Description() const
00040    {
00041       return _Description;
00042    }
00043 
00044    IGCint LineNumber() const
00045    {
00046       return _LineNumber;
00047    }
00048 
00049    const char* FileName() const
00050    {
00051       return _FileName;
00052    }
00053 
00054 private:
00055    char* _Description;
00056    IGCint _LineNumber;
00057    char* _FileName;
00058 };
00059 
00060 #define IGC_CHECK_CALL(x)\
00061 {\
00062    IGCresult Result = IGC_DLL_CALL(x);\
00063    if (Result != IGC_OK)\
00064    {\
00065       throw IGCerror(Result, __LINE__, __FILE__);\
00066    }\
00067 }
00068 
00069 #define IGC_ASSERT(x)\
00070 if (!(x))\
00071 {\
00072    throw IGCerror(IGC_TEXT(#x), __LINE__, __FILE__);\
00073 }
00074 
00075 #endif // end of defensive include