Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

rtxCppException.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2004 by Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00028 #ifndef _RTXCPPEXCEPTION_H_
00029 #define _RTXCPPEXCEPTION_H_
00030 
00031 #include "rtxsrc/rtxCommon.h"
00032 #include "rtxsrc/rtxCppContext.h"
00033 
00034 #ifndef _NO_EXCEPTIONS
00035 #define OSTRY try
00036 #define OSRTLTHROW1(stat) throw OSRTLException(stat)
00037 #define OSRTLTHROW2(ctxt,stat) throw OSRTLException(ctxt,stat)
00038 #define OSTHROW(ex) throw (ex)
00039 #define OSCATCH(exType,ex,body) catch (exType ex) { body; }
00040 #else 
00041 #define OSTRY
00042 #define OSRTLTHROW1(stat) do { \
00043 fprintf (stderr, "Fatal Error in %s at %i, stat = %i\n", __FILE__, __LINE__, stat); \
00044 exit (-1); \
00045 } while(0)
00046 #define OSRTLTHROW2(ctxt,stat) do { \
00047 rtxErrPrint (ctxt); \
00048 fprintf (stderr, "Fatal Error in %s at %i, stat = %i\n", __FILE__, __LINE__, stat); \
00049 exit (-1); \
00050 } while(0)
00051 
00052 #define OSTHROW(ex) do { \
00053 fprintf (stderr, "Fatal Error in %s at %i\n", __FILE__, __LINE__); \
00054 exit (-1); \
00055 } while (0)
00056 #define OSCATCH(exType,ex,body)
00057 #endif
00058 
00062 class EXTERNRTX OSRTLException {
00063  protected:
00064    OSCtxtPtr mpContext;
00065 
00070    int mStatus;
00071 
00072    OSRTLException () : mStatus(0) {}
00073 
00074  public:
00081    OSRTLException (int stat) : mStatus(stat) {}
00082 
00090    OSRTLException (OSContext* pContext, int stat) : 
00091       mpContext (pContext), mStatus(stat) {}
00092 
00098    OSRTLException (const OSRTLException& o) : 
00099       mpContext (o.mpContext), mStatus(o.mStatus) {}
00100 
00105    virtual ~OSRTLException () {}
00106 
00110    int getStatus () const { return (mStatus); }
00111 
00115    void printErrorInfo ();
00116 } ;
00117 
00118 #endif

This file was last modified on 1 Jun 2004.
XBinder, Version 1.0.0