Global_Macros.h

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

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