Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# oscl_error_imp_cppexceptions.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00003
    00004 //         O S C L _ E R R O R _ I M P _ C P P E X C E P T I O N S
    00005
    00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    00007
    00018 #ifndef OSCL_ERROR_IMP_CPPEXCEPTIONS_H_INCLUDED
    00019 #define OSCL_ERROR_IMP_CPPEXCEPTIONS_H_INCLUDED
    00020
    00021 #ifndef OSCL_ERROR_TRAPCLEANUP_H_INCLUDED
    00022 #include "oscl_error_trapcleanup.h"
    00023 #endif
    00024
    00025 //Implementation file for Leave using C++ exceptions.
    00026
    00027 //This is a full implementation of Leave.
    00028
    00029 class internalLeave
    00030 {
    00031     public:
    00032         int a;
    00033 };
    00034
    00035 //Leave throws C++ exceptions.
    00036 #define PVError_DoLeave() internalLeave __ilv;__ilv.a=0;throw(__ilv)
    00037
    00038
    00039 //_PV_TRAP catches Leaves.
    00040 //_r is the leave code, _s are statements to execute
    00041 #define _PV_TRAP(__r,__s)\
    00042     __r=OsclErrNone;\
    00043     {\
    00044         OsclErrorTrapImp* __tr=OsclErrorTrapImp::Trap();\
    00045         if(!__tr){__s;}else{\
    00046         try{__s;}\
    00047         catch(internalLeave __lv)\
    00048         {__lv.a=__r=__tr->iLeave;}\
    00049         __tr->UnTrap();}\
    00050     }
    00051
    00052 //_PV_TRAP_NO_TLS catches Leaves.
    00053 //_r is the leave code, _s are statements to execute
    00054 #define _PV_TRAP_NO_TLS(__trapimp,__r,__s)\
    00055     __r=OsclErrNone;\
    00056     {\
    00057         OsclErrorTrapImp* __tr=OsclErrorTrapImp::TrapNoTls(__trapimp);\
    00058         if(!__tr){__s;}else{\
    00059         try{__s;}\
    00060         catch(internalLeave __lv)\
    00061         {__lv.a=__r=__tr->iLeave;}\
    00062         __tr->UnTrap();}\
    00063     }
    00064
    00065
    00066 #endif // OSCL_ERROR_IMP_CPPEXCEPTIONS_H_INCLUDED
    00067