diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-28 20:33:16 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-28 20:33:16 +0000 |
commit | 1ad4275ebf181551e66186aac7e27bc72d088aca (patch) | |
tree | 530f8337f590d9e4667c027f602617d4e24ca272 /ace/CORBA_macros.h | |
parent | 3d0176bad7b58edcd20de0f5078c9fbf420b74fe (diff) | |
download | ATCD-1ad4275ebf181551e66186aac7e27bc72d088aca.tar.gz |
Moved ACE_NEW_THROW* and ACE_GUARD_THROW* to CORBA_macros.h
Diffstat (limited to 'ace/CORBA_macros.h')
-rw-r--r-- | ace/CORBA_macros.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/ace/CORBA_macros.h b/ace/CORBA_macros.h index e595aea4c53..fd15d52f56c 100644 --- a/ace/CORBA_macros.h +++ b/ace/CORBA_macros.h @@ -30,6 +30,8 @@ # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/OS.h" + // All these macros assume the CORBA::Environment variable used to pass // in/out the exception is call ACE_TRY_ENV. Below is the name we use // in TAO (The ACE ORB.) Most other ORB's have their own naming @@ -309,6 +311,78 @@ #endif /* ! ACE_CORBA_HAS_EXCEPTIONS */ +// ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS. +#if defined(ACE_NEW_THROWS_EXCEPTIONS) + +# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ + } while (0) +// The following ACE_NEW_THROW* macros are to be depricated soon. +// -------------------- Start Depricated -------------------- +# define ACE_NEW_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; TAO_THROW (EXCEPTION); } \ + } while (0) +# define ACE_NEW_THROW_RETURN(POINTER,CONSTRUCTOR,EXCEPTION,RET_VAL) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; TAO_THROW_RETURN (EXCEPTION,RET_VAL); } \ + } while (0) +# define ACE_NEW_TRY_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; TAO_TRY_THROW (EXCEPTION); } \ + } while (0) +// -------------------- End Depricated -------------------- + +#else + +# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ + } while (0) +// The following ACE_NEW_THROW* macros are to be depricated soon. +// -------------------- Start Depricated -------------------- +# define ACE_NEW_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; TAO_THROW (EXCEPTION); } \ + } while (0) +# define ACE_NEW_THROW_RETURN(POINTER,CONSTRUCTOR,EXCEPTION,RET_VAL) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0)\ + { errno = ENOMEM; TAO_THROW_RETURN (EXCEPTION,RET_VAL); } \ + } while (0) +# define ACE_NEW_TRY_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; TAO_TRY_THROW (EXCEPTION); } \ + } while (0) +// -------------------- End Depricated -------------------- + +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + +# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ + ACE_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) ACE_THROW_INT (EXCEPTION); + +# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK) \ + ACE_Read_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) return; + +# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK) \ + ACE_Write_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) return; + +// The following ACE_GUARD_THROW* macros are to be depricated soon. +// -------------------- Start Depricated -------------------- +# define ACE_GUARD_THROW(MUTEX,OBJ,LOCK,EXCEPTION) \ + ACE_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) TAO_THROW (EXCEPTION); +# define ACE_GUARD_THROW_RETURN(MUTEX,OBJ,LOCK,EXCEPTION,RETURN) \ + ACE_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) TAO_THROW_RETURN (EXCEPTION, RETURN); +// -------------------- End Deprication -------------------- + +// ============================================================ + // Print out a TAO exception. This is not CORBA compliant. # define ACE_PRINT_TAO_EXCEPTION(EX,INFO) \ EX.print_exception (INFO) |