CORBA_macros.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // ============================================================================
00004 /**
00005  * @file CORBA_macros.h
00006  *
00007  * $Id: CORBA_macros.h 80826 2008-03-04 14:51:23Z wotte $
00008  *
00009  *   Writing code that is portable between platforms with or without
00010  *   native C++ exceptions is hard.  The following macros offer some
00011  *   help on this task, mostly oriented to making the ORB code and the
00012  *   IDL generated code portable.
00013  *
00014  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00015  *  @author Aniruddha Gokhale  <gokhale@sahyadri.research.bell-labs.com>
00016  *  @author Carlos O'Ryan  <coryan@uci.edu>, et al.
00017  */
00018 // ============================================================================
00019 
00020 // Macros for handling CORBA exceptions.
00021 
00022 #ifndef ACE_CORBA_MACROS_H
00023 #define ACE_CORBA_MACROS_H
00024 
00025 #include /**/ "ace/pre.h"
00026 
00027 #include /**/ "ace/config-all.h"
00028 
00029 # if !defined (ACE_LACKS_PRAGMA_ONCE)
00030 #   pragma once
00031 # endif /* ACE_LACKS_PRAGMA_ONCE */
00032 
00033 #define ACE_ENV_POLLUTE_NAMES
00034 
00035 #include "ace/Exception_Macros.h"
00036 
00037 // The Windows MFC exception mechanism requires that a caught CException
00038 // (including the CMemoryException in use here) be freed using its Delete()
00039 // method. Thus, when MFC is in use and we're catching exceptions as a result
00040 // of new(), the exception's Delete() method has to be called. No other
00041 // platform imposes this sort of restriction/requirement. The Windows
00042 // config stuff (at least for MSVC/MFC) defines a ACE_del_bad_alloc macro
00043 // that works with its ACE_bad_alloc macro to implement this cleanup
00044 // requirement. Since no other platform requires this, define it as
00045 // empty here.
00046 #if !defined (ACE_del_bad_alloc)
00047 #  define ACE_del_bad_alloc
00048 #endif
00049 
00050 #if !defined (ACE_LACKS_DEPRECATED_MACROS)
00051 
00052 // If you wish to you use these macros for emulating exceptions on
00053 // platforms which lack native exception support, you need to do the
00054 // following:
00055 // 1. Define a class Exception. You can name it as you please. This class
00056 //    should be at the root of the inheritance hierarchy of all the
00057 //    exceptions used in your application. It should define at a minimum
00058 //    the following pure virtual methods:
00059 //    a) _downcast () - Which allows narrowing of the base exception type to a
00060 //       derived type.
00061 //    b) _raise() - Which throws an exception of type Exception.
00062 //
00063 //    Classes which derive from these should implement these operations.
00064 //
00065 // 2. Define a class Environment. You can name it as you please. This class
00066 //    is an exception holder. This class is always on the stack. It should
00067 //    support at a minimum the following methods:
00068 //      a) exception() - Which returns the Exception held in the current
00069 //         Environment.
00070 //      b) exception (Exception* foo) - Which replaces/sets the Exception
00071 //         held in the current Environment with foo.
00072 //      b) clear() - Which resets a particular instance of Environment.
00073 //      c) A copy constructor and an assignment operator.
00074 //
00075 //  Note that the above description assumes that you use the following
00076 //  macros only within a particular domain. For example, if your
00077 //  application has to interoperate across domains, then you need to define
00078 //  an exception adapter to translate exceptions from one domain to
00079 //  exceptions in the other. Please refer to Stroustrup's book on how to do
00080 //  this. If your use case is this complex, you would be better off with
00081 //  going with native exceptions rather than emulated exceptions, though
00082 //  the macros should still work if you defined your adapter class as
00083 //  ACE_EXCEPTION_TYPE.
00084 
00085 
00086 // The following macros assume that an environment variable is passed
00087 // in/out of each function that can throw an exception. The type of the
00088 // environment variable is defined by ACE_ENV_TYPE.
00089 
00090 #if !defined (ACE_ENV_TYPE)
00091 # define ACE_ENV_TYPE  CORBA::Environment
00092 #endif /* ACE_ENV_TYPE */
00093 
00094 // The name of the variable is defined by ACE_TRY_ENV. Below is the name
00095 // that we use by default. If you wish to change it you can redefine
00096 // ACE_TRY_ENV to change the default name. Also ACE_ADOPT_ENV allows the
00097 // use of non-standard name within a scope.
00098 
00099 #if !defined (ACE_TRY_ENV)
00100 # define ACE_TRY_ENV  _ACE_CORBA_Environment_variable
00101 #endif /* ACE_TRY_ENV */
00102 
00103 // The base type of Exception from which all the other exception types are
00104 // derived. You can set this to any type as you please. By default, it is
00105 // set to CORBA::Exception.
00106 
00107 #if !defined (ACE_EXCEPTION_TYPE)
00108 # define ACE_EXCEPTION_TYPE  CORBA::Exception
00109 #endif /* ACE_EXCEPTION_TYPE */
00110 
00111 // This method is used to get the default value of the Environment
00112 // variable. In the case of TAO, this variable is part of the TSS ORB
00113 // resources and the method TAO_default_environment() returns the
00114 // Environment variable.
00115 
00116 #if !defined (ACE_DEFAULT_GET_ENV_METHOD)
00117 # define ACE_DEFAULT_GET_ENV_METHOD  TAO_default_environment
00118 #endif /* ACE_DEFAULT_GET_ENV_METHOD */
00119 
00120 // This is the exception caught by ACE_CATCHANY.
00121 #if !defined (ACE_ANY_EXCEPTION)
00122 # define ACE_ANY_EXCEPTION ex
00123 #endif /* ACE_ANY_EXCEPTION */
00124 
00125 // Declare a new environment variable on the stack. The type of the
00126 // environment variable is determined by ACE_ENV_TYPE.
00127 #if defined (ACE_USES_NATIVE_EXCEPTIONS)
00128 // Don't instantiate an emulated exception environment at all when
00129 // using native C++ exception support.  It won't be used.
00130 # define ACE_DECLARE_NEW_ENV
00131 #else
00132 # define ACE_DECLARE_NEW_ENV \
00133       ACE_ENV_TYPE ACE_TRY_ENV
00134 #endif  /* ACE_USES_NATIVE_EXCEPTIONS */
00135 
00136 // Provided for backward compatibility purposes. Don't use it in new code.
00137 // Use the definition above along with defining ACE_ENV_TYPE.
00138 
00139 #if defined (ACE_ENV_POLLUTE_NAMES)
00140 #  define ACE_DECLARE_NEW_CORBA_ENV ACE_DECLARE_NEW_ENV
00141 #endif /* ACE_ENV_POLLUTE_NAMES */
00142 
00143 #if defined (ACE_USES_NATIVE_EXCEPTIONS)
00144 // -----------------------------------------------------------------
00145 
00146 // Provided for backward compatibility purposes. Don't use it in new code.
00147 #if defined (ACE_ENV_POLLUTE_NAMES)
00148 #  define ACE_ADOPT_CORBA_ENV(ENV)
00149 #endif /* ACE_ENV_POLLUTE_NAMES */
00150 
00151 #define ACE_ADOPT_ENV (ENV)
00152 
00153 // No need to check. Native exceptions handle the control flow
00154 // automatically when an exception occurs.
00155 # define ACE_CHECK
00156 
00157 // Used when the function requires a return value.
00158 # define ACE_CHECK_RETURN(RETV)
00159 
00160 // ACE_THROW_INT should not be used by the user.
00161 # define ACE_THROW_INT(EXCEPTION) \
00162       throw EXCEPTION
00163 
00164 // Throwing an exception is easy. These two macros should _NOT_ be
00165 // used within try blocks.
00166 # define ACE_THROW(EXCEPTION) \
00167       throw EXCEPTION
00168 
00169 // Throwing an exception when the function requires a return value.
00170 # define ACE_THROW_RETURN(EXCEPTION,RETV) \
00171       throw EXCEPTION
00172 
00173 // For compilers with native exceptions, we can simply use try to try. ;-)
00174 // do {} while (0) is required to avoid compilation warnings.
00175 # define ACE_TRY \
00176    do \
00177      { \
00178        try \
00179          {
00180 # define ACE_TRY_NEW_ENV \
00181    do \
00182      { \
00183        try \
00184          {
00185 # define ACE_TRY_EX(LABEL) \
00186    do \
00187      { \
00188        try \
00189          {
00190 
00191 // No need to check for exceptions within try block for compilers with
00192 // native exceptions.
00193 # define ACE_TRY_CHECK
00194 # define ACE_TRY_CHECK_EX(LABEL)
00195 
00196 // Likewise, throwing exceptions within try blocks is easy.
00197 # define ACE_TRY_THROW(EXCEPTION) throw EXCEPTION
00198 # define ACE_TRY_THROW_EX(EXCEPTION,LABEL) throw EXCEPTION
00199 
00200 // Same thing for catch.
00201 # define ACE_CATCH(EXCEPTION,VAR) \
00202          } \
00203        catch (EXCEPTION & VAR) \
00204          { \
00205            ACE_UNUSED_ARG (VAR);
00206 
00207 # define ACE_CATCHANY \
00208        ACE_CATCH(ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION)
00209 
00210 # define ACE_CATCHALL \
00211          } \
00212        catch (...) \
00213          {
00214 
00215 #   if defined (ACE_HAS_DEPRECATED_ACE_RETHROW)
00216 #     define ACE_RETHROW throw
00217 #   endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */
00218 
00219 // Rethrowing the exception from catch blocks.
00220 # define ACE_RE_THROW throw
00221 # define ACE_RE_THROW_EX(LABEL) throw
00222 
00223 // Close the catch block.
00224 # define ACE_ENDTRY \
00225          } \
00226      } while (0)
00227 
00228 #else /* ! ACE_USES_NATIVE_EXCEPTIONS */
00229 // -----------------------------------------------------------------
00230 
00231 // When handling compilers without native exceptions, things get a bit
00232 // hairy. Exceptions are simulated using ACE_ENV_TYPE. The trick here is to
00233 // make sure the flow-of-control can simulate the case when native
00234 // exceptions occur...
00235 
00236 #if defined (ACE_ENV_POLLUTE_NAMES)
00237 # define ACE_ADOPT_CORBA_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV
00238 #endif /* ACE_ENV_POLLUTE_NAMES */
00239 
00240 # define ACE_ADOPT_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV
00241 
00242 // Follow every statement that could throw exceptions with ACE_CHECK or
00243 // ACE_CHECK_RETURN. These two macros should _NOT_ be used within try
00244 // blocks. Use ACE_TRY_CHECK or ACE_TRY_CHECK_EX instead.
00245 # define ACE_CHECK \
00246     if (ACE_TRY_ENV . exception () != 0) \
00247       return
00248 // When function requires a return value
00249 # define ACE_CHECK_RETURN(RETV) \
00250     if (ACE_TRY_ENV . exception () != 0) \
00251       return RETV
00252 
00253 // ACE_THROW_INT should not be used by the user.
00254 # define ACE_THROW_INT(EXCEPTION) ACE_TRY_ENV.exception (new EXCEPTION)
00255 
00256 // Throwing exceptions will inevitably cause a return from the current
00257 // function. These two macros should _NOT_ be used within try blocks. Use
00258 // ACE_TRY_THROW or ACE_TRY_THROW_EX instead.
00259 # define ACE_THROW(EXCEPTION) \
00260     do \
00261       { \
00262         ACE_TRY_ENV.exception (new EXCEPTION); \
00263         return; \
00264       } while (0)
00265 
00266 # define ACE_THROW_RETURN(EXCEPTION,RETV) \
00267     do \
00268       { \
00269         ACE_TRY_ENV.exception (new EXCEPTION); \
00270         return RETV; \
00271       } while (0)
00272 
00273 // ACE_TRY sets up flags to control program flow. ACE_TRY_FLAG acts like a
00274 // one-shot flip-flop. When an exception occurs (detected using
00275 // ACE_TRY_CHECK,) ACE_TRY_FLAG will be reset and the control goes back
00276 // into ACE_TRY_LABEL. Since ACE_TRY_FLAG is reset, the try block won't get
00277 // executed again and the control proceeds to the following catch blocks.
00278 // ACE_EXCEPTION_NOT_CAUGHT flag is used to prevent catching an exception
00279 // twice. This macro assumes there's already an ACE_ENV_TYPE variable
00280 // ACE_TRY_ENV defined (which should be the case normally)
00281 # define ACE_TRY \
00282    do { \
00283      int ACE_TRY_FLAG = 1; \
00284      int ACE_EXCEPTION_NOT_CAUGHT = 1; \
00285    ACE_TRY_LABEL: \
00286      if (ACE_TRY_FLAG) \
00287        do {
00288 
00289 // ACE_TRY_NEW_ENV functions like the macro ACE_TRY but defines a new
00290 // ACE_ENV_TYPE variable ACE_TRY_ENV. It is most often used in the outer
00291 // most function where no ACE_TRY_ENV is available.
00292 # define ACE_TRY_NEW_ENV \
00293    do { \
00294      ACE_DECLARE_NEW_ENV;\
00295      int ACE_TRY_FLAG = 1; \
00296      int ACE_EXCEPTION_NOT_CAUGHT = 1; \
00297    ACE_TRY_LABEL: \
00298      if (ACE_TRY_FLAG) \
00299        do {
00300 
00301 // ACE_TRY_EX works exactly like ACE_TRY macro except the label used in the
00302 // try block is customizable to avoid name clashing. It should be used when
00303 // nested try blocks or multiple try blocks are required, in the same
00304 // function.
00305 # define ACE_TRY_EX(LABEL) \
00306    do { \
00307      int ACE_TRY_FLAG = 1; \
00308      int ACE_EXCEPTION_NOT_CAUGHT = 1; \
00309    ACE_TRY_LABEL ## LABEL: \
00310      if (ACE_TRY_FLAG) \
00311        do {
00312 
00313 // Check for exceptions within try blocks.
00314 # define ACE_TRY_CHECK \
00315     { \
00316       if (ACE_TRY_ENV.exception () != 0) \
00317         { \
00318           ACE_TRY_FLAG = 0; \
00319           goto ACE_TRY_LABEL; \
00320         } \
00321     }
00322 
00323 // Checking exception within EX try blocks.
00324 # define ACE_TRY_CHECK_EX(LABEL) \
00325     { \
00326       if (ACE_TRY_ENV.exception () != 0) \
00327         { \
00328           ACE_TRY_FLAG = 0; \
00329           goto ACE_TRY_LABEL ## LABEL; \
00330         } \
00331     }
00332 
00333 // Throwing exception within TRY blocks.
00334 # define ACE_TRY_THROW(EXCEPTION) \
00335     { \
00336       ACE_TRY_ENV.exception (new EXCEPTION); \
00337       ACE_TRY_FLAG = 0; \
00338       goto ACE_TRY_LABEL; \
00339     }
00340 
00341 # define ACE_TRY_THROW_EX(EXCEPTION,LABEL) \
00342     { \
00343       ACE_TRY_ENV.exception (new EXCEPTION); \
00344       ACE_TRY_FLAG = 0; \
00345       goto ACE_TRY_LABEL ## LABEL; \
00346     }
00347 
00348 // When exceptions occur or try block finishes execution without exception,
00349 // control will continue in the catch block. This macro first checks if
00350 // there's any uncaught exception left. If all the conditions are met, we
00351 // have caught an exception. It then resets ACE_EXCEPTION_NOT_CAUGHT to
00352 // prevent subsequent catch blocks from catching the same exception again,
00353 // and extracts out the underlying exception in ACE_TRY_ENV. We also make a
00354 // copy of ACE_TRY_ENV in ACE_CAUGHT_ENV, in case we want to rethrow the
00355 // exception. ACE_TRY_ENV is cleared out after the exception is caught so
00356 // you should not use ACE_TRY_ENV within the catch block(You should use the
00357 // exception directly).
00358 # define ACE_CATCH(TYPE,VAR) \
00359      } while (0); \
00360    do \
00361      if (ACE_TRY_ENV.exception () != 0 && ACE_EXCEPTION_NOT_CAUGHT && \
00362        TYPE::_downcast(ACE_TRY_ENV.exception ()) != 0) \
00363        { \
00364          ACE_ENV_TYPE ACE_CAUGHT_ENV = ACE_TRY_ENV;\
00365          ACE_EXCEPTION_NOT_CAUGHT = 0; \
00366          TYPE &VAR = *TYPE::_downcast (ACE_CAUGHT_ENV.exception ()); \
00367          ACE_UNUSED_ARG (VAR); \
00368          ACE_TRY_ENV.clear ();
00369 
00370 // ACE_CATCHANY uses ACE_CATCH to catch all exceptions derived from
00371 // ACE_EXCEPTION_TYPE
00372 # define ACE_CATCHANY ACE_CATCH (ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION)
00373 
00374 // Since there's no other exception for compilers without exception
00375 // support, we simply catch all ACE_EXCEPTION_TYPE exceptions for
00376 // ACE_CATCHALL.
00377 # define ACE_CATCHALL ACE_CATCHANY
00378 
00379 #   if defined (ACE_HAS_DEPRECATED_ACE_RETHROW)
00380 #     define ACE_RETHROW \
00381         do \
00382           ACE_TRY_ENV = ACE_CAUGHT_ENV; \
00383         while (0)
00384 #   endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */
00385 
00386 // Rethrowing exception within catch blocks. Notice that we depend on the
00387 // ACE_CHECK/ACE_CHECK_RETURN following the ACE_ENDTRY, or ACE_TRY_CHECK/
00388 // ACE_TRY_CHECK_EX following the ACE_ENDTRY when the catch block is within
00389 // another try block, to do the "Right Thing[TM]."
00390 # define ACE_RE_THROW \
00391     do {\
00392       ACE_TRY_ENV = ACE_CAUGHT_ENV; \
00393       goto ACE_TRY_LABEL; \
00394     } while (0)
00395 # define ACE_RE_THROW_EX(LABEL) \
00396     do {\
00397       ACE_TRY_ENV = ACE_CAUGHT_ENV; \
00398       goto ACE_TRY_LABEL ## LABEL; \
00399     } while (0)
00400 
00401 // Close the try block. Since exceptions may not get caught, and exceptions
00402 // can also be rethrown from the catch block, it's always a good idea to
00403 // follow ACE_ENDTRY with ACE_CHECK or ACE_TRY_CHECK (depending on the
00404 // context.)
00405 # define ACE_ENDTRY \
00406       } while (0); \
00407     } while (0)
00408 
00409 #endif /* ! ACE_USES_NATIVE_EXCEPTIONS */
00410 
00411 #endif /* !ACE_LACKS_DEPRECATED_MACROS */
00412 
00413 // ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS.
00414 #if defined(ACE_NEW_THROWS_EXCEPTIONS)
00415 
00416 # if defined (ACE_HAS_NEW_NOTHROW)
00417 
00418 #    define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION)     \
00419   do { POINTER = new (ACE_nothrow) CONSTRUCTOR;                 \
00420     if (POINTER == 0) { throw EXCEPTION; }                      \
00421   } while (0)
00422 
00423 #  else
00424 
00425 #   define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION)          \
00426   do { try { POINTER = new CONSTRUCTOR; }                           \
00427     catch (ACE_bad_alloc) { ACE_del_bad_alloc throw EXCEPTION; }    \
00428   } while (0)
00429 
00430 #  endif /* ACE_HAS_NEW_NOTHROW */
00431 
00432 #else /* ! ACE_NEW_THROWS_EXCEPTIONS */
00433 
00434 #   define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION)      \
00435   do { POINTER = new CONSTRUCTOR;                               \
00436     if (POINTER == 0) { throw EXCEPTION; }                      \
00437   } while (0)
00438 
00439 #endif /* ACE_NEW_THROWS_EXCEPTIONS */
00440 
00441 # define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
00442   ACE_Guard< MUTEX > OBJ (LOCK); \
00443     if (OBJ.locked () == 0) throw EXCEPTION;
00444 
00445 # define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
00446   ACE_Read_Guard< MUTEX > OBJ (LOCK); \
00447     if (OBJ.locked () == 0) throw EXCEPTION;
00448 
00449 # define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
00450   ACE_Write_Guard< MUTEX > OBJ (LOCK); \
00451     if (OBJ.locked () == 0) throw EXCEPTION;
00452 
00453 #if !defined (ACE_LACKS_DEPRECATED_MACROS)
00454 
00455 //@{
00456 /**
00457  * @name Native C++ exceptions portability macros.
00458  *
00459  * The following macros are used to write code portable between platforms
00460  * with and without native C++ exception support. Their main goal is to
00461  * hide the presence of the ACE_ENV_TYPE argument, but they collaborate
00462  * with the ACE_TRY_* macros to emulate the try/catch blocks.
00463  */
00464 
00465 /// Define a macro to emit code only when ACE_ENV_TYPE is used
00466 #if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
00467 #  define ACE_ENV_EMIT_CODE(X) X
00468 #else
00469 #  define ACE_ENV_EMIT_CODE(X)
00470 #endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */
00471 
00472 /// Another macro to emit code only when ACE_ENV_TYPE is used
00473 #if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
00474 #  define ACE_ENV_EMIT_CODE2(X,Y) X,Y
00475 #else
00476 #  define ACE_ENV_EMIT_CODE2(X,Y)
00477 #endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */
00478 
00479 /// Helper macro
00480 #define ACE_ENV_EMIT_DUMMY
00481 
00482 /// Declare a ACE_ENV_TYPE argument as the last argument of a
00483 /// function
00484 /**
00485  * Normally this macro is used as follows:
00486  *
00487  * <CODE>void my_funct (int x, int y ACE_ENV_ARG_DECL);</CODE>
00488  *
00489  * Its purpose is to provide developers (and users) with a mechanism to
00490  * write code that is portable to platforms with and without native C++
00491  * exceptions.
00492  */
00493 #define ACE_ENV_ARG_DECL \
00494     ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
00495                        ACE_ENV_TYPE &ACE_TRY_ENV)
00496 
00497 /// Declare a ACE_ENV_TYPE argument with the default value obtained from
00498 /// the ORB/application.
00499 /**
00500  * It is similar to ACE_ENV_ARG_DECL. The name of the default environment
00501  * getter method needs to be changed when switching ORBs or when used with
00502  * another application.
00503  */
00504 #define ACE_ENV_ARG_DECL_WITH_DEFAULTS \
00505     ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
00506                        ACE_ENV_TYPE &ACE_TRY_ENV = \
00507                            ACE_DEFAULT_GET_ENV_METHOD ())
00508 
00509 /// Declare a ACE_ENV_TYPE argument that is not used by the
00510 /// function definition.
00511 /**
00512  * Similar to ACE_ENV_ARG_DECL, but the formal parameter name is dropped to
00513  * avoid warnings about unused parameters
00514  */
00515 #define ACE_ENV_ARG_DECL_NOT_USED \
00516     ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
00517                        ACE_ENV_TYPE &)
00518 
00519 /// Declare a ACE_ENV_TYPE argument for methods that do not take any other
00520 /// parameters
00521 #define ACE_ENV_SINGLE_ARG_DECL \
00522     ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV)
00523 
00524 /// Declare a ACE_ENV_TYPE argument with a default value for methods that
00525 /// do not take any other parameters. The name of the default environment
00526 /// getter method needs to be changed when switching ORBs or when used in
00527 /// another application.
00528 #define ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS \
00529     ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV = \
00530                           ACE_DEFAULT_GET_ENV_METHOD ())
00531 
00532 /// Declare a ACE_ENV_TYPE argument for methods which don't use it.
00533 #define ACE_ENV_SINGLE_ARG_DECL_NOT_USED \
00534     ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &)
00535 
00536 /// Use the ACE_ENV_TYPE argument in a nested call
00537 #define ACE_ENV_ARG_PARAMETER \
00538     ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \
00539                        ACE_TRY_ENV)
00540 
00541 /// Use the ACE_ENV_TYPE argument in a nested call, assuming that the
00542 /// called function takes only the ACE_TRY_ENV argument.
00543 #define ACE_ENV_SINGLE_ARG_PARAMETER \
00544     ACE_ENV_EMIT_CODE(ACE_TRY_ENV)
00545 
00546 /// Eliminate unused argument warnings about ACE_TRY_ENV
00547 #define ACE_ENV_ARG_NOT_USED \
00548     ACE_ENV_EMIT_CODE(ACE_UNUSED_ARG(ACE_TRY_ENV))
00549 //@}
00550 
00551 #if !defined (ACE_USES_NATIVE_EXCEPTIONS)
00552 // This thing can be moved above when we drop ACE_ENV_BKWD_COMPAT.
00553 #  define ACE_ENV_RAISE(ex) ACE_TRY_ENV.exception (ex)
00554 #else
00555 #  define ACE_ENV_RAISE(ex) (ex)->_raise ()
00556 #endif /* ACE_USES_NATIVE_EXCEPTIONS */
00557 
00558 // ============================================================
00559 
00560 // Print out a TAO exception.  This is not CORBA compliant.
00561 # define ACE_PRINT_TAO_EXCEPTION(EX,INFO) \
00562   EX._tao_print_exception (INFO)
00563 
00564 // Print out a CORBA exception.  There is not portable way to
00565 // dump a CORBA exception.  If you are using other ORB implementation,
00566 // redefine the macro to get what you want.
00567 # if !defined ACE_PRINT_EXCEPTION
00568 #   define ACE_PRINT_EXCEPTION(EX,INFO) ACE_PRINT_TAO_EXCEPTION(EX,INFO)
00569 # endif /* ACE_PRINT_EXCEPTION */
00570 
00571 #endif /* !ACE_LACKS_DEPRECATED_MACROS */
00572 
00573 #include /**/ "ace/post.h"
00574 
00575 #endif /* ACE_CORBA_MACROS_H */

Generated on Tue Feb 2 17:18:39 2010 for ACE by  doxygen 1.4.7