Global_Macros.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Global_Macros.h
00006  *
00007  *  Global_Macros.h,v 4.50 2006/06/20 12:40:38 jwillemsen Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  *  @author Jesper S. M|ller<stophph@diku.dk>
00011  *  @author and a cast of thousands...
00012  *
00013  *  This one is split from the famous OS.h
00014  */
00015 //=============================================================================
00016 
00017 #ifndef ACE_GLOBAL_MACROS_H
00018 #define ACE_GLOBAL_MACROS_H
00019 
00020 #include /**/ "ace/pre.h"
00021 
00022 // Included just keep compilers that see #pragma dierctive first
00023 // happy.
00024 #include "ace/ACE_export.h"
00025 
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 # pragma once
00028 #endif /* ACE_LACKS_PRAGMA_ONCE */
00029 
00030 #include "ace/config-lite.h"
00031 #include "ace/Assert.h"                 // For ACE_ASSERT
00032 
00033 // Start Global Macros
00034 # define ACE_BEGIN_DUMP ACE_LIB_TEXT ("\n====\n(%P|%t|%x)\n")
00035 # define ACE_END_DUMP ACE_LIB_TEXT ("====\n")
00036 
00037 # if defined (ACE_NDEBUG)
00038 #   define ACE_DB(X)
00039 # else
00040 #   define ACE_DB(X) X
00041 # endif /* ACE_NDEBUG */
00042 
00043 // ACE_NO_HEAP_CHECK macro can be used to suppress false report of
00044 // memory leaks. It turns off the built-in heap checking until the
00045 // block is left. The old state will then be restored Only used for
00046 // Win32 (in the moment).
00047 # if defined (ACE_WIN32)
00048 
00049 #   if defined (_DEBUG) && !defined (ACE_HAS_WINCE) && !defined (__BORLANDC__)
00050 # include /**/ <crtdbg.h>
00051 
00052 // Open versioned namespace, if enabled by the user.
00053 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00054 
00055 class ACE_Export ACE_No_Heap_Check
00056 {
00057 public:
00058   ACE_No_Heap_Check (void)
00059     : old_state (_CrtSetDbgFlag (_CRTDBG_REPORT_FLAG))
00060   { _CrtSetDbgFlag (old_state & ~_CRTDBG_ALLOC_MEM_DF);}
00061   ~ACE_No_Heap_Check (void) { _CrtSetDbgFlag (old_state);}
00062 private:
00063   int old_state;
00064 };
00065 
00066 // Close versioned namespace, if enabled by the user.
00067 ACE_END_VERSIONED_NAMESPACE_DECL
00068 
00069 #     define ACE_NO_HEAP_CHECK ACE_No_Heap_Check ____no_heap;
00070 #   else /* !_DEBUG */
00071 #     define ACE_NO_HEAP_CHECK
00072 #   endif /* _DEBUG */
00073 # else /* !ACE_WIN32 */
00074 #   define ACE_NO_HEAP_CHECK
00075 # endif /* ACE_WIN32 */
00076 
00077 // Turn a number into a string.
00078 # define ACE_ITOA(X) #X
00079 
00080 // Create a string of a server address with a "host:port" format.
00081 # define ACE_SERVER_ADDRESS(H,P) H ACE_TEXT(":") P
00082 
00083 // A couple useful inline functions for checking whether bits are
00084 // enabled or disabled.
00085 
00086 // Efficiently returns the least power of two >= X...
00087 # define ACE_POW(X) (((X) == 0)?1:(X-=1,X|=X>>1,X|=X>>2,X|=X>>4,X|=X>>8,X|=X>>16,(++X)))
00088 # define ACE_EVEN(NUM) (((NUM) & 1) == 0)
00089 # define ACE_ODD(NUM) (((NUM) & 1) == 1)
00090 # define ACE_BIT_ENABLED(WORD, BIT) (((WORD) & (BIT)) != 0)
00091 # define ACE_BIT_DISABLED(WORD, BIT) (((WORD) & (BIT)) == 0)
00092 # define ACE_BIT_CMP_MASK(WORD, BIT, MASK) (((WORD) & (BIT)) == MASK)
00093 # define ACE_SET_BITS(WORD, BITS) (WORD |= (BITS))
00094 # define ACE_CLR_BITS(WORD, BITS) (WORD &= ~(BITS))
00095 
00096 # if !defined (ACE_ENDLESS_LOOP)
00097 #  define ACE_ENDLESS_LOOP
00098 # endif /* ! ACE_ENDLESS_LOOP */
00099 
00100 # if defined (ACE_NEEDS_FUNC_DEFINITIONS)
00101     // It just evaporated ;-)  Not pleasant.
00102 #   define ACE_UNIMPLEMENTED_FUNC(f)
00103 # else
00104 #   define ACE_UNIMPLEMENTED_FUNC(f) f;
00105 # endif /* ACE_NEEDS_FUNC_DEFINITIONS */
00106 
00107 #if !defined (ACE_LACKS_DEPRECATED_MACROS)
00108   // Easy way to designate that a class is used as a pseudo-namespace.
00109   // Insures that g++ "friendship" anamolies are properly handled.
00110   # define ACE_CLASS_IS_NAMESPACE(CLASSNAME) \
00111   private: \
00112   CLASSNAME (void); \
00113   CLASSNAME (const CLASSNAME&); \
00114   friend class ace_dewarn_gplusplus
00115 #endif /* ACE_LACKS_DEPRECATED_MACROS */
00116 
00117 // ----------------------------------------------------------------
00118 
00119 # if defined (ACE_HAS_NO_THROW_SPEC)
00120 #   define ACE_THROW_SPEC(X)
00121 # else
00122 #  if defined (ACE_HAS_EXCEPTIONS)
00123 #    define ACE_THROW_SPEC(X) throw X
00124 #  else  /* ! ACE_HAS_EXCEPTIONS */
00125 #    define ACE_THROW_SPEC(X)
00126 #  endif /* ! ACE_HAS_EXCEPTIONS */
00127 # endif /*ACE_HAS_NO_THROW_SPEC*/
00128 
00129 // ----------------------------------------------------------------
00130 
00131 #if !defined (ACE_LACKS_DEPRECATED_MACROS)
00132   /**
00133    * This macro is deprecated
00134    */
00135   #define ACE_NESTED_CLASS(TYPE, NAME) TYPE::NAME
00136 #endif /* ACE_LACKS_DEPRECATED_MACROS */
00137 
00138 #if !defined (ACE_LACKS_DEPRECATED_MACROS)
00139   /**
00140    * @name CORBA namespace macros.
00141    *
00142    * CORBA namespace macros.
00143    *
00144    * @deprecated These macros were formerly used by TAO but are now
00145    *             deprecated, and only remain to retain some backward
00146    *             compatibility.  They will be removed in a future ACE
00147    *             release.
00148    */
00149   //@{
00150   #define ACE_CORBA_1(NAME) CORBA::NAME
00151   #define ACE_CORBA_2(TYPE, NAME) CORBA::TYPE::NAME
00152   #define ACE_CORBA_3(TYPE, NAME) CORBA::TYPE::NAME
00153   //@}
00154 #endif /* ACE_LACKS_DEPRECATED_MACROS */
00155 
00156 // ----------------------------------------------------------------
00157 
00158 // Convenient macro for testing for deadlock, as well as for detecting
00159 // when mutexes fail.
00160 #define ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ACTION, REACTION) \
00161    ACE_Guard< MUTEX > OBJ (LOCK); \
00162    if (OBJ.locked () != 0) { ACTION; } \
00163    else { REACTION; }
00164 #define ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, REACTION) \
00165   ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ;, REACTION)
00166 #define ACE_GUARD(MUTEX, OBJ, LOCK) \
00167   ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return)
00168 #define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN) \
00169   ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return RETURN)
00170 # define ACE_WRITE_GUARD(MUTEX,OBJ,LOCK) \
00171   ACE_Write_Guard< MUTEX > OBJ (LOCK); \
00172     if (OBJ.locked () == 0) return;
00173 # define ACE_WRITE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \
00174   ACE_Write_Guard< MUTEX > OBJ (LOCK); \
00175     if (OBJ.locked () == 0) return RETURN;
00176 # define ACE_READ_GUARD(MUTEX,OBJ,LOCK) \
00177   ACE_Read_Guard< MUTEX > OBJ (LOCK); \
00178     if (OBJ.locked () == 0) return;
00179 # define ACE_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \
00180   ACE_Read_Guard< MUTEX > OBJ (LOCK); \
00181     if (OBJ.locked () == 0) return RETURN;
00182 
00183 // ----------------------------------------------------------------
00184 
00185 # define ACE_DES_NOFREE(POINTER,CLASS) \
00186    do { \
00187         if (POINTER) \
00188           { \
00189             (POINTER)->~CLASS (); \
00190           } \
00191       } \
00192    while (0)
00193 
00194 # define ACE_DES_ARRAY_NOFREE(POINTER,SIZE,CLASS) \
00195    do { \
00196         if (POINTER) \
00197           { \
00198             for (size_t i = 0; \
00199                  i < SIZE; \
00200                  ++i) \
00201             { \
00202               (&(POINTER)[i])->~CLASS (); \
00203             } \
00204           } \
00205       } \
00206    while (0)
00207 
00208 # define ACE_DES_FREE(POINTER,DEALLOCATOR,CLASS) \
00209    do { \
00210         if (POINTER) \
00211           { \
00212             (POINTER)->~CLASS (); \
00213             DEALLOCATOR (POINTER); \
00214           } \
00215       } \
00216    while (0)
00217 
00218 # define ACE_DES_ARRAY_FREE(POINTER,SIZE,DEALLOCATOR,CLASS) \
00219    do { \
00220         if (POINTER) \
00221           { \
00222             for (size_t i = 0; \
00223                  i < SIZE; \
00224                  ++i) \
00225             { \
00226               (&(POINTER)[i])->~CLASS (); \
00227             } \
00228             DEALLOCATOR (POINTER); \
00229           } \
00230       } \
00231    while (0)
00232 
00233 # if defined (ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR)
00234 #   define ACE_DES_NOFREE_TEMPLATE(POINTER,T_CLASS,T_PARAMETER) \
00235      do { \
00236           if (POINTER) \
00237             { \
00238               (POINTER)->~T_CLASS (); \
00239             } \
00240         } \
00241      while (0)
00242 #   define ACE_DES_ARRAY_NOFREE_TEMPLATE(POINTER,SIZE,T_CLASS,T_PARAMETER) \
00243      do { \
00244           if (POINTER) \
00245             { \
00246               for (size_t i = 0; \
00247                    i < SIZE; \
00248                    ++i) \
00249               { \
00250                 (&(POINTER)[i])->~T_CLASS (); \
00251               } \
00252             } \
00253         } \
00254      while (0)
00255 
00256 #if defined (ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS)
00257 #   define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \
00258      do { \
00259           if (POINTER) \
00260             { \
00261               (POINTER)->~T_CLASS T_PARAMETER (); \
00262               DEALLOCATOR (POINTER); \
00263             } \
00264         } \
00265      while (0)
00266 #else
00267 #   define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \
00268      do { \
00269           if (POINTER) \
00270             { \
00271               (POINTER)->~T_CLASS (); \
00272               DEALLOCATOR (POINTER); \
00273             } \
00274         } \
00275      while (0)
00276 #endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */
00277 #   define ACE_DES_ARRAY_FREE_TEMPLATE(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAMETER) \
00278      do { \
00279           if (POINTER) \
00280             { \
00281               for (size_t i = 0; \
00282                    i < SIZE; \
00283                    ++i) \
00284               { \
00285                 (&(POINTER)[i])->~T_CLASS (); \
00286               } \
00287               DEALLOCATOR (POINTER); \
00288             } \
00289         } \
00290      while (0)
00291 #if defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS)
00292 #   define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \
00293      do { \
00294           if (POINTER) \
00295             { \
00296               (POINTER)->~T_CLASS <T_PARAM1, T_PARAM2> (); \
00297               DEALLOCATOR (POINTER); \
00298             } \
00299         } \
00300      while (0)
00301 #else
00302 #   define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \
00303      do { \
00304           if (POINTER) \
00305             { \
00306               (POINTER)->~T_CLASS (); \
00307               DEALLOCATOR (POINTER); \
00308             } \
00309         } \
00310      while (0)
00311 #endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */
00312 #if defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS)
00313 #   define ACE_DES_FREE_TEMPLATE3(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3) \
00314      do { \
00315           if (POINTER) \
00316             { \
00317               (POINTER)->~T_CLASS <T_PARAM1, T_PARAM2, T_PARAM3> (); \
00318               DEALLOCATOR (POINTER); \
00319             } \
00320         } \
00321      while (0)
00322 #else
00323 #   define ACE_DES_FREE_TEMPLATE3(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3) \
00324      do { \
00325           if (POINTER) \
00326             { \
00327               (POINTER)->~T_CLASS (); \
00328               DEALLOCATOR (POINTER); \
00329             } \
00330         } \
00331      while (0)
00332 #endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */
00333 #if defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS)
00334 #   define ACE_DES_FREE_TEMPLATE4(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3, T_PARAM4) \
00335      do { \
00336           if (POINTER) \
00337             { \
00338               (POINTER)->~T_CLASS <T_PARAM1, T_PARAM2, T_PARAM3, T_PARAM4> (); \
00339               DEALLOCATOR (POINTER); \
00340             } \
00341         } \
00342      while (0)
00343 #else
00344 #   define ACE_DES_FREE_TEMPLATE4(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3, T_PARAM4) \
00345      do { \
00346           if (POINTER) \
00347             { \
00348               (POINTER)->~T_CLASS (); \
00349               DEALLOCATOR (POINTER); \
00350             } \
00351         } \
00352      while (0)
00353 #endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */
00354 #   define ACE_DES_ARRAY_FREE_TEMPLATE2(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \
00355      do { \
00356           if (POINTER) \
00357             { \
00358               for (size_t i = 0; \
00359                    i < SIZE; \
00360                    ++i) \
00361               { \
00362                 (&(POINTER)[i])->~T_CLASS (); \
00363               } \
00364               DEALLOCATOR (POINTER); \
00365             } \
00366         } \
00367      while (0)
00368 # else /* ! ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR */
00369 #   define ACE_DES_NOFREE_TEMPLATE(POINTER,T_CLASS,T_PARAMETER) \
00370      do { \
00371           if (POINTER) \
00372             { \
00373               (POINTER)->T_CLASS T_PARAMETER::~T_CLASS (); \
00374             } \
00375         } \
00376      while (0)
00377 #   define ACE_DES_ARRAY_NOFREE_TEMPLATE(POINTER,SIZE,T_CLASS,T_PARAMETER) \
00378      do { \
00379           if (POINTER) \
00380             { \
00381               for (size_t i = 0; \
00382                    i < SIZE; \
00383                    ++i) \
00384               { \
00385                 (POINTER)[i].T_CLASS T_PARAMETER::~T_CLASS (); \
00386               } \
00387             } \
00388         } \
00389      while (0)
00390 #     define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \
00391        do { \
00392             if (POINTER) \
00393               { \
00394                 POINTER->T_CLASS T_PARAMETER::~T_CLASS (); \
00395                 DEALLOCATOR (POINTER); \
00396               } \
00397           } \
00398        while (0)
00399 #     define ACE_DES_ARRAY_FREE_TEMPLATE(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAMETER) \
00400        do { \
00401             if (POINTER) \
00402               { \
00403                 for (size_t i = 0; \
00404                      i < SIZE; \
00405                      ++i) \
00406                 { \
00407                   POINTER[i].T_CLASS T_PARAMETER::~T_CLASS (); \
00408                 } \
00409                 DEALLOCATOR (POINTER); \
00410               } \
00411           } \
00412        while (0)
00413 #     define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \
00414        do { \
00415             if (POINTER) \
00416               { \
00417                 POINTER->T_CLASS <T_PARAM1, T_PARAM2>::~T_CLASS (); \
00418                 DEALLOCATOR (POINTER); \
00419               } \
00420           } \
00421        while (0)
00422 #     define ACE_DES_FREE_TEMPLATE3(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3) \
00423        do { \
00424             if (POINTER) \
00425               { \
00426                 POINTER->T_CLASS <T_PARAM1, T_PARAM2, T_PARAM3>::~T_CLASS (); \
00427                 DEALLOCATOR (POINTER); \
00428               } \
00429           } \
00430        while (0)
00431 #     define ACE_DES_FREE_TEMPLATE4(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3,T_PARAM4) \
00432        do { \
00433             if (POINTER) \
00434               { \
00435                 POINTER->T_CLASS <T_PARAM1, T_PARAM2, T_PARAM3, T_PARAM4>::~T_CLASS (); \
00436                 DEALLOCATOR (POINTER); \
00437               } \
00438           } \
00439        while (0)
00440 #     define ACE_DES_ARRAY_FREE_TEMPLATE2(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \
00441        do { \
00442             if (POINTER) \
00443               { \
00444                 for (size_t i = 0; \
00445                      i < SIZE; \
00446                      ++i) \
00447                 { \
00448                   POINTER[i].T_CLASS <T_PARAM1, T_PARAM2>::~T_CLASS (); \
00449                 } \
00450                 DEALLOCATOR (POINTER); \
00451               } \
00452           } \
00453        while (0)
00454 # endif /* defined ! ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR */
00455 
00456 
00457 /*******************************************************************/
00458 
00459 /// Service Objects, i.e., objects dynamically loaded via the service
00460 /// configurator, must provide a destructor function with the
00461 /// following prototype to perform object cleanup.
00462 typedef void (*ACE_Service_Object_Exterminator)(void *);
00463 
00464 /** @name Service Configurator macros
00465  *
00466  * The following macros are used to define helper objects used in
00467  * ACE's Service Configurator framework, which is described in
00468  * Chapter 5 of C++NPv2 <www.cs.wustl.edu/~schmidt/ACE/book2/>.  This
00469  * framework implements the Component Configurator pattern, which is
00470  * described in Chapter 2 of POSA2 <www.cs.wustl.edu/~schmidt/POSA/>.
00471  * The intent of this pattern is to allow developers to dynamically
00472  * load and configure services into a system.  With a little help from
00473  * this macros statically linked services can also be dynamically
00474  * configured.
00475  *
00476  * More details about this component are available in the documentation
00477  * of the ACE_Service_Configurator class and also
00478  * ACE_Dynamic_Service.
00479  *
00480  * Notice that in all the macros the SERVICE_CLASS parameter must be
00481  * the name of a class derived from ACE_Service_Object.
00482  */
00483 //@{
00484 /// Declare a the data structure required to register a statically
00485 /// linked service into the service configurator.
00486 /**
00487  * The macro should be used in the header file where the service is
00488  * declared, its only argument is usually the name of the class that
00489  * implements the service.
00490  *
00491  * @param SERVICE_CLASS The name of the class implementing the
00492  *   service.
00493  */
00494 # define ACE_STATIC_SVC_DECLARE(SERVICE_CLASS) \
00495 extern ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS ;
00496 
00497 /// As ACE_STATIC_SVC_DECLARE, but using an export macro for NT
00498 /// compilers.
00499 /**
00500  * NT compilers require the use of explicit directives to export and
00501  * import symbols from a DLL.  If you need to define a service in a
00502  * dynamic library you should use this version instead.
00503  * Normally ACE uses a macro to inject the correct export/import
00504  * directives on NT.  Naturally it also the macro expands to a blank
00505  * on platforms that do not require such directives.
00506  * The first argument (EXPORT_NAME) is the prefix for this export
00507  * macro, the full name is formed by appending _Export.
00508  * ACE provides tools to generate header files that define the macro
00509  * correctly on all platforms, please see
00510  * $ACE_ROOT/bin/generate_export_file.pl
00511  *
00512  * @param EXPORT_NAME The export macro name prefix.
00513  * @param SERVICE_CLASS The name of the class implementing the service.
00514  */
00515 #define ACE_STATIC_SVC_DECLARE_EXPORT(EXPORT_NAME,SERVICE_CLASS) \
00516 extern EXPORT_NAME##_Export ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS;
00517 
00518 /// Define the data structure used to register a statically linked
00519 /// service into the Service Configurator.
00520 /**
00521  * The service configurator requires several arguments to build and
00522  * control an statically linked service, including its name, the
00523  * factory function used to construct the service, and some flags.
00524  * All those parameters are configured in a single structure, an
00525  * instance of this structure is statically initialized using the
00526  * following macro.
00527  *
00528  * @param SERVICE_CLASS The name of the class that implements the
00529  *    service, must be derived (directly or indirectly) from
00530  *    ACE_Service_Object.
00531  * @param NAME The name for this service, this name is used by the
00532  *    service configurator to match configuration options provided in
00533  *    the svc.conf file.
00534  * @param TYPE The type of object.  Objects can be streams or service
00535  *    objects.  Please read the ACE_Service_Configurator and ASX
00536  *    documentation for more details.
00537  * @param FN The name of the factory function, usually the
00538  *    ACE_SVC_NAME macro can be used to generate the name.  The
00539  *    factory function is often defined using ACE_FACTORY_DECLARE and
00540  *    ACE_FACTORY_DEFINE.
00541  * @param FLAGS Flags to control the ownership and lifecycle of the
00542  *    object. Please read the ACE_Service_Configurator documentation
00543  *    for more details.
00544  * @param ACTIVE If not zero then a thread will be dedicate to the
00545  *    service. Please read the ACE_Service_Configurator documentation
00546  *    for more details.
00547  */
00548 # define ACE_STATIC_SVC_DEFINE(SERVICE_CLASS, NAME, TYPE, FN, FLAGS, ACTIVE) \
00549 ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS = { NAME, TYPE, FN, FLAGS, ACTIVE };
00550 
00551 /// Automatically register a service with the service configurator
00552 /**
00553  * In some applications the services must be automatically registered
00554  * with the service configurator, before main() starts.
00555  * The ACE_STATIC_SVC_REQUIRE macro defines a class whose constructor
00556  * register the service, it also defines a static instance of that
00557  * class to ensure that the service is registered before main.
00558  *
00559  * On platforms that lack adequate support for static C++ objects the
00560  * macro ACE_STATIC_SVC_REGISTER can be used to explicitly register
00561  * the service.
00562  *
00563  * @todo One class per-Service_Object seems wasteful.  It should be
00564  *   possible to define a single class and re-use it for all the
00565  *   service objects, just by passing the Service_Descriptor as an
00566  *   argument to the constructor.
00567  */
00568 #if defined(ACE_LACKS_STATIC_CONSTRUCTORS)
00569 # define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\
00570 class ACE_Static_Svc_##SERVICE_CLASS {\
00571 public:\
00572   ACE_Static_Svc_##SERVICE_CLASS() { \
00573     ACE_Service_Config::insert (\
00574          &ace_svc_desc_##SERVICE_CLASS); \
00575   } \
00576 };
00577 #define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS)\
00578 ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS
00579 
00580 #else /* !ACE_LACKS_STATIC_CONSTRUCTORS */
00581 
00582 # define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\
00583 class ACE_Static_Svc_##SERVICE_CLASS {\
00584 public:\
00585   ACE_Static_Svc_##SERVICE_CLASS() { \
00586     ACE_Service_Config::insert (\
00587          &ace_svc_desc_##SERVICE_CLASS); \
00588     } \
00589 };\
00590 static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS;
00591 #define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS) do {} while (0)
00592 
00593 #endif /* !ACE_LACKS_STATIC_CONSTRUCTORS */
00594 
00595 // Preprocessor symbols will not be expanded if they are
00596 // concatenated.  Force the preprocessor to expand them during the
00597 // argument prescan by calling a macro that itself calls another that
00598 // performs the actual concatenation.
00599 #define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B
00600 #define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B)
00601 
00602 #if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1
00603 // Preprocessor symbols will not be expanded if they are
00604 // concatenated.  Force the preprocessor to expand them during the
00605 // argument prescan by calling a macro that itself calls another that
00606 // performs the actual concatenation.
00607 # define ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(PREFIX,VERSIONED_NAMESPACE,SERVICE_CLASS) PREFIX ## _ ## VERSIONED_NAMESPACE ## _ ## SERVICE_CLASS
00608 #else
00609 # define ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(PREFIX,VERSIONED_NAMESPACE,SERVICE_CLASS) PREFIX ## _ ## SERVICE_CLASS
00610 #endif  /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
00611 
00612 #define ACE_MAKE_SVC_CONFIG_FACTORY_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_make,VERSIONED_NAMESPACE,SERVICE_CLASS)
00613 #define ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_gobble,VERSIONED_NAMESPACE,SERVICE_CLASS)
00614 
00615 
00616 /// Declare the factory method used to create dynamically loadable
00617 /// services.
00618 /**
00619  * Once the service implementation is dynamically loaded the Service
00620  * Configurator uses a factory method to create the object.
00621  * This macro declares such a factory function with the proper
00622  * interface and export macros.
00623  * Normally used in the header file that declares the service
00624  * implementation.
00625  *
00626  * @param CLS must match the prefix of the export macro used for this
00627  *        service.
00628  * @param SERVICE_CLASS must match the name of the class that
00629  *        implements the service.
00630  *
00631  */
00632 # define ACE_FACTORY_DECLARE(CLS,SERVICE_CLASS) \
00633 extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * \
00634 ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *);
00635 
00636 /// Define the factory method (and destructor) for a dynamically
00637 /// loadable service.
00638 /**
00639  * Use with arguments matching ACE_FACTORY_DECLARE.
00640  * Normally used in the .cpp file that defines the service
00641  * implementation.
00642  *
00643  * This macro defines both the factory method and the function used to
00644  * cleanup the service object.
00645  *
00646  * If this macro is used to define a factory function that need not be
00647  * exported (for example, in a static service situation), CLS can be
00648  * specified as ACE_Local_Service.
00649  */
00650 # define ACE_Local_Service_Export
00651 
00652 #if defined (ACE_OPENVMS)
00653 # define ACE_PREPROC_STRINGIFY(A) #A
00654 # define ACE_MAKE_SVC_REGISTRAR_ARG(A) ACE_PREPROC_STRINGIFY(A), &A
00655 # define ACE_FACTORY_DEFINE(CLS,SERVICE_CLASS) \
00656 void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \
00657   ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \
00658     static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \
00659   ACE_ASSERT (_p != 0); \
00660   delete _p; } \
00661 extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\
00662 ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \
00663 { \
00664   ACE_TRACE (#SERVICE_CLASS); \
00665   if (gobbler != 0) \
00666     *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \
00667   return new SERVICE_CLASS; \
00668 } \
00669 ACE_Static_Svc_Registrar ace_svc_reg_##SERVICE_CLASS \
00670   (ACE_MAKE_SVC_REGISTRAR_ARG(ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS)));
00671 #else
00672 # define ACE_FACTORY_DEFINE(CLS,SERVICE_CLASS) \
00673 void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \
00674   ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \
00675     static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \
00676   ACE_ASSERT (_p != 0); \
00677   delete _p; } \
00678 extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\
00679 ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \
00680 { \
00681   ACE_TRACE (#SERVICE_CLASS); \
00682   if (gobbler != 0) \
00683     *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \
00684   return new SERVICE_CLASS; \
00685 }
00686 #endif
00687 
00688 /**
00689  * For service classes scoped within namespaces, use this macro in
00690  * place of ACE_FACTORY_DEFINE. The third argument in this case is
00691  * the fully scoped name of the class as it is to be
00692  * instantiated. For example, given:
00693  * namespace ACE
00694  * {
00695  *   namespace Foo
00696  *   {
00697  *     class Bar : public ACE_Service_Object
00698  *     {};
00699  *   };
00700  * };
00701  *
00702  * ACE_FACTORY_DECLARE(ACE,ACE_Foo_Bar)
00703  *
00704  * you would then use:
00705  *
00706  * ACE_FACTORY_NAMESPACE_DEFINE(ACE,ACE_Foo_Bar,ACE::Foo::Bar)
00707  *
00708  * Note that in this example, the ACE_FACTORY_DECLARE is done outside
00709  * the namespace scope. Then, the SERVICE_CLASS name is the same as
00710  * the fully scoped class name, but with '::' replaced with '_'. Doing
00711  * this will ensure unique generated signatures for the various C
00712  * style functions.
00713  */
00714 #if defined (ACE_OPENVMS)
00715 # define ACE_PREPROC_STRINGIFY(A) #A
00716 # define ACE_MAKE_SVC_REGISTRAR_ARG(A) ACE_PREPROC_STRINGIFY(A), &A
00717 # define ACE_FACTORY_NAMESPACE_DEFINE(CLS,SERVICE_CLASS,NAMESPACE_CLASS) \
00718 void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \
00719   ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \
00720     static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \
00721   ACE_ASSERT (_p != 0); \
00722   delete _p; } \
00723 extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\
00724 ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \
00725 { \
00726   ACE_TRACE (#SERVICE_CLASS); \
00727   if (gobbler != 0) \
00728     *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \
00729   return new NAMESPACE_CLASS; \
00730 } \
00731 ACE_Static_Svc_Registrar ace_svc_reg_##SERVICE_CLASS \
00732   (ACE_MAKE_SVC_REGISTRAR_ARG(ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS)));
00733 #else
00734 # define ACE_FACTORY_NAMESPACE_DEFINE(CLS,SERVICE_CLASS,NAMESPACE_CLASS) \
00735 void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \
00736   ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \
00737     static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \
00738   ACE_ASSERT (_p != 0); \
00739   delete _p; } \
00740 extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\
00741 ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \
00742 { \
00743   ACE_TRACE (#SERVICE_CLASS); \
00744   if (gobbler != 0) \
00745     *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \
00746   return new NAMESPACE_CLASS; \
00747 }
00748 #endif
00749 
00750 /// The canonical name for a service factory method
00751 # define ACE_SVC_NAME(SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS)
00752 
00753 /// The canonical way to invoke (i.e. construct) a service factory
00754 /// method.
00755 #define ACE_SVC_INVOKE(SERVICE_CLASS) ACE_SVC_NAME(SERVICE_CLASS) (0)
00756 
00757 //@}
00758 
00759 /** @name Helper macros for services defined in the netsvcs library.
00760  *
00761  * The ACE services defined in netsvcs use this helper macros for
00762  * simplicity.
00763  *
00764  */
00765 //@{
00766 # define ACE_SVC_FACTORY_DECLARE(X) ACE_FACTORY_DECLARE (ACE_Svc, X)
00767 # define ACE_SVC_FACTORY_DEFINE(X) ACE_FACTORY_DEFINE (ACE_Svc, X)
00768 //@}
00769 
00770 #if defined (ACE_WIN32)
00771 // These are used in SPIPE_Acceptor/Connector, but are ignored at runtime.
00772 #   if defined (ACE_HAS_WINCE)
00773 #     if !defined (PIPE_TYPE_MESSAGE)
00774 #       define PIPE_TYPE_MESSAGE  0
00775 #     endif
00776 #     if !defined (PIPE_READMODE_MESSAGE)
00777 #       define PIPE_READMODE_MESSAGE  0
00778 #     endif
00779 #     if !defined (PIPE_WAIT)
00780 #       define PIPE_WAIT  0
00781 #     endif
00782 #   endif /* ACE_HAS_WINCE */
00783 #else /* !ACE_WIN32 */
00784 // Add some typedefs and macros to enhance Win32 conformance...
00785 #   if !defined (LPSECURITY_ATTRIBUTES)
00786 #     define LPSECURITY_ATTRIBUTES int
00787 #   endif /* !defined LPSECURITY_ATTRIBUTES */
00788 #   if !defined (GENERIC_READ)
00789 #     define GENERIC_READ 0
00790 #   endif /* !defined GENERIC_READ */
00791 #   if !defined (FILE_SHARE_READ)
00792 #     define FILE_SHARE_READ 0
00793 #   endif /* !defined FILE_SHARE_READ */
00794 #   if !defined (OPEN_EXISTING)
00795 #     define OPEN_EXISTING 0
00796 #   endif /* !defined OPEN_EXISTING */
00797 #   if !defined (FILE_ATTRIBUTE_NORMAL)
00798 #     define FILE_ATTRIBUTE_NORMAL 0
00799 #   endif /* !defined FILE_ATTRIBUTE_NORMAL */
00800 #   if !defined (MAXIMUM_WAIT_OBJECTS)
00801 #     define MAXIMUM_WAIT_OBJECTS 0
00802 #   endif /* !defined MAXIMUM_WAIT_OBJECTS */
00803 #   if !defined (FILE_FLAG_OVERLAPPED)
00804 #     define FILE_FLAG_OVERLAPPED 0
00805 #   endif /* !defined FILE_FLAG_OVERLAPPED */
00806 #   if !defined (FILE_FLAG_SEQUENTIAL_SCAN)
00807 #     define FILE_FLAG_SEQUENTIAL_SCAN 0
00808 #   endif   /* FILE_FLAG_SEQUENTIAL_SCAN */
00809 #   if !defined(FILE_FLAG_WRITE_THROUGH)
00810 #     define FILE_FLAG_WRITE_THROUGH 0
00811 #   endif /* !defined FILE_FLAG_WRITE_THROUGH */
00812 #   if !defined(PIPE_WAIT)
00813 #     define PIPE_WAIT 0
00814 #   endif /* !defined PIPE_WAIT */
00815 #   if !defined(PIPE_NOWAIT)
00816 #     define PIPE_NOWAIT 0
00817 #   endif /* !defined PIPE_WAIT */
00818 #   if !defined(PIPE_READMODE_BYTE)
00819 #     define PIPE_READMODE_BYTE 0
00820 #   endif /* !defined PIPE_READMODE_BYTE */
00821 #   if !defined(PIPE_READMODE_MESSAGE)
00822 #     define PIPE_READMODE_MESSAGE 0
00823 #   endif /* !defined PIPE_READMODE_MESSAGE */
00824 #   if !defined(PIPE_TYPE_BYTE)
00825 #     define PIPE_TYPE_BYTE 0
00826 #   endif /* !defined PIPE_TYPE_BYTE */
00827 #   if !defined(PIPE_TYPE_MESSAGE)
00828 #     define PIPE_TYPE_MESSAGE 0
00829 #   endif /* !defined PIPE_TYPE_MESSAGE */
00830 #endif /* ACE_WIN32 */
00831 
00832 
00833 // Some useful abstrations for expressions involving
00834 // ACE_Allocator.malloc ().  The difference between ACE_NEW_MALLOC*
00835 // with ACE_ALLOCATOR* is that they call constructors also.
00836 
00837 #include "ace/OS_Errno.h"    /* Need errno and ENOMEM */
00838 
00839 # define ACE_ALLOCATOR_RETURN(POINTER,ALLOCATOR,RET_VAL) \
00840    do { POINTER = ALLOCATOR; \
00841      if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
00842    } while (0)
00843 # define ACE_ALLOCATOR(POINTER,ALLOCATOR) \
00844    do { POINTER = ALLOCATOR; \
00845      if (POINTER == 0) { errno = ENOMEM; return; } \
00846    } while (0)
00847 # define ACE_ALLOCATOR_NORETURN(POINTER,ALLOCATOR) \
00848    do { POINTER = ALLOCATOR; \
00849      if (POINTER == 0) { errno = ENOMEM; } \
00850    } while (0)
00851 
00852 # define ACE_NEW_MALLOC_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,RET_VAL) \
00853    do { POINTER = ALLOCATOR; \
00854      if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \
00855      else { (void) new (POINTER) CONSTRUCTOR; } \
00856    } while (0)
00857 # define ACE_NEW_MALLOC(POINTER,ALLOCATOR,CONSTRUCTOR) \
00858    do { POINTER = ALLOCATOR; \
00859      if (POINTER == 0) { errno = ENOMEM; return;} \
00860      else { (void) new (POINTER) CONSTRUCTOR; } \
00861    } while (0)
00862 # define ACE_NEW_MALLOC_NORETURN(POINTER,ALLOCATOR,CONSTRUCTOR) \
00863    do { POINTER = ALLOCATOR; \
00864      if (POINTER == 0) { errno = ENOMEM;} \
00865      else { (void) new (POINTER) CONSTRUCTOR; } \
00866    } while (0)
00867 
00868 /* ACE_Metrics */
00869 #if defined ACE_LACKS_ARRAY_PLACEMENT_NEW
00870 # define ACE_NEW_MALLOC_ARRAY_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT,RET_VAL) \
00871    do { POINTER = ALLOCATOR; \
00872      if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \
00873      else { for (u_int i = 0; i < COUNT; ++i) \
00874               {(void) new (POINTER) CONSTRUCTOR; ++POINTER;} \
00875             POINTER -= COUNT;} \
00876    } while (0)
00877 # define ACE_NEW_MALLOC_ARRAY(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT) \
00878    do { POINTER = ALLOCATOR; \
00879      if (POINTER == 0) { errno = ENOMEM; return;} \
00880      else { for (u_int i = 0; i < COUNT; ++i) \
00881               {(void) new (POINTER) CONSTRUCTOR; ++POINTER;} \
00882             POINTER -= COUNT;} \
00883    } while (0)
00884 #else /* ! defined ACE_LACKS_ARRAY_PLACEMENT_NEW */
00885 # define ACE_NEW_MALLOC_ARRAY_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT,RET_VAL) \
00886    do { POINTER = ALLOCATOR; \
00887      if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \
00888      else { (void) new (POINTER) CONSTRUCTOR [COUNT]; } \
00889    } while (0)
00890 # define ACE_NEW_MALLOC_ARRAY(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT) \
00891    do { POINTER = ALLOCATOR; \
00892      if (POINTER == 0) { errno = ENOMEM; return;} \
00893      else { (void) new (POINTER) CONSTRUCTOR [COUNT]; } \
00894    } while (0)
00895 #endif /* defined ACE_LACKS_ARRAY_PLACEMENT_NEW */
00896 
00897 // This is being placed here temporarily to help stablelize the builds, but will
00898 // be moved out along with the above macros as part of the subsetting.  dhinton
00899 //# if !defined (ACE_HAS_WINCE)
00900 #   if !defined (ACE_LACKS_NEW_H)
00901 #     if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
00902 #       include /**/ <new>
00903 #     else
00904 #       include /**/ <new.h>
00905 #     endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
00906 #   endif /* ! ACE_LACKS_NEW_H */
00907 //# endif /* !ACE_HAS_WINCE */
00908 
00909 # define ACE_NOOP(x)
00910 
00911 #if defined (ACE_WIN32)
00912 #   if !defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
00913 #     define ACE_SEH_TRY if (1)
00914 #     define ACE_SEH_EXCEPT(X) while (0)
00915 #     define ACE_SEH_FINALLY if (1)
00916 #   elif defined(__BORLANDC__)
00917 #     define ACE_SEH_TRY try
00918 #     define ACE_SEH_EXCEPT(X) __except(X)
00919 #     define ACE_SEH_FINALLY __finally
00920 #   elif defined (__IBMCPP__) && (__IBMCPP__ >= 400)
00921 #     define ACE_SEH_TRY if (1)
00922 #     define ACE_SEH_EXCEPT(X) while (0)
00923 #     define ACE_SEH_FINALLY if (1)
00924 #   else
00925 #     define ACE_SEH_TRY __try
00926 #     define ACE_SEH_EXCEPT(X) __except(X)
00927 #     define ACE_SEH_FINALLY __finally
00928 #   endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
00929 # else /* !ACE_WIN32 */
00930 #   define ACE_SEH_TRY if (1)
00931 #   define ACE_SEH_EXCEPT(X) while (0)
00932 #   define ACE_SEH_FINALLY if (1)
00933 #endif /* ACE_WIN32 */
00934 
00935 
00936 // These should probably be put into a seperate header.
00937 
00938 // The following is necessary since many C++ compilers don't support
00939 // typedef'd types inside of classes used as formal template
00940 // arguments... ;-(.  Luckily, using the C++ preprocessor I can hide
00941 // most of this nastiness!
00942 
00943 # if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
00944 
00945 // Handle ACE_Message_Queue.
00946 #   define ACE_SYNCH_DECL class _ACE_SYNCH
00947 #   define ACE_SYNCH_USE _ACE_SYNCH
00948 #   define ACE_SYNCH_MUTEX_T ACE_TYPENAME _ACE_SYNCH::MUTEX
00949 #   define ACE_SYNCH_CONDITION_T ACE_TYPENAME _ACE_SYNCH::CONDITION
00950 #   define ACE_SYNCH_SEMAPHORE_T ACE_TYPENAME _ACE_SYNCH::SEMAPHORE
00951 
00952 // Handle ACE_Malloc*
00953 #   define ACE_MEM_POOL_1 class _ACE_MEM_POOL
00954 #   define ACE_MEM_POOL_2 _ACE_MEM_POOL
00955 #   define ACE_MEM_POOL _ACE_MEM_POOL
00956 #   define ACE_MEM_POOL_OPTIONS ACE_TYPENAME _ACE_MEM_POOL::OPTIONS
00957 
00958 // Handle ACE_Svc_Handler
00959 #   define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM
00960 #   define ACE_PEER_STREAM_2 _ACE_PEER_STREAM
00961 #   define ACE_PEER_STREAM _ACE_PEER_STREAM
00962 #   define ACE_PEER_STREAM_ADDR ACE_TYPENAME _ACE_PEER_STREAM::PEER_ADDR
00963 
00964 // Handle ACE_Acceptor
00965 #   define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR
00966 #   define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR
00967 #   define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR
00968 #   define ACE_PEER_ACCEPTOR_ADDR ACE_TYPENAME _ACE_PEER_ACCEPTOR::PEER_ADDR
00969 
00970 // Handle ACE_Connector
00971 #   define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR
00972 #   define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR
00973 #   define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR
00974 #   define ACE_PEER_CONNECTOR_ADDR ACE_TYPENAME _ACE_PEER_CONNECTOR::PEER_ADDR
00975 #   if !defined(ACE_HAS_TYPENAME_KEYWORD)
00976 #     define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any
00977 #   else
00978     //
00979     // If the compiler supports 'typename' we cannot use
00980     //
00981     // PEER_CONNECTOR::PEER_ADDR::sap_any
00982     //
00983     // because PEER_CONNECTOR::PEER_ADDR is not considered a type. But:
00984     //
00985     // typename PEER_CONNECTOR::PEER_ADDR::sap_any
00986     //
00987     // will not work either, because now we are declaring sap_any a
00988     // type, further:
00989     //
00990     // (typename PEER_CONNECTOR::PEER_ADDR)::sap_any
00991     //
00992     // is considered a casting expression. All I can think of is using a
00993     // typedef, I tried PEER_ADDR but that was a source of trouble on
00994     // some platforms. I will try:
00995     //
00996 #     define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_ADDR_TYPEDEF::sap_any
00997 #   endif /* ACE_HAS_TYPENAME_KEYWORD */
00998 
00999 // Handle ACE_SOCK_*
01000 #   define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor
01001 #   define ACE_SOCK_CONNECTOR ACE_SOCK_Connector
01002 #   define ACE_SOCK_STREAM ACE_SOCK_Stream
01003 #   define ACE_SOCK_DGRAM ACE_SOCK_Dgram
01004 #   define ACE_SOCK_DGRAM_BCAST ACE_SOCK_Dgram_Bcast
01005 #   define ACE_SOCK_DGRAM_MCAST ACE_SOCK_Dgram_Mcast
01006 
01007 // Handle ACE_SOCK_SEQPACK_*
01008 #   define ACE_SOCK_SEQPACK_ACCEPTOR ACE_SOCK_SEQPACK_Acceptor
01009 #   define ACE_SOCK_SEQPACK_CONNECTOR ACE_SOCK_SEQPACK_Connector
01010 #   define ACE_SOCK_SEQPACK_ASSOCIATION ACE_SOCK_SEQPACK_Association
01011 
01012 // Handle ACE_MEM_*
01013 #   define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor
01014 #   define ACE_MEM_CONNECTOR ACE_MEM_Connector
01015 #   define ACE_MEM_STREAM ACE_MEM_Stream
01016 
01017 // Handle ACE_LSOCK_*
01018 #   define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor
01019 #   define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector
01020 #   define ACE_LSOCK_STREAM ACE_LSOCK_Stream
01021 
01022 // Handle ACE_TLI_*
01023 #   define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor
01024 #   define ACE_TLI_CONNECTOR ACE_TLI_Connector
01025 #   define ACE_TLI_STREAM ACE_TLI_Stream
01026 
01027 // Handle ACE_SPIPE_*
01028 #   define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor
01029 #   define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector
01030 #   define ACE_SPIPE_STREAM ACE_SPIPE_Stream
01031 
01032 // Handle ACE_UPIPE_*
01033 #   define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor
01034 #   define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector
01035 #   define ACE_UPIPE_STREAM ACE_UPIPE_Stream
01036 
01037 // Handle ACE_FILE_*
01038 #   define ACE_FILE_CONNECTOR ACE_FILE_Connector
01039 #   define ACE_FILE_STREAM ACE_FILE_IO
01040 
01041 // Handle ACE_*_Memory_Pool.
01042 #   define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool
01043 #   define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool
01044 #   define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool
01045 #   define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool
01046 #   define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool
01047 #   define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool
01048 
01049 # else /* TEMPLATES are broken in some form or another (i.e., most C++ compilers) */
01050 
01051 // Handle ACE_Message_Queue.
01052 #   if defined (ACE_HAS_OPTIMIZED_MESSAGE_QUEUE)
01053 #     define ACE_SYNCH_DECL class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T, class _ACE_SYNCH_SEMAPHORE_T
01054 #     define ACE_SYNCH_USE _ACE_SYNCH_MUTEX_T, _ACE_SYNCH_CONDITION_T, _ACE_SYNCH_SEMAPHORE_T
01055 #   else
01056 #     define ACE_SYNCH_DECL class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T
01057 #     define ACE_SYNCH_USE _ACE_SYNCH_MUTEX_T, _ACE_SYNCH_CONDITION_T
01058 #   endif /* ACE_HAS_OPTIMIZED_MESSAGE_QUEUE */
01059 #   define ACE_SYNCH_MUTEX_T _ACE_SYNCH_MUTEX_T
01060 #   define ACE_SYNCH_CONDITION_T _ACE_SYNCH_CONDITION_T
01061 #   define ACE_SYNCH_SEMAPHORE_T _ACE_SYNCH_SEMAPHORE_T
01062 
01063 // Handle ACE_Malloc*
01064 #   define ACE_MEM_POOL_1 class _ACE_MEM_POOL, class _ACE_MEM_POOL_OPTIONS
01065 #   define ACE_MEM_POOL_2 _ACE_MEM_POOL, _ACE_MEM_POOL_OPTIONS
01066 #   define ACE_MEM_POOL _ACE_MEM_POOL
01067 #   define ACE_MEM_POOL_OPTIONS _ACE_MEM_POOL_OPTIONS
01068 
01069 // Handle ACE_Svc_Handler
01070 #   define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM, class _ACE_PEER_ADDR
01071 #   define ACE_PEER_STREAM_2 _ACE_PEER_STREAM, _ACE_PEER_ADDR
01072 #   define ACE_PEER_STREAM _ACE_PEER_STREAM
01073 #   define ACE_PEER_STREAM_ADDR _ACE_PEER_ADDR
01074 
01075 // Handle ACE_Acceptor
01076 #   define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR, class _ACE_PEER_ADDR
01077 #   define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR, _ACE_PEER_ADDR
01078 #   define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR
01079 #   define ACE_PEER_ACCEPTOR_ADDR _ACE_PEER_ADDR
01080 
01081 // Handle ACE_Connector
01082 #   define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR
01083 #   define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR
01084 #   define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR
01085 #   define ACE_PEER_CONNECTOR_ADDR _ACE_PEER_ADDR
01086 #   define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any
01087 
01088 // Handle ACE_SOCK_*
01089 #   define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor, ACE_INET_Addr
01090 #   define ACE_SOCK_CONNECTOR ACE_SOCK_Connector, ACE_INET_Addr
01091 #   define ACE_SOCK_STREAM ACE_SOCK_Stream, ACE_INET_Addr
01092 #   define ACE_SOCK_DGRAM ACE_SOCK_Dgram, ACE_INET_Addr
01093 #   define ACE_SOCK_DGRAM_BCAST ACE_SOCK_Dgram_Bcast, ACE_INET_Addr
01094 #   define ACE_SOCK_DGRAM_MCAST ACE_SOCK_Dgram_Mcast, ACE_INET_Addr
01095 
01096 // Handle ACE_SOCK_SEQPACK_*
01097 #   define ACE_SOCK_SEQPACK_ACCEPTOR ACE_SOCK_SEQPACK_Acceptor, ACE_Multihomed_INET_Addr
01098 #   define ACE_SOCK_SEQPACK_CONNECTOR ACE_SOCK_SEQPACK_Connector, ACE_Multihomed_INET_Addr
01099 #   define ACE_SOCK_SEQPACK_ASSOCIATION ACE_SOCK_SEQPACK_Association, ACE_Multihomed_INET_Addr
01100 
01101 // Handle ACE_MEM_*
01102 #   define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor, ACE_MEM_Addr
01103 #   define ACE_MEM_CONNECTOR ACE_MEM_Connector, ACE_INET_Addr
01104 #   define ACE_MEM_STREAM ACE_MEM_Stream, ACE_INET_Addr
01105 
01106 // Handle ACE_LSOCK_*
01107 #   define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor, ACE_UNIX_Addr
01108 #   define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector, ACE_UNIX_Addr
01109 #   define ACE_LSOCK_STREAM ACE_LSOCK_Stream, ACE_UNIX_Addr
01110 
01111 // Handle ACE_TLI_*
01112 #   define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor, ACE_INET_Addr
01113 #   define ACE_TLI_CONNECTOR ACE_TLI_Connector, ACE_INET_Addr
01114 #   define ACE_TLI_STREAM ACE_TLI_Stream, ACE_INET_Addr
01115 
01116 // Handle ACE_SPIPE_*
01117 #   define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor, ACE_SPIPE_Addr
01118 #   define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector, ACE_SPIPE_Addr
01119 #   define ACE_SPIPE_STREAM ACE_SPIPE_Stream, ACE_SPIPE_Addr
01120 
01121 // Handle ACE_UPIPE_*
01122 #   define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor, ACE_SPIPE_Addr
01123 #   define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector, ACE_SPIPE_Addr
01124 #   define ACE_UPIPE_STREAM ACE_UPIPE_Stream, ACE_SPIPE_Addr
01125 
01126 // Handle ACE_FILE_*
01127 #   define ACE_FILE_CONNECTOR ACE_FILE_Connector, ACE_FILE_Addr
01128 #   define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr
01129 
01130 // Handle ACE_*_Memory_Pool.
01131 #   define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options
01132 #   define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options
01133 #   define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool, ACE_Sbrk_Memory_Pool_Options
01134 #   define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool, ACE_Shared_Memory_Pool_Options
01135 #   define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool, ACE_Local_Memory_Pool_Options
01136 #   define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool, ACE_Pagefile_Memory_Pool_Options
01137 # endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
01138 
01139 #include /**/ "ace/post.h"
01140 
01141 #endif /*ACE_GLOBAL_MACROS_H*/

Generated on Thu Nov 9 09:41:51 2006 for ACE by doxygen 1.3.6